You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Currently in Python it's only possible to change your signal disposition on a thread-specific basis using signal.pthread_sigmask. When a test depends on certain signals being blocked but we use the thread method for pytest-timeout, the signal is still received by the process via the internal thread maintained by pytest-timeout and it is then propagated to the main thread by the Python runtime.
The fix is to surround the thread start with something like
This works because the signal mask is inherited by spawned threads, and also avoids a potential race condition if we were to set the signal mask inside the thread target function itself.
Currently I work around this issue by patching threading.Thread.start to do the same as above.
The text was updated successfully, but these errors were encountered:
Original report by Christopher Hunt (Bitbucket: chrahunt, GitHub: chrahunt).
Currently in Python it's only possible to change your signal disposition on a thread-specific basis using
signal.pthread_sigmask
. When a test depends on certain signals being blocked but we use the thread method for pytest-timeout, the signal is still received by the process via the internal thread maintained by pytest-timeout and it is then propagated to the main thread by the Python runtime.The fix is to surround the thread start with something like
This works because the signal mask is inherited by spawned threads, and also avoids a potential race condition if we were to set the signal mask inside the thread target function itself.
Currently I work around this issue by patching
threading.Thread.start
to do the same as above.The text was updated successfully, but these errors were encountered: