-
-
Notifications
You must be signed in to change notification settings - Fork 31.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
TSAN data race in _PyErr_Restore #131401
Comments
I think this needs a bit more investigation before reaching a conclusion. What test case is this running? What's the Python code? If possible, it'd be helpful to extract some Python code that reproduces the race. I'm concerned that some of these reported races are a symptom of some other bug. For example, the recent asyncio bug with |
I'll try to find the test case which causes this rare data race.
I agree, but I think this case is different, |
Minimal reproducer: from threading import Thread
exc = Exception("foo")
def exc_tb():
while True:
exc.__traceback__
def exc_raise():
raise exc
def exc_catch():
while True:
try:
exc_raise()
except Exception as e:
pass
def main():
t1 = Thread(target=exc_tb)
t1.start()
t2 = Thread(target=exc_catch)
t2.start()
t1.join()
if __name__ == "__main__":
main()
|
Here is what I've seen so far: The data race occurs in cpython/Lib/test/test_asyncio/test_tasks.py Lines 3586 to 3612 in f819900
The Python Stack Trace
Main thread unwinds to:Lines 96 to 114 in f819900
The error is then raised again in the executor thread in cpython/Lib/concurrent/futures/_base.py Lines 392 to 400 in f819900
|
When running asyncio tests with forever mode, the following race is detected:
The fix here is to set the traceback of the exception while holding the critical section so it should use
PyException_SetTraceback
API.Linked PRs
_PyErr_Restore
#131406The text was updated successfully, but these errors were encountered: