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
The sock_fd member in PySocketSockObject can be mutated while the socket is being used, for example when calling socket.close or socket.detach. However, some other threads can access that member without holding the GIL, and without using atomic instructions. This can trip up Thread Sanitizer in test_asyncio, for example:
0:00:31 load avg: 3.29 [15/52/1] test_asyncio.test_sock_lowlevel worker non-zero exit code (Exit code 66)
==================
WARNING: ThreadSanitizer: data race (pid=7227)
Write of size 4 at 0x7fd903611570 by thread T19:
#0 sock_close /home/runner/work/cpython/cpython/./Modules/socketmodule.c:3339:20 (_socket.cpython-313d-x86_64-linux-gnu.so+0xdbde) (BuildId: 7a12da96172d453cd023792c027755908db49f4e)
[...]
Previous read of size 4 at 0x7fd903611570 by main thread:
#0 sock_sendto_impl /home/runner/work/cpython/cpython/./Modules/socketmodule.c:4474:29 (_socket.cpython-313d-x86_64-linux-gnu.so+0x131e5) (BuildId: 7a12da96172d453cd023792c027755908db49f4e)
#1 sock_call_ex /home/runner/work/cpython/cpython/./Modules/socketmodule.c:968:19 (_socket.cpython-313d-x86_64-linux-gnu.so+0x10fa1) (BuildId: 7a12da96172d453cd023792c027755908db49f4e)
#2 sock_call /home/runner/work/cpython/cpython/./Modules/socketmodule.c:1020:12 (_socket.cpython-313d-x86_64-linux-gnu.so+0xf1a1) (BuildId: 7a12da96172d453cd023792c027755908db49f4e)
#3 sock_sendto /home/runner/work/cpython/cpython/./Modules/socketmodule.c:4532:9 (_socket.cpython-313d-x86_64-linux-gnu.so+0xf1a1)
[...]
Activity
[-]TSan: data race access socket fd[/-][+]TSan: data race accessing socket fd[/+]pitrou commentedon Mar 16, 2024
@colesbury @gpshead @mpage @erlend-aasland
corona10 commentedon Oct 3, 2024
It happens from https://github.com/python/cpython/actions/runs/11160718143/job/31021782828?pr=124914 too
Maybe worth to fix it.
corona10 commentedon Oct 3, 2024
kumaraditya303 commentedon Jan 1, 2025
Superseded by #128277