Skip to content

locks in stdout #198

@minrk

Description

@minrk

The addition of the IOPub thread in 4.3 for async threaded output uses locks in a few places to ensure threadsafety. This generally works, but causes a problem in one particular case: interactive debugging. The reason being that stepping through an interactive debug session introduces concurrency between a non-running thread (the debugging thread) and the debugger itself, allowing for the following sequence of events:

  1. debugged thread* acquires lock on stdout buffer, pauses waiting for next step
  2. debugger UI tries to draw the current frame to stdout, and waits for debugged thread to release the lock, which never happens.

Which ultimately means that you can't debug anything with a print statement (post-mortem debugging is not affected).

I believe that I can write a lock-free implementation, but I might need to use inproc zmq sockets to do so. I will see if I can do it with plain os.pipe as well, but I'm not sure that I can as easily.

cc @garth-wells who reported the issue.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions