Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

gh-117657: Fix some simple races in instrumentation.c #120118

Merged
merged 3 commits into from
Jun 13, 2024

Conversation

Fidget-Spinner
Copy link
Member

@Fidget-Spinner Fidget-Spinner commented Jun 5, 2024

The other more egregious races are a little trickier.

Also not sure why this only turns up in gcc's tsan but seemingly not in clang's tsan. This turns up in clang-18 TSAN (see below).

@colesbury
Copy link
Contributor

I think these should only be called in contexts in which no other thread is currently executing the bytecode -- I don't think we should need atomic stores.

I'm a bit concerned that GCC TSan may report spurious warnings, so I've been sticking to clang-18 for local TSan runs to match the CI.

@colesbury
Copy link
Contributor

There was a crash in the 3.13 buildbot in test_instrumentation, so it looks like there are some races that need to be investigated:

#120158

@Fidget-Spinner Fidget-Spinner reopened this Jun 7, 2024
@Fidget-Spinner
Copy link
Member Author

Fidget-Spinner commented Jun 7, 2024

I get the same warnings about those 3 lines on TSAN as well with clang-18.

I think these should only be called in contexts in which no other thread is currently executing the bytecode -- I don't think we should need atomic stores.

I'm a bit concerned that GCC TSan may report spurious warnings, so I've been sticking to clang-18 for local TSan runs to match the CI.

ISTM we only stop the world in the global events set by _PyMonitoring_SetEvents, not in the local events _PyMonitoring_SetLocalEvents version.

Here's an example race by TSAN:

