[issue30395] deadlocked child process after forking on pystate.c's head_mutex

2017-06-09 Thread Łukasz Langa
Łukasz Langa added the comment: If you'd like to fix the miniscule leak this introduces, feel free but I don't think it's worth the additional complexity. Closing this for now as it solved an issue for us internally and we haven't observed any memory-related issues due to it. -- resol

[issue30395] deadlocked child process after forking on pystate.c's head_mutex

2017-05-24 Thread Gregory P. Smith
Gregory P. Smith added the comment: Another alternative *might* be to check if the lock is locked (non-blocking acquire?) and release it if so. Under the normal assumption that we are the only thread running immediately post-fork(). I'm not sure that can be guaranteed reliable given that other

[issue30395] deadlocked child process after forking on pystate.c's head_mutex

2017-05-24 Thread STINNER Victor
STINNER Victor added the comment: Gregory P. Smith added the comment: Would PyThread_free_lock (effectively sem_destroy()) work without (additional) problems? If I recall correctly, no, you can get issues if the lock is still acquired... But I should check. --

[issue30395] deadlocked child process after forking on pystate.c's head_mutex

2017-05-23 Thread Gregory P. Smith
Gregory P. Smith added the comment: Would PyThread_free_lock (effectively sem_destroy()) work without (additional) problems? -- ___ Python tracker ___ __

[issue30395] deadlocked child process after forking on pystate.c's head_mutex

2017-05-23 Thread STINNER Victor
STINNER Victor added the comment: + head_mutex = NULL; Shouldn't we free memory here? -- ___ Python tracker ___ ___ Python-bugs-list

[issue30395] deadlocked child process after forking on pystate.c's head_mutex

2017-05-23 Thread Louis Brandy
Louis Brandy added the comment: Thanks to everyone jumping in. I need no convincing that mixing forks and threads isn't just a problem but a problem factory. Given that the rest of this code seems to try to avoid similar deadlocks with similar mutexes, I figured we'd want to include this mutex

[issue30395] deadlocked child process after forking on pystate.c's head_mutex

2017-05-22 Thread Łukasz Langa
Łukasz Langa added the comment: New changeset d29feccec3ce3dcd9ab3100f8956171c70ec3027 by Łukasz Langa in branch '3.6': [3.6] bpo-30395 _PyGILState_Reinit deadlock fix (GH-1734) (#1740) https://github.com/python/cpython/commit/d29feccec3ce3dcd9ab3100f8956171c70ec3027 -- _

[issue30395] deadlocked child process after forking on pystate.c's head_mutex

2017-05-22 Thread Łukasz Langa
Changes by Łukasz Langa : -- pull_requests: +1830 ___ Python tracker ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.

[issue30395] deadlocked child process after forking on pystate.c's head_mutex

2017-05-22 Thread Łukasz Langa
Łukasz Langa added the comment: New changeset f82c951d1c5416f3550d544e50ff5662d3836e73 by Łukasz Langa (Jason Fried) in branch 'master': bpo-30395 _PyGILState_Reinit deadlock fix (#1734) https://github.com/python/cpython/commit/f82c951d1c5416f3550d544e50ff5662d3836e73 -- nosy: +lukasz

[issue30395] deadlocked child process after forking on pystate.c's head_mutex

2017-05-22 Thread Jason Fried
Changes by Jason Fried : -- pull_requests: +1825 ___ Python tracker ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.p

[issue30395] deadlocked child process after forking on pystate.c's head_mutex

2017-05-22 Thread Gregory P. Smith
Gregory P. Smith added the comment: You cannot safely use Python's os.fork() in a process that has threads. Because of POSIX. The CPython interpreter is by definition not async signal safe so no Python code may safely be executed after the fork() system call if the process contained _any_ th

[issue30395] deadlocked child process after forking on pystate.c's head_mutex

2017-05-22 Thread Cooper Lees
Changes by Cooper Lees : -- nosy: +cooperlees ___ Python tracker ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.pyth

[issue30395] deadlocked child process after forking on pystate.c's head_mutex

2017-05-18 Thread Piotr Wysocki
Changes by Piotr Wysocki : -- nosy: +Piotr Wysocki ___ Python tracker ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail

[issue30395] deadlocked child process after forking on pystate.c's head_mutex

2017-05-18 Thread Stephan Gorget
Changes by Stephan Gorget : -- nosy: +phantez ___ Python tracker ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.pyth

[issue30395] deadlocked child process after forking on pystate.c's head_mutex

2017-05-17 Thread David Rothera
Changes by David Rothera : -- nosy: +David Rothera ___ Python tracker ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail

[issue30395] deadlocked child process after forking on pystate.c's head_mutex

2017-05-17 Thread Pádraig Brady
Changes by Pádraig Brady : -- nosy: +pixelbeat ___ Python tracker ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.pyt

[issue30395] deadlocked child process after forking on pystate.c's head_mutex

2017-05-17 Thread STINNER Victor
Changes by STINNER Victor : -- nosy: +haypo ___ Python tracker ___ ___ Python-bugs-list mailing list Unsubscribe: https://mail.python

[issue30395] deadlocked child process after forking on pystate.c's head_mutex

2017-05-17 Thread Louis Brandy
New submission from Louis Brandy: A forked process (via os.fork) can inherit a locked `head_mutex` from its parent process and will promptly deadlock in this stack (on my linux box): Child Process (deadlocked): #0 0x7f1a4da82e3c in futex_abstimed_wait_cancelable (private=0, abstime=0x0,