Uh oh!
There was an error while loading. Please reload this page.
gh-127081: lock non-re-entrant *pwent calls - #132748
Conversation
The libc setpwent, getpwent, and endpwent functions are not thread-safe. Protect them with mutexs in free-threading builds.
*pwent calls
ZeroIntensity
left a comment
There was a problem hiding this comment.
We need a critical section here. Py_CLEAR and Py_DECREF are re-entrant (as in, they can invoke the eval loop), so a mutex is prone to lock-ordering or re-entrancy deadlocks.
ZeroIntensity
commented
Apr 20, 2025
Actually, sorry, we need to fix subinterpreter thread-safety here too. We can't do that with a critical section. Could you adjust the mutex to go over solely the libc calls? |
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
duaneg
commented
Apr 20, 2025
Hmm, yeah, good point. I guess we can just defer the decrefs until exit. |
…ility of re-entrancy.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
… they are strongly referenced by that, so we can dec-ref them safely.
Uh oh!
There was an error while loading. Please reload this page.
The libc setpwent, getpwent, and endpwent functions are not thread-safe. Protect them with mutexs in free-threading builds.