WARNING: ThreadSanitizer: data race (pid=39393)
  Write of size 1 at 0x7fffb43c8440 by main thread:
    #0 instrument_per_instruction /home/ken/Documents/GitHub/cpython/Python/instrumentation.c:749:17 (python+0x53b4d3) (BuildId: 39b4b6a9b674d30989aeda3269b50798d48eb57a)
    #1 add_per_instruction_tools /home/ken/Documents/GitHub/cpython/Python/instrumentation.c:864:5 (python+0x53b4d3)
    #2 force_instrument_lock_held /home/ken/Documents/GitHub/cpython/Python/instrumentation.c:1816:13 (python+0x53b4d3)
    #3 _PyMonitoring_SetLocalEvents /home/ken/Documents/GitHub/cpython/Python/instrumentation.c:1994:11 (python+0x538c6a) (BuildId: 39b4b6a9b674d30989aeda3269b50798d48eb57a)
    #4 _PyEval_SetOpcodeTrace /home/ken/Documents/GitHub/cpython/Python/legacy_tracing.c:153:12 (python+0x541f2d) (BuildId: 39b4b6a9b674d30989aeda3269b50798d48eb57a)
    #5 frame_settrace_opcodes /home/ken/Documents/GitHub/cpython/Objects/frameobject.c (python+0x2a2f53) (BuildId: 39b4b6a9b674d30989aeda3269b50798d48eb57a)
    #6 getset_set /home/ken/Documents/GitHub/cpython/Objects/descrobject.c:249:16 (python+0x26c494) (BuildId: 39b4b6a9b674d30989aeda3269b50798d48eb57a)
    #7 _PyObject_GenericSetAttrWithDict /home/ken/Documents/GitHub/cpython/Objects/object.c:1694:19 (python+0x317b9d) (BuildId: 39b4b6a9b674d30989aeda3269b50798d48eb57a)
    #8 PyObject_GenericSetAttr /home/ken/Documents/GitHub/cpython/Objects/object.c:1765:12 (python+0x317f4b) (BuildId: 39b4b6a9b674d30989aeda3269b50798d48eb57a)
    #9 PyObject_SetAttr /home/ken/Documents/GitHub/cpython/Objects/object.c:1331:15 (python+0x31649b) (BuildId: 39b4b6a9b674d30989aeda3269b50798d48eb57a)
    #10 _PyEval_EvalFrameDefault /home/ken/Documents/GitHub/cpython/Python/generated_cases.c.h:5506:27 (python+0x4a0acd) (BuildId: 39b4b6a9b674d30989aeda3269b50798d48eb57a)
    #11 _PyEval_EvalFrame /home/ken/Documents/GitHub/cpython/./Include/internal/pycore_ceval.h:119:16 (python+0x47f793) (BuildId: 39b4b6a9b674d30989aeda3269b50798d48eb57a)
    #12 _PyEval_Vector /home/ken/Documents/GitHub/cpython/Python/ceval.c:1819:12 (python+0x47f793)
    #13 _PyFunction_Vectorcall /home/ken/Documents/GitHub/cpython/Objects/call.c (python+0x2554bc) (BuildId: 39b4b6a9b674d30989aeda3269b50798d48eb57a)
    #14 _PyObject_VectorcallTstate /home/ken/Documents/GitHub/cpython/./Include/internal/pycore_call.h:168:11 (python+0x5b5095) (BuildId: 39b4b6a9b674d30989aeda3269b50798d48eb57a)
    #15 call_trampoline /home/ken/Documents/GitHub/cpython/./Python/sysmodule.c:1029:24 (python+0x5b878f) (BuildId: 39b4b6a9b674d30989aeda3269b50798d48eb57a)
    #16 trace_trampoline /home/ken/Documents/GitHub/cpython/./Python/sysmodule.c:1065:24 (python+0x5b878f)
    #17 _Py_call_instrumentation_line /home/ken/Documents/GitHub/cpython/Python/instrumentation.c:1285:27 (python+0x5368b1) (BuildId: 39b4b6a9b674d30989aeda3269b50798d48eb57a)
    #18 _PyEval_EvalFrameDefault /home/ken/Documents/GitHub/cpython/Python/ceval.c:814:31 (python+0x4a65b1) (BuildId: 39b4b6a9b674d30989aeda3269b50798d48eb57a)
    #19 _PyEval_EvalFrame /home/ken/Documents/GitHub/cpython/./Include/internal/pycore_ceval.h:119:16 (python+0x47f793) (BuildId: 39b4b6a9b674d30989aeda3269b50798d48eb57a)
    #20 _PyEval_Vector /home/ken/Documents/GitHub/cpython/Python/ceval.c:1819:12 (python+0x47f793)
    #21 _PyFunction_Vectorcall /home/ken/Documents/GitHub/cpython/Objects/call.c (python+0x2554bc) (BuildId: 39b4b6a9b674d30989aeda3269b50798d48eb57a)
    #22 _PyObject_VectorcallTstate /home/ken/Documents/GitHub/cpython/./Include/internal/pycore_call.h:168:11 (python+0x25b06b) (BuildId: 39b4b6a9b674d30989aeda3269b50798d48eb57a)
    #23 method_vectorcall /home/ken/Documents/GitHub/cpython/Objects/classobject.c:70:20 (python+0x2596d5) (BuildId: 39b4b6a9b674d30989aeda3269b50798d48eb57a)
    #24 _PyObject_VectorcallTstate /home/ken/Documents/GitHub/cpython/./Include/internal/pycore_call.h:168:11 (python+0x25358b) (BuildId: 39b4b6a9b674d30989aeda3269b50798d48eb57a)
    #25 PyObject_CallNoArgs /home/ken/Documents/GitHub/cpython/Objects/call.c:106:12 (python+0x2534bd) (BuildId: 39b4b6a9b674d30989aeda3269b50798d48eb57a)
    #26 _PyEval_EvalFrameDefault /home/ken/Documents/GitHub/cpython/Python/generated_cases.c.h:89:19 (python+0x48061b) (BuildId: 39b4b6a9b674d30989aeda3269b50798d48eb57a)
    #27 _PyEval_EvalFrame /home/ken/Documents/GitHub/cpython/./Include/internal/pycore_ceval.h:119:16 (python+0x47f793) (BuildId: 39b4b6a9b674d30989aeda3269b50798d48eb57a)
    #28 _PyEval_Vector /home/ken/Documents/GitHub/cpython/Python/ceval.c:1819:12 (python+0x47f793)
    #29 _PyFunction_Vectorcall /home/ken/Documents/GitHub/cpython/Objects/call.c (python+0x2554bc) (BuildId: 39b4b6a9b674d30989aeda3269b50798d48eb57a)
    #30 _PyObject_VectorcallTstate /home/ken/Documents/GitHub/cpython/./Include/internal/pycore_call.h:168:11 (python+0x25b06b) (BuildId: 39b4b6a9b674d30989aeda3269b50798d48eb57a)
    #31 method_vectorcall /home/ken/Documents/GitHub/cpython/Objects/classobject.c:92:18 (python+0x259742) (BuildId: 39b4b6a9b674d30989aeda3269b50798d48eb57a)
    #32 _PyVectorcall_Call /home/ken/Documents/GitHub/cpython/Objects/call.c:273:16 (python+0x254ea5) (BuildId: 39b4b6a9b674d30989aeda3269b50798d48eb57a)
    #33 _PyObject_Call /home/ken/Documents/GitHub/cpython/Objects/call.c:348:16 (python+0x2550bb) (BuildId: 39b4b6a9b674d30989aeda3269b50798d48eb57a)
    #34 PyObject_Call /home/ken/Documents/GitHub/cpython/Objects/call.c:373:12 (python+0x2552e7) (BuildId: 39b4b6a9b674d30989aeda3269b50798d48eb57a)
    #35 _PyEval_EvalFrameDefault /home/ken/Documents/GitHub/cpython/Python/generated_cases.c.h:1358:26 (python+0x488521) (BuildId: 39b4b6a9b674d30989aeda3269b50798d48eb57a)
    #36 _PyEval_EvalFrame /home/ken/Documents/GitHub/cpython/./Include/internal/pycore_ceval.h:119:16 (python+0x47f793) (BuildId: 39b4b6a9b674d30989aeda3269b50798d48eb57a)
    #37 _PyEval_Vector /home/ken/Documents/GitHub/cpython/Python/ceval.c:1819:12 (python+0x47f793)
    #38 _PyFunction_Vectorcall /home/ken/Documents/GitHub/cpython/Objects/call.c (python+0x2554bc) (BuildId: 39b4b6a9b674d30989aeda3269b50798d48eb57a)
    #39 _PyObject_VectorcallDictTstate /home/ken/Documents/GitHub/cpython/Objects/call.c:135:15 (python+0x2538bd) (BuildId: 39b4b6a9b674d30989aeda3269b50798d48eb57a)
    #40 _PyObject_Call_Prepend /home/ken/Documents/GitHub/cpython/Objects/call.c:504:24 (python+0x2558dd) (BuildId: 39b4b6a9b674d30989aeda3269b50798d48eb57a)
    #41 slot_tp_call /home/ken/Documents/GitHub/cpython/Objects/typeobject.c:9612:15 (python+0x385a2c) (BuildId: 39b4b6a9b674d30989aeda3269b50798d48eb57a)
    #42 _PyObject_MakeTpCall /home/ken/Documents/GitHub/cpython/Objects/call.c:242:18 (python+0x253d00) (BuildId: 39b4b6a9b674d30989aeda3269b50798d48eb57a)
    #43 _PyObject_VectorcallTstate /home/ken/Documents/GitHub/cpython/./Include/internal/pycore_call.h:166:16 (python+0x2535ed) (BuildId: 39b4b6a9b674d30989aeda3269b50798d48eb57a)
    #44 PyObject_Vectorcall /home/ken/Documents/GitHub/cpython/Objects/call.c:327:12 (python+0x254fa0) (BuildId: 39b4b6a9b674d30989aeda3269b50798d48eb57a)
    #45 _PyEval_EvalFrameDefault /home/ken/Documents/GitHub/cpython/Python/generated_cases.c.h:813:23 (python+0x4854f2) (BuildId: 39b4b6a9b674d30989aeda3269b50798d48eb57a)
    #46 _PyEval_EvalFrame /home/ken/Documents/GitHub/cpython/./Include/internal/pycore_ceval.h:119:16 (python+0x47f793) (BuildId: 39b4b6a9b674d30989aeda3269b50798d48eb57a)
    #47 _PyEval_Vector /home/ken/Documents/GitHub/cpython/Python/ceval.c:1819:12 (python+0x47f793)
    #48 _PyFunction_Vectorcall /home/ken/Documents/GitHub/cpython/Objects/call.c (python+0x2554bc) (BuildId: 39b4b6a9b674d30989aeda3269b50798d48eb57a)
    #49 _PyObject_VectorcallTstate /home/ken/Documents/GitHub/cpython/./Include/internal/pycore_call.h:168:11 (python+0x25b06b) (BuildId: 39b4b6a9b674d30989aeda3269b50798d48eb57a)
    #50 method_vectorcall /home/ken/Documents/GitHub/cpython/Objects/classobject.c:92:18 (python+0x259742) (BuildId: 39b4b6a9b674d30989aeda3269b50798d48eb57a)
    #51 _PyVectorcall_Call /home/ken/Documents/GitHub/cpython/Objects/call.c:273:16 (python+0x254ea5) (BuildId: 39b4b6a9b674d30989aeda3269b50798d48eb57a)
    #52 _PyObject_Call /home/ken/Documents/GitHub/cpython/Objects/call.c:348:16 (python+0x2550bb) (BuildId: 39b4b6a9b674d30989aeda3269b50798d48eb57a)
    #53 PyObject_Call /home/ken/Documents/GitHub/cpython/Objects/call.c:373:12 (python+0x2552e7) (BuildId: 39b4b6a9b674d30989aeda3269b50798d48eb57a)
    #54 _PyEval_EvalFrameDefault /home/ken/Documents/GitHub/cpython/Python/generated_cases.c.h:1358:26 (python+0x488521) (BuildId: 39b4b6a9b674d30989aeda3269b50798d48eb57a)
    #55 _PyEval_EvalFrame /home/ken/Documents/GitHub/cpython/./Include/internal/pycore_ceval.h:119:16 (python+0x47f793) (BuildId: 39b4b6a9b674d30989aeda3269b50798d48eb57a)
    #56 _PyEval_Vector /home/ken/Documents/GitHub/cpython/Python/ceval.c:1819:12 (python+0x47f793)
    #57 _PyFunction_Vectorcall /home/ken/Documents/GitHub/cpython/Objects/call.c (python+0x2554bc) (BuildId: 39b4b6a9b674d30989aeda3269b50798d48eb57a)
    #58 _PyObject_VectorcallDictTstate /home/ken/Documents/GitHub/cpython/Objects/call.c:135:15 (python+0x2538bd) (BuildId: 39b4b6a9b674d30989aeda3269b50798d48eb57a)
    #59 _PyObject_Call_Prepend /home/ken/Documents/GitHub/cpython/Objects/call.c:504:24 (python+0x2558dd) (BuildId: 39b4b6a9b674d30989aeda3269b50798d48eb57a)
    #60 slot_tp_call /home/ken/Documents/GitHub/cpython/Objects/typeobject.c:9612:15 (python+0x385a2c) (BuildId: 39b4b6a9b674d30989aeda3269b50798d48eb57a)
    #61 _PyObject_MakeTpCall /home/ken/Documents/GitHub/cpython/Objects/call.c:242:18 (python+0x253d00) (BuildId: 39b4b6a9b674d30989aeda3269b50798d48eb57a)
    #62 _PyObject_VectorcallTstate /home/ken/Documents/GitHub/cpython/./Include/internal/pycore_call.h:166:16 (python+0x2535ed) (BuildId: 39b4b6a9b674d30989aeda3269b50798d48eb57a)
    #63 PyObject_Vectorcall /home/ken/Documents/GitHub/cpython/Objects/call.c:327:12 (python+0x254fa0) (BuildId: 39b4b6a9b674d30989aeda3269b50798d48eb57a)
    #64 _PyEval_EvalFrameDefault /home/ken/Documents/GitHub/cpython/Python/generated_cases.c.h:813:23 (python+0x4854f2) (BuildId: 39b4b6a9b674d30989aeda3269b50798d48eb57a)
    #65 _PyEval_EvalFrame /home/ken/Documents/GitHub/cpython/./Include/internal/pycore_ceval.h:119:16 (python+0x47f793) (BuildId: 39b4b6a9b674d30989aeda3269b50798d48eb57a)
    #66 _PyEval_Vector /home/ken/Documents/GitHub/cpython/Python/ceval.c:1819:12 (python+0x47f793)
    #67 _PyFunction_Vectorcall /home/ken/Documents/GitHub/cpython/Objects/call.c (python+0x2554bc) (BuildId: 39b4b6a9b674d30989aeda3269b50798d48eb57a)
    #68 _PyObject_VectorcallTstate /home/ken/Documents/GitHub/cpython/./Include/internal/pycore_call.h:168:11 (python+0x25b06b) (BuildId: 39b4b6a9b674d30989aeda3269b50798d48eb57a)
    #69 method_vectorcall /home/ken/Documents/GitHub/cpython/Objects/classobject.c:92:18 (python+0x259742) (BuildId: 39b4b6a9b674d30989aeda3269b50798d48eb57a)
    #70 _PyVectorcall_Call /home/ken/Documents/GitHub/cpython/Objects/call.c:273:16 (python+0x254ea5) (BuildId: 39b4b6a9b674d30989aeda3269b50798d48eb57a)
    #71 _PyObject_Call /home/ken/Documents/GitHub/cpython/Objects/call.c:348:16 (python+0x2550bb) (BuildId: 39b4b6a9b674d30989aeda3269b50798d48eb57a)
    #72 PyObject_Call /home/ken/Documents/GitHub/cpython/Objects/call.c:373:12 (python+0x2552e7) (BuildId: 39b4b6a9b674d30989aeda3269b50798d48eb57a)
    #73 _PyEval_EvalFrameDefault /home/ken/Documents/GitHub/cpython/Python/generated_cases.c.h:1358:26 (python+0x488521) (BuildId: 39b4b6a9b674d30989aeda3269b50798d48eb57a)
    #74 _PyEval_EvalFrame /home/ken/Documents/GitHub/cpython/./Include/internal/pycore_ceval.h:119:16 (python+0x47f793) (BuildId: 39b4b6a9b674d30989aeda3269b50798d48eb57a)
    #75 _PyEval_Vector /home/ken/Documents/GitHub/cpython/Python/ceval.c:1819:12 (python+0x47f793)
    #76 _PyFunction_Vectorcall /home/ken/Documents/GitHub/cpython/Objects/call.c (python+0x2554bc) (BuildId: 39b4b6a9b674d30989aeda3269b50798d48eb57a)
    #77 _PyObject_VectorcallDictTstate /home/ken/Documents/GitHub/cpython/Objects/call.c:135:15 (python+0x2538bd) (BuildId: 39b4b6a9b674d30989aeda3269b50798d48eb57a)
    #78 _PyObject_Call_Prepend /home/ken/Documents/GitHub/cpython/Objects/call.c:504:24 (python+0x2558dd) (BuildId: 39b4b6a9b674d30989aeda3269b50798d48eb57a)
    #79 slot_tp_call /home/ken/Documents/GitHub/cpython/Objects/typeobject.c:9612:15 (python+0x385a2c) (BuildId: 39b4b6a9b674d30989aeda3269b50798d48eb57a)
    #80 _PyObject_MakeTpCall /home/ken/Documents/GitHub/cpython/Objects/call.c:242:18 (python+0x253d00) (BuildId: 39b4b6a9b674d30989aeda3269b50798d48eb57a)
    #81 _PyObject_VectorcallTstate /home/ken/Documents/GitHub/cpython/./Include/internal/pycore_call.h:166:16 (python+0x2535ed) (BuildId: 39b4b6a9b674d30989aeda3269b50798d48eb57a)
    #82 PyObject_Vectorcall /home/ken/Documents/GitHub/cpython/Objects/call.c:327:12 (python+0x254fa0) (BuildId: 39b4b6a9b674d30989aeda3269b50798d48eb57a)
    #83 _PyEval_EvalFrameDefault /home/ken/Documents/GitHub/cpython/Python/generated_cases.c.h:813:23 (python+0x4854f2) (BuildId: 39b4b6a9b674d30989aeda3269b50798d48eb57a)
    #84 _PyEval_EvalFrame /home/ken/Documents/GitHub/cpython/./Include/internal/pycore_ceval.h:119:16 (python+0x47f793) (BuildId: 39b4b6a9b674d30989aeda3269b50798d48eb57a)
    #85 _PyEval_Vector /home/ken/Documents/GitHub/cpython/Python/ceval.c:1819:12 (python+0x47f793)
    #86 _PyFunction_Vectorcall /home/ken/Documents/GitHub/cpython/Objects/call.c (python+0x2554bc) (BuildId: 39b4b6a9b674d30989aeda3269b50798d48eb57a)
    #87 _PyObject_VectorcallTstate /home/ken/Documents/GitHub/cpython/./Include/internal/pycore_call.h:168:11 (python+0x25b06b) (BuildId: 39b4b6a9b674d30989aeda3269b50798d48eb57a)
    #88 method_vectorcall /home/ken/Documents/GitHub/cpython/Objects/classobject.c:92:18 (python+0x259742) (BuildId: 39b4b6a9b674d30989aeda3269b50798d48eb57a)
    #89 _PyVectorcall_Call /home/ken/Documents/GitHub/cpython/Objects/call.c:273:16 (python+0x254ea5) (BuildId: 39b4b6a9b674d30989aeda3269b50798d48eb57a)
    #90 _PyObject_Call /home/ken/Documents/GitHub/cpython/Objects/call.c:348:16 (python+0x2550bb) (BuildId: 39b4b6a9b674d30989aeda3269b50798d48eb57a)
    #91 PyObject_Call /home/ken/Documents/GitHub/cpython/Objects/call.c:373:12 (python+0x2552e7) (BuildId: 39b4b6a9b674d30989aeda3269b50798d48eb57a)
    #92 _PyEval_EvalFrameDefault /home/ken/Documents/GitHub/cpython/Python/generated_cases.c.h:1358:26 (python+0x488521) (BuildId: 39b4b6a9b674d30989aeda3269b50798d48eb57a)
    #93 _PyEval_EvalFrame /home/ken/Documents/GitHub/cpython/./Include/internal/pycore_ceval.h:119:16 (python+0x47f793) (BuildId: 39b4b6a9b674d30989aeda3269b50798d48eb57a)
    #94 _PyEval_Vector /home/ken/Documents/GitHub/cpython/Python/ceval.c:1819:12 (python+0x47f793)
    #95 _PyFunction_Vectorcall /home/ken/Documents/GitHub/cpython/Objects/call.c (python+0x2554bc) (BuildId: 39b4b6a9b674d30989aeda3269b50798d48eb57a)
    #96 _PyObject_VectorcallDictTstate /home/ken/Documents/GitHub/cpython/Objects/call.c:135:15 (python+0x2538bd) (BuildId: 39b4b6a9b674d30989aeda3269b50798d48eb57a)
    #97 _PyObject_Call_Prepend /home/ken/Documents/GitHub/cpython/Objects/call.c:504:24 (python+0x2558dd) (BuildId: 39b4b6a9b674d30989aeda3269b50798d48eb57a)
    #98 slot_tp_call /home/ken/Documents/GitHub/cpython/Objects/typeobject.c:9612:15 (python+0x385a2c) (BuildId: 39b4b6a9b674d30989aeda3269b50798d48eb57a)
    #99 _PyObject_MakeTpCall /home/ken/Documents/GitHub/cpython/Objects/call.c:242:18 (python+0x253d00) (BuildId: 39b4b6a9b674d30989aeda3269b50798d48eb57a)
    #100 _PyObject_VectorcallTstate /home/ken/Documents/GitHub/cpython/./Include/internal/pycore_call.h:166:16 (python+0x2535ed) (BuildId: 39b4b6a9b674d30989aeda3269b50798d48eb57a)
    #101 PyObject_Vectorcall /home/ken/Documents/GitHub/cpython/Objects/call.c:327:12 (python+0x254fa0) (BuildId: 39b4b6a9b674d30989aeda3269b50798d48eb57a)
    #102 _PyEval_EvalFrameDefault /home/ken/Documents/GitHub/cpython/Python/generated_cases.c.h:813:23 (python+0x4854f2) (BuildId: 39b4b6a9b674d30989aeda3269b50798d48eb57a)
    #103 _PyEval_EvalFrame /home/ken/Documents/GitHub/cpython/./Include/internal/pycore_ceval.h:119:16 (python+0x47f793) (BuildId: 39b4b6a9b674d30989aeda3269b50798d48eb57a)
    #104 _PyEval_Vector /home/ken/Documents/GitHub/cpython/Python/ceval.c:1819:12 (python+0x47f793)
    #105 _PyFunction_Vectorcall /home/ken/Documents/GitHub/cpython/Objects/call.c (python+0x2554bc) (BuildId: 39b4b6a9b674d30989aeda3269b50798d48eb57a)
    #106 _PyObject_VectorcallTstate /home/ken/Documents/GitHub/cpython/./Include/internal/pycore_call.h:168:11 (python+0x25b06b) (BuildId: 39b4b6a9b674d30989aeda3269b50798d48eb57a)
    #107 method_vectorcall /home/ken/Documents/GitHub/cpython/Objects/classobject.c:92:18 (python+0x259742) (BuildId: 39b4b6a9b674d30989aeda3269b50798d48eb57a)
    #108 _PyVectorcall_Call /home/ken/Documents/GitHub/cpython/Objects/call.c:273:16 (python+0x254ea5) (BuildId: 39b4b6a9b674d30989aeda3269b50798d48eb57a)
    #109 _PyObject_Call /home/ken/Documents/GitHub/cpython/Objects/call.c:348:16 (python+0x2550bb) (BuildId: 39b4b6a9b674d30989aeda3269b50798d48eb57a)
    #110 PyObject_Call /home/ken/Documents/GitHub/cpython/Objects/call.c:373:12 (python+0x2552e7) (BuildId: 39b4b6a9b674d30989aeda3269b50798d48eb57a)
    #111 _PyEval_EvalFrameDefault /home/ken/Documents/GitHub/cpython/Python/generated_cases.c.h:1358:26 (python+0x488521) (BuildId: 39b4b6a9b674d30989aeda3269b50798d48eb57a)
    #112 _PyEval_EvalFrame /home/ken/Documents/GitHub/cpython/./Include/internal/pycore_ceval.h:119:16 (python+0x47f793) (BuildId: 39b4b6a9b674d30989aeda3269b50798d48eb57a)
    #113 _PyEval_Vector /home/ken/Documents/GitHub/cpython/Python/ceval.c:1819:12 (python+0x47f793)
    #114 _PyFunction_Vectorcall /home/ken/Documents/GitHub/cpython/Objects/call.c (python+0x2554bc) (BuildId: 39b4b6a9b674d30989aeda3269b50798d48eb57a)
    #115 _PyObject_VectorcallDictTstate /home/ken/Documents/GitHub/cpython/Objects/call.c:135:15 (python+0x2538bd) (BuildId: 39b4b6a9b674d30989aeda3269b50798d48eb57a)
    #116 _PyObject_Call_Prepend /home/ken/Documents/GitHub/cpython/Objects/call.c:504:24 (python+0x2558dd) (BuildId: 39b4b6a9b674d30989aeda3269b50798d48eb57a)
    #117 slot_tp_call /home/ken/Documents/GitHub/cpython/Objects/typeobject.c:9612:15 (python+0x385a2c) (BuildId: 39b4b6a9b674d30989aeda3269b50798d48eb57a)
    #118 _PyObject_MakeTpCall /home/ken/Documents/GitHub/cpython/Objects/call.c:242:18 (python+0x253d00) (BuildId: 39b4b6a9b674d30989aeda3269b50798d48eb57a)
    #119 _PyObject_VectorcallTstate /home/ken/Documents/GitHub/cpython/./Include/internal/pycore_call.h:166:16 (python+0x2535ed) (BuildId: 39b4b6a9b674d30989aeda3269b50798d48eb57a)
    #120 PyObject_Vectorcall /home/ken/Documents/GitHub/cpython/Objects/call.c:327:12 (python+0x254fa0) (BuildId: 39b4b6a9b674d30989aeda3269b50798d48eb57a)
    #121 _PyEval_EvalFrameDefault /home/ken/Documents/GitHub/cpython/Python/generated_cases.c.h:813:23 (python+0x4854f2) (BuildId: 39b4b6a9b674d30989aeda3269b50798d48eb57a)
    #122 _PyEval_EvalFrame /home/ken/Documents/GitHub/cpython/./Include/internal/pycore_ceval.h:119:16 (python+0x47f793) (BuildId: 39b4b6a9b674d30989aeda3269b50798d48eb57a)
    #123 _PyEval_Vector /home/ken/Documents/GitHub/cpython/Python/ceval.c:1819:12 (python+0x47f793)
    #124 PyEval_EvalCode /home/ken/Documents/GitHub/cpython/Python/ceval.c:599:21 (python+0x47f40a) (BuildId: 39b4b6a9b674d30989aeda3269b50798d48eb57a)
    #125 builtin_exec_impl /home/ken/Documents/GitHub/cpython/Python/bltinmodule.c:1145:17 (python+0x477fb4) (BuildId: 39b4b6a9b674d30989aeda3269b50798d48eb57a)
    #126 builtin_exec /home/ken/Documents/GitHub/cpython/Python/clinic/bltinmodule.c.h:556:20 (python+0x477fb4)
    #127 cfunction_vectorcall_FASTCALL_KEYWORDS /home/ken/Documents/GitHub/cpython/Objects/methodobject.c:441:24 (python+0x309d31) (BuildId: 39b4b6a9b674d30989aeda3269b50798d48eb57a)
    #128 _PyObject_VectorcallTstate /home/ken/Documents/GitHub/cpython/./Include/internal/pycore_call.h:168:11 (python+0x25358b) (BuildId: 39b4b6a9b674d30989aeda3269b50798d48eb57a)
    #129 PyObject_Vectorcall /home/ken/Documents/GitHub/cpython/Objects/call.c:327:12 (python+0x254fa0) (BuildId: 39b4b6a9b674d30989aeda3269b50798d48eb57a)
    #130 _PyEval_EvalFrameDefault /home/ken/Documents/GitHub/cpython/Python/generated_cases.c.h:813:23 (python+0x4854f2) (BuildId: 39b4b6a9b674d30989aeda3269b50798d48eb57a)
    #131 _PyEval_EvalFrame /home/ken/Documents/GitHub/cpython/./Include/internal/pycore_ceval.h:119:16 (python+0x47f793) (BuildId: 39b4b6a9b674d30989aeda3269b50798d48eb57a)
    #132 _PyEval_Vector /home/ken/Documents/GitHub/cpython/Python/ceval.c:1819:12 (python+0x47f793)
    #133 _PyFunction_Vectorcall /home/ken/Documents/GitHub/cpython/Objects/call.c (python+0x2554bc) (BuildId: 39b4b6a9b674d30989aeda3269b50798d48eb57a)
    #134 _PyVectorcall_Call /home/ken/Documents/GitHub/cpython/Objects/call.c:273:16 (python+0x254ea5) (BuildId: 39b4b6a9b674d30989aeda3269b50798d48eb57a)
    #135 _PyObject_Call /home/ken/Documents/GitHub/cpython/Objects/call.c:348:16 (python+0x2550bb) (BuildId: 39b4b6a9b674d30989aeda3269b50798d48eb57a)
    #136 PyObject_Call /home/ken/Documents/GitHub/cpython/Objects/call.c:373:12 (python+0x2552e7) (BuildId: 39b4b6a9b674d30989aeda3269b50798d48eb57a)
    #137 pymain_run_module /home/ken/Documents/GitHub/cpython/Modules/main.c:297:14 (python+0x5d6753) (BuildId: 39b4b6a9b674d30989aeda3269b50798d48eb57a)
    #138 pymain_run_python /home/ken/Documents/GitHub/cpython/Modules/main.c (python+0x5d5e71) (BuildId: 39b4b6a9b674d30989aeda3269b50798d48eb57a)
    #139 Py_RunMain /home/ken/Documents/GitHub/cpython/Modules/main.c:718:5 (python+0x5d5e71)
    #140 pymain_main /home/ken/Documents/GitHub/cpython/Modules/main.c:748:12 (python+0x5d64f9) (BuildId: 39b4b6a9b674d30989aeda3269b50798d48eb57a)
    #141 Py_BytesMain /home/ken/Documents/GitHub/cpython/Modules/main.c:772:12 (python+0x5d6579) (BuildId: 39b4b6a9b674d30989aeda3269b50798d48eb57a)
    #142 main /home/ken/Documents/GitHub/cpython/./Programs/python.c:15:12 (python+0x15a840) (BuildId: 39b4b6a9b674d30989aeda3269b50798d48eb57a)

  Previous atomic read of size 2 at 0x7fffb43c8440 by thread T51:
    #0 _Py_atomic_load_uint16_relaxed /home/ken/Documents/GitHub/cpython/./Include/cpython/pyatomic_gcc.h:335:10 (python+0x49a0b9) (BuildId: 39b4b6a9b674d30989aeda3269b50798d48eb57a)
    #1 _PyEval_EvalFrameDefault /home/ken/Documents/GitHub/cpython/Python/generated_cases.c.h:4312:13 (python+0x49a0b9)

