Uh oh!
There was an error while loading.Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork33.7k
Closed
Description
Bug report
Bug description:
I built cpython 3.13 from source with TSAN and running the following code:
importsysimportconcurrent.futuresimportthreadingif__name__=="__main__":num_workers=20num_runs=100barrier=threading.Barrier(num_workers)tool_id=3event_id=sys.monitoring.events.CALLsys.monitoring.use_tool_id(tool_id,"test_tool_1")sys.monitoring.set_events(tool_id,event_id)defclosure():barrier.wait()defmy_callback(code,instruction_offset,callable,arg0):passsys.monitoring.register_callback(tool_id,event_id,my_callback)defexample_function():a=1b=2c=a+bfor_inrange(num_runs):example_function()withconcurrent.futures.ThreadPoolExecutor(max_workers=num_workers)asexecutor:futures= []foriinrange(num_workers):futures.append(executor.submit(closure))assertlen(list(f.result()forfinfutures))==num_workers
TSAN reports the following data race:https://gist.github.com/vfdev-5/e80f9b4528993eb1543e45a9216350e3#file-repro-log
cpython version:
Python 3.13.2+ experimental free-threading build (heads/3.13:9e0fce413a9, Mar 12 2025, 00:48:15) [Clang 18.1.3 (1ubuntu1)]CPython versions tested on:
3.13
Operating systems tested on:
Linux