Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

gh-88110: clear concurrent.futures.thread._threads_queues after fork to avoid joining parent process' threads#126098

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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Merged
serhiy-storchaka merged 11 commits intopython:mainfromDrino:bug88110_tests
Nov 22, 2024

Conversation

@Drino
Copy link
Contributor

@DrinoDrino commentedOct 29, 2024
edited by bedevere-appbot
Loading

I've added a test to marmarek@ PR:#101940

_threads_queues are copied as-is into the fork memory, but there are no threads in the child process, so child process crashes when callingt.join() in_python_exit.

I'm facing this issue for the second time during last two years, so I hope it can be fixed :)

marmarekand others added4 commitsOctober 29, 2024 02:10
… forkThreads are gone after fork, so clear the queues too. Otherwise thechild process (here created via multiprocessing.Process) crashes oninterpreter exit with:    Traceback (most recent call last):      File "/usr/lib64/python3.11/multiprocessing/popen_fork.py", line 72, in _launch        code = process_obj._bootstrap(parent_sentinel=child_r)               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^      File "/usr/lib64/python3.11/multiprocessing/process.py", line 332, in _bootstrap        threading._shutdown()      File "/usr/lib64/python3.11/threading.py", line 1561, in _shutdown        atexit_call()      File "/usr/lib64/python3.11/concurrent/futures/thread.py", line 31, in _python_exit        t.join()      File "/usr/lib64/python3.11/threading.py", line 1109, in join        raise RuntimeError("cannot join current thread")    RuntimeError: cannot join current threadFixespython#88110
@ghost
Copy link

ghost commentedOct 29, 2024
edited by ghost
Loading

All commit authors signed the Contributor License Agreement.
CLA signed

Co-authored-by: RUANG (James Roy) <longjinyii@outlook.com>
@Drino
Copy link
ContributorAuthor

Drino commentedNov 2, 2024
edited
Loading

Friendly ping for this review,@rruuaanng

Hopefully this one line of code can make it to main :)

@DrinoDrino changed the titlegh-88110: clear concurrent.futures.thread._threads_queues after forkgh-88110: clean concurrent.futures.thread._threads_queues after fork to avoid joining parent process' threadsNov 10, 2024
@DrinoDrino changed the titlegh-88110: clean concurrent.futures.thread._threads_queues after fork to avoid joining parent process' threadsgh-88110: clear concurrent.futures.thread._threads_queues after fork to avoid joining parent process' threadsNov 10, 2024
@ZeroIntensity
Copy link
Member

cc@serhiy-storchaka

Copy link
Member

@serhiy-storchakaserhiy-storchaka left a comment

Choose a reason for hiding this comment

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

Please silence the deprecation warning:

test_process_fork_from_a_threadpool (test.test_concurrent_futures.test_thread_pool.ThreadPoolExecutorTest.test_process_fork_from_a_threadpool) ... /home/serhiy/py/cpython-tmp/Lib/multiprocessing/popen_fork.py:67: DeprecationWarning: This process (pid=1243139) is multi-threaded, use of fork() may lead to deadlocks in the child.  self.pid = os.fork()0.00s ok

Copy link
Member

@serhiy-storchakaserhiy-storchaka left a comment

Choose a reason for hiding this comment

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

The test is failing.

Colonel Mustard did it in the Library with the Lead Pipe.
@gpsheadgpshead added needs backport to 3.12only security fixes needs backport to 3.13bugs and security fixes 🔨 test-with-buildbotsTest PR w/ buildbots; report in status section labelsNov 20, 2024
@bedevere-bot
Copy link

🤖 New build scheduled with the buildbot fleet by@gpshead for commitb8d3f31 🤖

If you want to schedule another build, you need to add the🔨 test-with-buildbots label again.

@gpsheadgpshead self-assigned thisNov 20, 2024
@bedevere-botbedevere-bot removed the 🔨 test-with-buildbotsTest PR w/ buildbots; report in status section labelNov 20, 2024
@serhiy-storchakaserhiy-storchaka merged commit1848ce6 intopython:mainNov 22, 2024
36 checks passed
@miss-islington-app
Copy link

Thanks@Drino for the PR, and@serhiy-storchaka for merging it 🌮🎉.. I'm working now to backport this PR to: 3.12, 3.13.
🐍🍒⛏🤖

miss-islington pushed a commit to miss-islington/cpython that referenced this pull requestNov 22, 2024
… fork to avoid joining parent process' threads (pythonGH-126098)Threads are gone after fork, so clear the queues too. Otherwise thechild process (here created via multiprocessing.Process) crashes oninterpreter exit.(cherry picked from commit1848ce6)Co-authored-by: Andrei Bodrov <Drino@users.noreply.github.com>Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
@bedevere-app
Copy link

GH-127163 is a backport of this pull request to the3.13 branch.

@bedevere-appbedevere-appbot removed the needs backport to 3.13bugs and security fixes labelNov 22, 2024
miss-islington pushed a commit to miss-islington/cpython that referenced this pull requestNov 22, 2024
… fork to avoid joining parent process' threads (pythonGH-126098)Threads are gone after fork, so clear the queues too. Otherwise thechild process (here created via multiprocessing.Process) crashes oninterpreter exit.(cherry picked from commit1848ce6)Co-authored-by: Andrei Bodrov <Drino@users.noreply.github.com>Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
@bedevere-app
Copy link

GH-127164 is a backport of this pull request to the3.12 branch.

@bedevere-appbedevere-appbot removed the needs backport to 3.12only security fixes labelNov 22, 2024
serhiy-storchaka added a commit that referenced this pull requestNov 22, 2024
…r fork to avoid joining parent process' threads (GH-126098) (GH-127163)Threads are gone after fork, so clear the queues too. Otherwise thechild process (here created via multiprocessing.Process) crashes oninterpreter exit.(cherry picked from commit1848ce6)Co-authored-by: Andrei Bodrov <Drino@users.noreply.github.com>Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
@DrinoDrino deleted the bug88110_tests branchNovember 24, 2024 21:32
serhiy-storchaka added a commit that referenced this pull requestNov 30, 2024
…r fork to avoid joining parent process' threads (GH-126098) (GH-127164)Threads are gone after fork, so clear the queues too. Otherwise thechild process (here created via multiprocessing.Process) crashes oninterpreter exit.(cherry picked from commit1848ce6)Co-authored-by: Andrei Bodrov <Drino@users.noreply.github.com>Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
ebonnal pushed a commit to ebonnal/cpython that referenced this pull requestJan 12, 2025
… fork to avoid joining parent process' threads (pythonGH-126098)Threads are gone after fork, so clear the queues too. Otherwise thechild process (here created via multiprocessing.Process) crashes oninterpreter exit.Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment

Reviewers

@serhiy-storchakaserhiy-storchakaserhiy-storchaka left review comments

@gpsheadgpsheadAwaiting requested review from gpshead

+1 more reviewer

@rruuaanngrruuaanngrruuaanng left review comments

Reviewers whose approvals may not affect merge requirements

Assignees

@gpsheadgpshead

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

7 participants

@Drino@ZeroIntensity@bedevere-bot@serhiy-storchaka@rruuaanng@gpshead@marmarek

[8]ページ先頭

©2009-2025 Movatter.jp