◐ Shell
clean mode source ↗

Use try_lock in py_os_after_fork_child by youknowone · Pull Request #7178 · RustPython/RustPython

coderabbitai[bot]

after_forkers_child.lock() can deadlock in the forked child
if another thread held the mutex at the time of fork.
Use try_lock and skip at-fork callbacks when the lock is
unavailable, matching the pattern used in after_fork_child
for thread_handles.

This was referenced

Feb 19, 2026

This was referenced

Mar 2, 2026

youknowone added a commit to youknowone/RustPython that referenced this pull request

Mar 22, 2026
after_forkers_child.lock() can deadlock in the forked child
if another thread held the mutex at the time of fork.
Use try_lock and skip at-fork callbacks when the lock is
unavailable, matching the pattern used in after_fork_child
for thread_handles.