Repository navigation
test_free_threading.test_dict on TSAN/free-threading is flaky #130519
Description
Activity
- addedinterpreter-core(Objects, Python, Grammar, and Parser dirs)(Objects, Python, Grammar, and Parser dirs)testsTests in the Lib/test dirTests in the Lib/test dirtype-bugAn unexpected behavior, bug, or errorAn unexpected behavior, bug, or error
on Feb 24, 2025 I'm a bit stuck with my last PR. Do you want me to look into this?
You can investigate if you want but maybe free-threading experts have an idea of why it fails.
cc @ZeroIntensity maybe you've encountered this beforehand?
Reacted by Sergey MiryanovI haven't seen it. I think there's a thread somewhere where you're supposed to report flaky TSan failures.
This is a good place to report it, thanks.
I think the problem is that
free_work_itemcan be re-entrant because it callsPy_DECREF(). Originally, the QSBR code just made calls toPyMem_Free()orPyObject_Free(), which are never re-entrant. In:We extended it to also executing
Py_DECREF()on objects, which can execute arbitrary code via destructors, including re-entering QSBR (possibly during a GC).This invalidates some assumptions. For example, the head of the work queue can change during a call to
free_work_item:Lines 1258 to 1268 in c5f925c
struct _mem_work_chunk *buf = work_queue_first(head); while (buf->rd_idx < buf->wr_idx) { struct _mem_work_item *item = &buf->array[buf->rd_idx]; if (!_Py_qsbr_poll(qsbr, item->qsbr_goal)) { return; } free_work_item(item->ptr, cb, state); buf->rd_idx++; } cc @DinoV
- added 4 commits that reference this issue
on Feb 25, 2025 This should be fixed now.
Reacted by Bénédikt Tran and Peter Bierma
Bug report
Bug description:
We have:
I'm not sure if it's a real bug or not. Victor suggested me to open an issue for this one. Maybe there's already one that exists though.
See https://github.com/python/cpython/actions/runs/13225352402/job/36915529351?pr=129175#step:12:44 for the log (hopefully it will stay).
CPython versions tested on:
CPython main branch
Operating systems tested on:
No response
Linked PRs