Skip to content

Race condition between prompt updates and closing of execute request #11113

@lionel-

Description

@lionel-

I can't reproduce this race condition all the time but when it does happen the behaviour is sticky for a while. What happens is that after leaving a debugging session, the debugger prompt is incorrectly displayed:

Browse[1]>

Evaluating something (even empty evaluation) then restores the expected prompt:

>

The race condition

Here is the flow of the prompt update when we leave a debugging session:

AFAICT the event propagation on the main thread side is all synchronous. So I think the race condition comes from the very first step, sending an event via the UI comm before closing the active request. The comm event is sent via IOPub whereas the closing of the execute_request is via Shell. If something in the IOPub messaging is a little slower, the prompt update might arrive in the extension host after the closing of the execute request.

To fix this, we could include the prompt information in the response to the execute_request instead of sending it separately.

Weirdness in dynState ownership and synchronisation

Relatedly I've noticed a weirdness in the ownership and synchronisation model of dynState. The sessions on the extension hosts are required to have a dynState containing things like the session name and the prompts, but prompts are never actually updated after initialisation. I think a simpler setup for the dynState would be for it to live entirely on the main thread side, perhaps allowing extensions to retrieve it (although this might not even be needed).

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions