This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

classification
Title: PyOS_AfterFork_Child() should use _PyThread_at_fork_reinit()
Type: enhancement Stage: resolved
Components: Interpreter Core Versions: Python 3.9
process
Status: closed Resolution: fixed
Dependencies: Superseder:
Assigned To: Nosy List: corona10, vstinner
Priority: normal Keywords: patch

Created on 2020-04-08 21:43 by vstinner, last changed 2022-04-11 14:59 by admin. This issue is now closed.

Pull Requests
URL Status Linked Edit
PR 19450 merged corona10, 2020-04-09 16:59
PR 20597 merged vstinner, 2020-06-02 13:54
Messages (5)
msg366015 - (view) Author: STINNER Victor (vstinner) * (Python committer) Date: 2020-04-08 21:43
In bpo-40089, I added _PyThread_at_fork_reinit() function to reinitialize a lock after a lock. PyOS_AfterFork_Child() should use it rather than creating new locks. For example, currently _PyEval_ReInitThreads() calls:

    pending->lock = PyThread_allocate_lock();
msg366074 - (view) Author: Dong-hee Na (corona10) * (Python committer) Date: 2020-04-09 15:54
I am going to take a look at this issue.
msg366396 - (view) Author: Dong-hee Na (corona10) * (Python committer) Date: 2020-04-14 16:16
New changeset 62f75fe3dd138f72303814d27183aa469eefcca6 by Dong-hee Na in branch 'master':
bpo-40232: Update PyOS_AfterFork_Child() to use _PyThread_at_fork_reinit() (GH-19450)
https://github.com/python/cpython/commit/62f75fe3dd138f72303814d27183aa469eefcca6
msg366397 - (view) Author: Dong-hee Na (corona10) * (Python committer) Date: 2020-04-14 16:18
This issue is now solved.

Thanks, Victor for the suggestion! :)
msg370610 - (view) Author: STINNER Victor (vstinner) * (Python committer) Date: 2020-06-02 15:14
New changeset 45b34a04a577aa49fa4825421758c3e8eaa1625d by Victor Stinner in branch 'master':
bpo-40232: _PyImport_ReInitLock() can now safely use its lock (GH-20597)
https://github.com/python/cpython/commit/45b34a04a577aa49fa4825421758c3e8eaa1625d
History
Date User Action Args
2022-04-11 14:59:29adminsetgithub: 84413
2020-06-02 15:14:00vstinnersetmessages: + msg370610
2020-06-02 13:54:03vstinnersetpull_requests: + pull_request19826
2020-04-14 16:18:12corona10setstatus: open -> closed
type: enhancement
messages: + msg366397

resolution: fixed
stage: patch review -> resolved
2020-04-14 16:16:27corona10setmessages: + msg366396
2020-04-09 16:59:11corona10setkeywords: + patch
stage: patch review
pull_requests: + pull_request18805
2020-04-09 15:54:37corona10setmessages: + msg366074
2020-04-09 15:34:32corona10setnosy: + corona10
2020-04-08 21:43:23vstinnercreate