Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Manage kernel message queueing better to prevent out-of-order execution #9571

Merged
merged 5 commits into from Jan 8, 2021

Commits on Jan 7, 2021

  1. Copy the full SHA
    b1409f1 View commit details
    Browse the repository at this point in the history
  2. Manage kernel message queueing better to prevent out-of-order execution.

    Fixes jupyterlab#9566
    Followup on jupyterlab#8562
    Changes solution in jupyterlab#9484
    
    If we restarted a kernel, then quickly evaluated a lot of cells, we were often seeing the cells evaluated out of order. This came because the initial evaluations would be queued (because we had the kernel restarting sentinel in place), but later evaluations would happen synchronously, even if there were still messages queued. The logic is now changed to (almost) always queue a message if there are already queued messages waiting to be sent to preserve the message order.
    
    One exception to this is the kernel info request when we are restarting. We redo the logic in jupyterlab#9484 to encode the exception in the _sendMessage function (rather than hacking around the conditions for queueing a message). This brings the exception closer to the logic it is working around, so it is a bit cleaner.
    
    Also, we realize that the sendMessage `queue` parameter is really signifying when we are sending pending messages. As such, we always try to send those messages if we can.
    
    Finally, we saw that there was a race condition between sending messages after a restart and when the websocket was reconnected, leading to some stalled initial message replies. We delete the logic that sends pending messages on shutdown_reply, since those pending messages will be more correctly sent when the websocket reconnects anyway. We also don’t worry about setting the kernel session there since the calling function does that logic.
    jasongrout committed Jan 7, 2021
    Copy the full SHA
    cc74609 View commit details
    Browse the repository at this point in the history
  3. Copy the full SHA
    56faad1 View commit details
    Browse the repository at this point in the history

Commits on Jan 8, 2021

  1. lint

    jasongrout committed Jan 8, 2021
    Copy the full SHA
    d63d9f9 View commit details
    Browse the repository at this point in the history
  2. Copy the full SHA
    b5ae089 View commit details
    Browse the repository at this point in the history