-
-
Notifications
You must be signed in to change notification settings - Fork 11.1k
Closed
Labels
00 - Bug39 - free-threadingPRs and issues related to support for free-threading CPython (a.k.a. no-GIL, PEP 703)PRs and issues related to support for free-threading CPython (a.k.a. no-GIL, PEP 703)
Description
Describe the issue:
There is time of check to time of use race in from_dlpack method seen under free-threading in JAX CI 3.14 FT TSAN:
numpy/numpy/_core/src/multiarray/dlpack.c
Lines 512 to 513 in 99e52b1
if (call_kwnames == NULL) { | |
call_kwnames = Py_BuildValue("(sss)", "dl_device", "copy", "max_version"); |
TSAN report:
2025-05-01T05:34:57.9237309Z WARNING: ThreadSanitizer: data race (pid=40474)
2025-05-01T05:34:57.9237908Z Read of size 8 at 0x7ae1f630d900 by thread T5 (mutexes: read M0):
2025-05-01T05:34:57.9239389Z #0 from_dlpack /__w/jax/jax/numpy/.mesonpy-rfh9ohv3/../numpy/_core/src/multiarray/dlpack.c:512:9 (_multiarray_umath.cpython-314t-x86_64-linux-gnu.so+0x27bb77) (BuildId: 7329d207c0ff1ee77c70b97b156153450b873370)
2025-05-01T05:34:57.9241678Z #1 cfunction_vectorcall_FASTCALL_KEYWORDS /__w/jax/jax/cpython/Objects/methodobject.c:470:24 (python3.14+0x29bf58) (BuildId: 3f23fd04b2cf761640aff608738700b3591be0b6)
2025-05-01T05:34:57.9243471Z #2 _PyObject_VectorcallTstate /__w/jax/jax/cpython/./Include/internal/pycore_call.h:169:11 (python3.14+0x1f19ba) (BuildId: 3f23fd04b2cf761640aff608738700b3591be0b6)
2025-05-01T05:34:57.9244791Z #3 PyObject_Vectorcall /__w/jax/jax/cpython/Objects/call.c:327:12 (python3.14+0x1f19ba)
2025-05-01T05:34:57.9246353Z #4 _PyEval_EvalFrameDefault /__w/jax/jax/cpython/Python/generated_cases.c.h:1451:35 (python3.14+0x3fdb5c) (BuildId: 3f23fd04b2cf761640aff608738700b3591be0b6)
2025-05-01T05:34:57.9248016Z #5 _PyEval_EvalFrame /__w/jax/jax/cpython/./Include/internal/pycore_ceval.h:119:16 (python3.14+0x3f9470) (BuildId: 3f23fd04b2cf761640aff608738700b3591be0b6)
2025-05-01T05:34:57.9249250Z #6 _PyEval_Vector /__w/jax/jax/cpython/Python/ceval.c:1953:12 (python3.14+0x3f9470)
...
2025-05-01T05:34:57.9485539Z Previous write of size 8 at 0x7ae1f630d900 by thread T7 (mutexes: read M0):
2025-05-01T05:34:57.9487981Z #0 from_dlpack /__w/jax/jax/numpy/.mesonpy-rfh9ohv3/../numpy/_core/src/multiarray/dlpack.c:513:22 (_multiarray_umath.cpython-314t-x86_64-linux-gnu.so+0x27bbb6) (BuildId: 7329d207c0ff1ee77c70b97b156153450b873370)
2025-05-01T05:34:57.9489981Z #1 cfunction_vectorcall_FASTCALL_KEYWORDS /__w/jax/jax/cpython/Objects/methodobject.c:470:24 (python3.14+0x29bf58) (BuildId: 3f23fd04b2cf761640aff608738700b3591be0b6)
2025-05-01T05:34:57.9492133Z #2 _PyObject_VectorcallTstate /__w/jax/jax/cpython/./Include/internal/pycore_call.h:169:11 (python3.14+0x1f19ba) (BuildId: 3f23fd04b2cf761640aff608738700b3591be0b6)
2025-05-01T05:34:57.9493472Z #3 PyObject_Vectorcall /__w/jax/jax/cpython/Objects/call.c:327:12 (python3.14+0x1f19ba)
Full report: https://gist.github.com/vfdev-5/61f2a64f103319c0b5d2f850ceee8dcf
Reproduce the code example:
No reproducer yet
Error message:
Full report: https://gist.github.com/vfdev-5/61f2a64f103319c0b5d2f850ceee8dcf
Python and NumPy Versions:
Python 3.14.0a7+ experimental free-threading build (heads/main:4f18916, Apr 27 2025, 05:25:00) [Clang 18.1.3 (1ubuntu1)]
Numpy from source
Runtime Environment:
No response
Context for the issue:
No response
Metadata
Metadata
Assignees
Labels
00 - Bug39 - free-threadingPRs and issues related to support for free-threading CPython (a.k.a. no-GIL, PEP 703)PRs and issues related to support for free-threading CPython (a.k.a. no-GIL, PEP 703)