Skip to content

test_concurrent_futures TSAN failures #130605

Closed
@colesbury

Description

@colesbury

Bug report

I enabled test_concurrent_futures in the thread sanitizer job yesterday in:

Unfortunately, this is causing fairly frequent failures in the TSAN job, especially for the default (GIL-enabled) build, which I hadn't tested sufficiently with TSAN.

I'll temporarily remove test_concurrent_futures while I work on fixing the races.

Races

take_gil and _PyEval_SetSwitchInterval

WARNING: ThreadSanitizer: data race (pid=9777)
  Read of size 8 at 0x55e09fe6ae08 by thread T24 (mutexes: write M0):
    #0 take_gil /home/runner/work/cpython/cpython/Python/ceval_gil.c:328:40 (python+0x4fef47) (BuildId: bc0ef96fe091f729b109ca39e0975c49764059f7)
    #1 _PyEval_AcquireLock /home/runner/work/cpython/cpython/Python/ceval_gil.c:586:5 (python+0x4ff62e) (BuildId: bc0ef96fe091f729b109ca39e0975c49764059f7)
    #2 _PyThreadState_Attach /home/runner/work/cpython/cpython/Python/pystate.c:2092:9 (python+0x571225) (BuildId: bc0ef96fe091f729b109ca39e0975c49764059f7)
    #3 PyEval_AcquireThread /home/runner/work/cpython/cpython/Python/ceval_gil.c:603:5 (python+0x4ff6fe) (BuildId: bc0ef96fe091f729b109ca39e0975c49764059f7)
...

Previous write of size 8 at 0x55e09fe6ae08 by main thread:
    #0 _PyEval_SetSwitchInterval /home/runner/work/cpython/cpython/Python/ceval_gil.c:423:19 (python+0x4fe71a) (BuildId: bc0ef96fe091f729b109ca39e0975c49764059f7)
    #1 sys_setswitchinterval_impl /home/runner/work/cpython/cpython/./Python/sysmodule.c:1313:5 (python+0x598ae8) (BuildId: bc0ef96fe091f729b109ca[39](https://github.com/python/cpython/actions/runs/13552992546/job/37880869299?pr=130602#step:14:40)e0975c49764059f7)
    #2 sys_setswitchinterval /home/runner/work/cpython/cpython/./Python/clinic/sysmodule.c.h:529:20 (python+0x598ae8)
    #3 cfunction_vectorcall_O /home/runner/work/cpython/cpython/Objects/methodobject.c:523:24 (python+0x2eb8bd) (BuildId: bc0ef96fe091f729b109ca39e0975c4976[40](https://github.com/python/cpython/actions/runs/13552992546/job/37880869299?pr=130602#step:14:41)59f7)
...

SUMMARY: ThreadSanitizer: data race /home/runner/work/cpython/cpython/Python/ceval_gil.c:328:40 in take_gil

Linked PRs

Metadata

Metadata

Assignees

No one assigned

    Labels

    buildThe build process and cross-buildtestsTests in the Lib/test dirtype-bugAn unexpected behavior, bug, or error

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions