Skip to content

Commit 7ea775c

Browse files
committed
Don't set explicit IDENTITY for clients
explicit IDENTITIES imply a potentially undesirable side-effect called 'durable sockets', which should be avoided.
1 parent 072f555 commit 7ea775c

2 files changed

Lines changed: 4 additions & 11 deletions

File tree

IPython/parallel/client/client.py

Lines changed: 1 addition & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -466,7 +466,7 @@ def __init__(self, url_or_file=None, profile=None, profile_dir=None, ipython_dir
466466
self.session = Session(**extra_args)
467467

468468
self._query_socket = self._context.socket(zmq.DEALER)
469-
self._query_socket.setsockopt(zmq.IDENTITY, self.session.bsession)
469+
470470
if self._ssh:
471471
tunnel.tunnel_connection(self._query_socket, url, sshserver, **ssh_kwargs)
472472
else:
@@ -607,29 +607,21 @@ def connect_socket(s, url):
607607
ident = self.session.bsession
608608
if content.mux:
609609
self._mux_socket = self._context.socket(zmq.DEALER)
610-
self._mux_socket.setsockopt(zmq.IDENTITY, ident)
611610
connect_socket(self._mux_socket, content.mux)
612611
if content.task:
613612
self._task_scheme, task_addr = content.task
614613
self._task_socket = self._context.socket(zmq.DEALER)
615-
self._task_socket.setsockopt(zmq.IDENTITY, ident)
616614
connect_socket(self._task_socket, task_addr)
617615
if content.notification:
618616
self._notification_socket = self._context.socket(zmq.SUB)
619617
connect_socket(self._notification_socket, content.notification)
620618
self._notification_socket.setsockopt(zmq.SUBSCRIBE, b'')
621-
# if content.query:
622-
# self._query_socket = self._context.socket(zmq.DEALER)
623-
# self._query_socket.setsockopt(zmq.IDENTITY, self.session.bsession)
624-
# connect_socket(self._query_socket, content.query)
625619
if content.control:
626620
self._control_socket = self._context.socket(zmq.DEALER)
627-
self._control_socket.setsockopt(zmq.IDENTITY, ident)
628621
connect_socket(self._control_socket, content.control)
629622
if content.iopub:
630623
self._iopub_socket = self._context.socket(zmq.SUB)
631624
self._iopub_socket.setsockopt(zmq.SUBSCRIBE, b'')
632-
self._iopub_socket.setsockopt(zmq.IDENTITY, ident)
633625
connect_socket(self._iopub_socket, content.iopub)
634626
self._update_engines(dict(content.engines))
635627
else:

IPython/parallel/controller/hub.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -585,7 +585,7 @@ def save_queue_request(self, idents, msg):
585585
self.log.info("queue::client %r submitted request %r to %s", client_id, msg_id, eid)
586586
# Unicode in records
587587
record['engine_uuid'] = queue_id.decode('ascii')
588-
record['client_uuid'] = client_id.decode('ascii')
588+
record['client_uuid'] = msg['header']['session']
589589
record['queue'] = 'mux'
590590

591591
try:
@@ -677,7 +677,7 @@ def save_task_request(self, idents, msg):
677677
return
678678
record = init_record(msg)
679679

680-
record['client_uuid'] = client_id.decode('ascii')
680+
record['client_uuid'] = msg['header']['session']
681681
record['queue'] = 'task'
682682
header = msg['header']
683683
msg_id = header['msg_id']
@@ -1205,6 +1205,7 @@ def finish(reply):
12051205
self.db.add_record(msg_id, init_record(msg))
12061206
except Exception:
12071207
self.log.error("db::DB Error updating record: %s", msg_id, exc_info=True)
1208+
return finish(error.wrap_exception())
12081209

12091210
finish(dict(status='ok', resubmitted=resubmitted))
12101211

0 commit comments

Comments
 (0)