Skip to content

Commit 34baae5

Browse files
authored
Merge pull request #3759 from minrk/flush-iopub
flush iopub before sending restarting/dead status messages
2 parents eed1caf + a53d2c8 commit 34baae5

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

notebook/services/kernels/handlers.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -456,6 +456,12 @@ def on_close(self):
456456
self._close_future.set_result(None)
457457

458458
def _send_status_message(self, status):
459+
iopub = self.channels.get('iopub', None)
460+
if iopub and not iopub.closed():
461+
# flush IOPub before sending a restarting/dead status message
462+
# ensures proper ordering on the IOPub channel
463+
# that all messages from the stopped kernel have been delivered
464+
iopub.flush()
459465
msg = self.session.msg("status",
460466
{'execution_state': status}
461467
)

0 commit comments

Comments
 (0)