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

Use multiprocessing start_method "spawn" #4305

Closed

Conversation

rwgk
Copy link
Collaborator

@rwgk rwgk commented Nov 1, 2022

Description

Quoting from

https://docs.python.org/3/library/multiprocessing.html#contexts-and-start-methods

  • fork

    ... Note that safely forking a multithreaded process is problematic.

    Available on Unix only. The default on Unix.

The idea to try "spawn" is the result of deadlock debugging. After reviewing tracebacks @jbms wrote:

This actually looks like a general fork thread-safety issue, not related to pybind11. Using fork in a multithreaded program is generally not safe.

Suggested changelog entry:

Quoting from

https://docs.python.org/3/library/multiprocessing.html#contexts-and-start-methods

* fork

  ... Note that safely forking a multithreaded process is problematic.

  Available on Unix only. The default on Unix.

The idea to try `"spawn"` is the result of deadlock debugging. After reviewing tracebacks @jbms wrote:

> This actually looks like a general fork thread-safety issues, not related to pybind11
> Using fork in a multithreaded program is generally not safe
@rwgk
Copy link
Collaborator Author

rwgk commented Nov 1, 2022

Works! That's one way to get rid of the deadlocks (hoping this will do the trick). But I'll try "forkserver", too, in another PR.

rwgk pushed a commit to rwgk/pybind11 that referenced this pull request Nov 1, 2022
…similar to pybind#4306, the only difference between the two PRs is the `"spawn"` vs `"forkserver"` argument).
rwgk pushed a commit to rwgk/pybind11 that referenced this pull request Nov 23, 2022
rwgk pushed a commit that referenced this pull request Nov 23, 2022
* Use `multiprocessing` `start_method` `"forkserver"`

Alternative to PR #4305

* Add link to comment under PR #4105

* Unconditionally `pytest.skip("DEADLOCK")` for PyPy Windows

* Remove `SKIP_IF_DEADLOCK` entirely, for simplicity. Hopefully this PR will resolve the deadlocks for good.

* Add "In a nutshell" comment, in response to request by @EricCousineau-TRI
@rwgk
Copy link
Collaborator Author

rwgk commented Nov 23, 2022

This PR was made obsolete by #4306.

@rwgk rwgk closed this Nov 23, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant