Skip to content

PtyProcess.spawn just got slower and can trigger problems #52

Open

Description

@cagney

This is somewhat related to #43.

Python 3.7.1 contains the change https://bugs.python.org/issue6721 that is trying to avoid a deadlock in the logging code. It works by having os.fork() grab all the logging locks before executing fork(). It's expensive - if the forked process is just going to exec then os.spawn() is preferred. Its also creating, lets say, interesting problems (deadlocks) with code that was working.

Since PtyProcess calls pty.fork() (which calls os.fork() ...) it triggering this code path.

Using some equivalent of os.spawn() would eliminate this.

Activity

  1. takluyver commented on Apr 5, 2019

    @takluyver
    Member

    I don't know how to combine the os.spawn* functions - or anything that doesn't involve a fork - with setting up a new pty as the controlling terminal of the child process. I suspect it's not possible, but it would be very nice if it was. If you figure it out, please let me know!

  2. cagney commented on Apr 11, 2019

    @cagney
    Author

    This is probably obsolete, #53 completely avoids fork().

  3. krassowski commented on Nov 4, 2026

    @krassowski
    1. I don't know how to combine the os.spawn* functions - or anything that doesn't involve a fork - with setting up a new pty as the controlling terminal of the child process. I suspect it's not possible, but it would be very nice if it was. If you figure it out, please let me know!

    @takluyver I opened #89 with a proposal

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions