Skip to content

git-review-rebase: use fork method when starting multiprocessing manager#25

Open
casasnovas wants to merge 1 commit into
mainfrom
quentin-fix-python-3.14
Open

git-review-rebase: use fork method when starting multiprocessing manager#25
casasnovas wants to merge 1 commit into
mainfrom
quentin-fix-python-3.14

Conversation

@casasnovas
Copy link
Copy Markdown
Collaborator

@casasnovas casasnovas commented May 12, 2026

Yann ran into an issue where the python 3.14 multiprocessing Manager seems to refuse to start with a rather cryptic:

ValueError: bad value(s) in fds_to_keep

Claude thinks this is because on python-3.14 the default method for manager is "forkserver", which doesn't work in the context of an asyncio.thread. The fix is to explicitly request the use of the "fork" method.

Reported-by: Yann Sionneau yann.sionneau@vates.tech

@casasnovas casasnovas requested a review from a team as a code owner May 12, 2026 09:49
@casasnovas casasnovas requested a review from fallen May 12, 2026 09:49
…ger.

Yann ran into an issue where the python 3.14 multiprocessing Manager seems
to refuse to start with a rather cryptic:

 ValueError: bad value(s) in fds_to_keep

Claude thinks this is because on python-3.14 the default method for manager
is "forkserver", which doesn't work in the context of an asyncio.thread.  A
potential fix is to explicitly request the use of the "fork" method.

Reported-by: Yann Sionneau <yann.sionneau@vates.tech>
Signed-off-by: Quentin Casasnovas <quentin.casasnovas@vates.tech>
@casasnovas casasnovas force-pushed the quentin-fix-python-3.14 branch from 36d737c to 98bd169 Compare May 12, 2026 09:50
with multiprocessing.Manager() as manager:
# Use 'fork' explicitly: forkserver (Python 3.14+ default) fails with -1 fds
# when Manager() is called from within asyncio.to_thread().
ctx = multiprocessing.get_context("fork")
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I can only say that documentation seems to warn a bit on using context "fork" in a multi threaded code

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

Copy link
Copy Markdown
Member

@dinhngtu dinhngtu left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I had the same issue and it was fixed by this PR as well.

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.

3 participants