Copy link
Contributor

@DinoV DinoV left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM!

@Fidget-Spinner Fidget-Spinner merged commit b1b61dc into python:main Jun 13, 2024
38 checks passed
@Fidget-Spinner Fidget-Spinner added the needs backport to 3.13 bugs and security fixes label Jun 13, 2024
@miss-islington-app
Copy link

Thanks @Fidget-Spinner for the PR 🌮🎉.. I'm working now to backport this PR to: 3.13.
🐍🍒⛏🤖

@Fidget-Spinner Fidget-Spinner deleted the instrument_races branch June 13, 2024 09:31
miss-islington pushed a commit to miss-islington/cpython that referenced this pull request Jun 13, 2024
…-120118)

* stop the world when setting local events
(cherry picked from commit b1b61dc)

Co-authored-by: Ken Jin <[email protected]>
@bedevere-app
Copy link

bedevere-app bot commented Jun 13, 2024

GH-120444 is a backport of this pull request to the 3.13 branch.

@bedevere-app bedevere-app bot removed the needs backport to 3.13 bugs and security fixes label Jun 13, 2024
@Fidget-Spinner Fidget-Spinner added the needs backport to 3.13 bugs and security fixes label Jun 13, 2024
@miss-islington-app
Copy link

Thanks @Fidget-Spinner for the PR 🌮🎉.. I'm working now to backport this PR to: 3.13.
🐍🍒⛏🤖

miss-islington pushed a commit to miss-islington/cpython that referenced this pull request Jun 13, 2024
…-120118)

* stop the world when setting local events
(cherry picked from commit b1b61dc)

Co-authored-by: Ken Jin <[email protected]>
@Fidget-Spinner Fidget-Spinner removed the needs backport to 3.13 bugs and security fixes label Jun 13, 2024
Fidget-Spinner added a commit that referenced this pull request Jun 13, 2024
…) (#120444)

gh-117657: Fix some simple races in instrumentation.c (GH-120118)

* stop the world when setting local events
(cherry picked from commit b1b61dc)

Co-authored-by: Ken Jin <[email protected]>
mrahtz pushed a commit to mrahtz/cpython that referenced this pull request Jun 30, 2024
noahbkim pushed a commit to hudson-trading/cpython that referenced this pull request Jul 11, 2024
estyxx pushed a commit to estyxx/cpython that referenced this pull request Jul 17, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants