Title: gh-132917: fix data race on `last_mem` in free-threading gc by kumaraditya303 · Pull Request #134692 · python/cpython · GitHub
Open Graph Title: gh-132917: fix data race on `last_mem` in free-threading gc by kumaraditya303 · Pull Request #134692 · python/cpython
X Title: gh-132917: fix data race on `last_mem` in free-threading gc by kumaraditya303 · Pull Request #134692 · python/cpython
Description: This fixes the data race detected by tsan on last_mem.
Details
WARNING: ThreadSanitizer: data race (pid=21581)
Write of size 8 at 0x560af591a378 by thread T61:
#0 gc_collect_internal /home/realkumaraditya/cpython/Python/gc_free_threading.c:2248:30 (python+0x58a73e) (BuildId: b9e73c5fd134c5c3be2de598477726a304b632de)
#1 gc_collect_main /home/realkumaraditya/cpython/Python/gc_free_threading.c:2313:5 (python+0x5861e7) (BuildId: b9e73c5fd134c5c3be2de598477726a304b632de)
#2 _Py_RunGC /home/realkumaraditya/cpython/Python/gc_free_threading.c:2762:5 (python+0x586d95) (BuildId: b9e73c5fd134c5c3be2de598477726a304b632de)
#3 _Py_HandlePending /home/realkumaraditya/cpython/Python/ceval_gil.c:1395:9 (python+0x59b503) (BuildId: b9e73c5fd134c5c3be2de598477726a304b632de)
#4 _PyEval_EvalFrameDefault /home/realkumaraditya/cpython/Python/generated_cases.c.h:4138:31 (python+0x4eb89d) (BuildId: b9e73c5fd134c5c3be2de598477726a304b632de)
#5 _PyEval_EvalFrame /home/realkumaraditya/cpython/./Include/internal/pycore_ceval.h:119:16 (python+0x4d228c) (BuildId: b9e73c5fd134c5c3be2de598477726a304b632de)
#6 _PyEval_Vector /home/realkumaraditya/cpython/Python/ceval.c:1961:12 (python+0x4d228c)
#7 _PyFunction_Vectorcall /home/realkumaraditya/cpython/Objects/call.c (python+0x25a73c) (BuildId: b9e73c5fd134c5c3be2de598477726a304b632de)
#8 _PyObject_VectorcallTstate /home/realkumaraditya/cpython/./Include/internal/pycore_call.h:169:11 (python+0x7259c0) (BuildId: b9e73c5fd134c5c3be2de598477726a304b632de)
#9 partial_vectorcall /home/realkumaraditya/cpython/./Modules/_functoolsmodule.c:414:16 (python+0x72940a) (BuildId: b9e73c5fd134c5c3be2de598477726a304b632de)
#10 _PyVectorcall_Call /home/realkumaraditya/cpython/Objects/call.c:273:16 (python+0x25a10d) (BuildId: b9e73c5fd134c5c3be2de598477726a304b632de)
#11 _PyObject_Call /home/realkumaraditya/cpython/Objects/call.c:348:16 (python+0x25a3a3) (BuildId: b9e73c5fd134c5c3be2de598477726a304b632de)
#12 PyObject_Call /home/realkumaraditya/cpython/Objects/call.c:373:12 (python+0x25a567) (BuildId: b9e73c5fd134c5c3be2de598477726a304b632de)
#13 _PyEval_EvalFrameDefault /home/realkumaraditya/cpython/Python/generated_cases.c.h:2654:32 (python+0x4e21b0) (BuildId: b9e73c5fd134c5c3be2de598477726a304b632de)
#14 _PyEval_EvalFrame /home/realkumaraditya/cpython/./Include/internal/pycore_ceval.h:119:16 (python+0x4d228c) (BuildId: b9e73c5fd134c5c3be2de598477726a304b632de)
#15 _PyEval_Vector /home/realkumaraditya/cpython/Python/ceval.c:1961:12 (python+0x4d228c)
#16 _PyFunction_Vectorcall /home/realkumaraditya/cpython/Objects/call.c (python+0x25a73c) (BuildId: b9e73c5fd134c5c3be2de598477726a304b632de)
#17 _PyObject_VectorcallTstate /home/realkumaraditya/cpython/./Include/internal/pycore_call.h:169:11 (python+0x2608f0) (BuildId: b9e73c5fd134c5c3be2de598477726a304b632de)
#18 method_vectorcall /home/realkumaraditya/cpython/Objects/classobject.c:72:20 (python+0x25ed10) (BuildId: b9e73c5fd134c5c3be2de598477726a304b632de)
#19 _PyObject_VectorcallTstate /home/realkumaraditya/cpython/./Include/internal/pycore_call.h:169:11 (python+0x55b9ae) (BuildId: b9e73c5fd134c5c3be2de598477726a304b632de)
#20 context_run /home/realkumaraditya/cpython/Python/context.c:728:29 (python+0x55b9ae)
#21 _PyEval_EvalFrameDefault /home/realkumaraditya/cpython/Python/generated_cases.c.h:3764:35 (python+0x4e95ac) (BuildId: b9e73c5fd134c5c3be2de598477726a304b632de)
#22 _PyEval_EvalFrame /home/realkumaraditya/cpython/./Include/internal/pycore_ceval.h:119:16 (python+0x4d228c) (BuildId: b9e73c5fd134c5c3be2de598477726a304b632de)
#23 _PyEval_Vector /home/realkumaraditya/cpython/Python/ceval.c:1961:12 (python+0x4d228c)
#24 _PyFunction_Vectorcall /home/realkumaraditya/cpython/Objects/call.c (python+0x25a73c) (BuildId: b9e73c5fd134c5c3be2de598477726a304b632de)
#25 _PyObject_VectorcallTstate /home/realkumaraditya/cpython/./Include/internal/pycore_call.h:169:11 (python+0x2608f0) (BuildId: b9e73c5fd134c5c3be2de598477726a304b632de)
#26 method_vectorcall /home/realkumaraditya/cpython/Objects/classobject.c:72:20 (python+0x25ed10) (BuildId: b9e73c5fd134c5c3be2de598477726a304b632de)
#27 _PyVectorcall_Call /home/realkumaraditya/cpython/Objects/call.c:273:16 (python+0x25a10d) (BuildId: b9e73c5fd134c5c3be2de598477726a304b632de)
#28 _PyObject_Call /home/realkumaraditya/cpython/Objects/call.c:348:16 (python+0x25a3a3) (BuildId: b9e73c5fd134c5c3be2de598477726a304b632de)
#29 PyObject_Call /home/realkumaraditya/cpython/Objects/call.c:373:12 (python+0x25a567) (BuildId: b9e73c5fd134c5c3be2de598477726a304b632de)
#30 thread_run /home/realkumaraditya/cpython/./Modules/_threadmodule.c:374:21 (python+0x715ce8) (BuildId: b9e73c5fd134c5c3be2de598477726a304b632de)
#31 pythread_wrapper /home/realkumaraditya/cpython/Python/thread_pthread.h:242:5 (python+0x64b62b) (BuildId: b9e73c5fd134c5c3be2de598477726a304b632de)
Previous read of size 8 at 0x560af591a378 by thread T57:
#0 gc_should_collect_mem_usage /home/realkumaraditya/cpython/Python/gc_free_threading.c:2065:36 (python+0x5880d6) (BuildId: b9e73c5fd134c5c3be2de598477726a304b632de)
#1 gc_should_collect /home/realkumaraditya/cpython/Python/gc_free_threading.c:2103:12 (python+0x5880d6)
#2 record_allocation /home/realkumaraditya/cpython/Python/gc_free_threading.c:2120:13 (python+0x586cc8) (BuildId: b9e73c5fd134c5c3be2de598477726a304b632de)
#3 _PyObject_GC_Link /home/realkumaraditya/cpython/Python/gc_free_threading.c:2753:5 (python+0x586cc8)
#4 _PyType_AllocNoTrack /home/realkumaraditya/cpython/Objects/typeobject.c:2357:9 (python+0x393c28) (BuildId: b9e73c5fd134c5c3be2de598477726a304b632de)
#5 PyType_GenericAlloc /home/realkumaraditya/cpython/Objects/typeobject.c:2378:21 (python+0x393990) (BuildId: b9e73c5fd134c5c3be2de598477726a304b632de)
#6 dict_new /home/realkumaraditya/cpython/Objects/dictobject.c:4852:22 (python+0x301ef5) (BuildId: b9e73c5fd134c5c3be2de598477726a304b632de)
#7 type_call /home/realkumaraditya/cpython/Objects/typeobject.c:2291:11 (python+0x39d52a) (BuildId: b9e73c5fd134c5c3be2de598477726a304b632de)
#8 _PyObject_MakeTpCall /home/realkumaraditya/cpython/Objects/call.c:242:18 (python+0x258e84) (BuildId: b9e73c5fd134c5c3be2de598477726a304b632de)
#9 _PyObject_VectorcallTstate /home/realkumaraditya/cpython/./Include/internal/pycore_call.h:167:16 (python+0x258728) (BuildId: b9e73c5fd134c5c3be2de598477726a304b632de)
#10 PyObject_Vectorcall /home/realkumaraditya/cpython/Objects/call.c:327:12 (python+0x25a240) (BuildId: b9e73c5fd134c5c3be2de598477726a304b632de)
#11 _PyEval_EvalFrameDefault /home/realkumaraditya/cpython/Python/generated_cases.c.h:4099:35 (python+0x4eb363) (BuildId: b9e73c5fd134c5c3be2de598477726a304b632de)
#12 _PyEval_EvalFrame /home/realkumaraditya/cpython/./Include/internal/pycore_ceval.h:119:16 (python+0x4d228c) (BuildId: b9e73c5fd134c5c3be2de598477726a304b632de)
#13 _PyEval_Vector /home/realkumaraditya/cpython/Python/ceval.c:1961:12 (python+0x4d228c)
#14 _PyFunction_Vectorcall /home/realkumaraditya/cpython/Objects/call.c (python+0x25a73c) (BuildId: b9e73c5fd134c5c3be2de598477726a304b632de)
#15 _PyObject_VectorcallTstate /home/realkumaraditya/cpython/./Include/internal/pycore_call.h:169:11 (python+0x7259c0) (BuildId: b9e73c5fd134c5c3be2de598477726a304b632de)
#16 partial_vectorcall /home/realkumaraditya/cpython/./Modules/_functoolsmodule.c:414:16 (python+0x72940a) (BuildId: b9e73c5fd134c5c3be2de598477726a304b632de)
#17 _PyVectorcall_Call /home/realkumaraditya/cpython/Objects/call.c:273:16 (python+0x25a10d) (BuildId: b9e73c5fd134c5c3be2de598477726a304b632de)
#18 _PyObject_Call /home/realkumaraditya/cpython/Objects/call.c:348:16 (python+0x25a3a3) (BuildId: b9e73c5fd134c5c3be2de598477726a304b632de)
#19 PyObject_Call /home/realkumaraditya/cpython/Objects/call.c:373:12 (python+0x25a567) (BuildId: b9e73c5fd134c5c3be2de598477726a304b632de)
#20 _PyEval_EvalFrameDefault /home/realkumaraditya/cpython/Python/generated_cases.c.h:2654:32 (python+0x4e21b0) (BuildId: b9e73c5fd134c5c3be2de598477726a304b632de)
#21 _PyEval_EvalFrame /home/realkumaraditya/cpython/./Include/internal/pycore_ceval.h:119:16 (python+0x4d228c) (BuildId: b9e73c5fd134c5c3be2de598477726a304b632de)
#22 _PyEval_Vector /home/realkumaraditya/cpython/Python/ceval.c:1961:12 (python+0x4d228c)
#23 _PyFunction_Vectorcall /home/realkumaraditya/cpython/Objects/call.c (python+0x25a73c) (BuildId: b9e73c5fd134c5c3be2de598477726a304b632de)
#24 _PyObject_VectorcallTstate /home/realkumaraditya/cpython/./Include/internal/pycore_call.h:169:11 (python+0x2608f0) (BuildId: b9e73c5fd134c5c3be2de598477726a304b632de)
#25 method_vectorcall /home/realkumaraditya/cpython/Objects/classobject.c:72:20 (python+0x25ed10) (BuildId: b9e73c5fd134c5c3be2de598477726a304b632de)
#26 _PyObject_VectorcallTstate /home/realkumaraditya/cpython/./Include/internal/pycore_call.h:169:11 (python+0x55b9ae) (BuildId: b9e73c5fd134c5c3be2de598477726a304b632de)
#27 context_run /home/realkumaraditya/cpython/Python/context.c:728:29 (python+0x55b9ae)
#28 _PyEval_EvalFrameDefault /home/realkumaraditya/cpython/Python/generated_cases.c.h:3764:35 (python+0x4e95ac) (BuildId: b9e73c5fd134c5c3be2de598477726a304b632de)
#29 _PyEval_EvalFrame /home/realkumaraditya/cpython/./Include/internal/pycore_ceval.h:119:16 (python+0x4d228c) (BuildId: b9e73c5fd134c5c3be2de598477726a304b632de)
#30 _PyEval_Vector /home/realkumaraditya/cpython/Python/ceval.c:1961:12 (python+0x4d228c)
#31 _PyFunction_Vectorcall /home/realkumaraditya/cpython/Objects/call.c (python+0x25a73c) (BuildId: b9e73c5fd134c5c3be2de598477726a304b632de)
#32 _PyObject_VectorcallTstate /home/realkumaraditya/cpython/./Include/internal/pycore_call.h:169:11 (python+0x2608f0) (BuildId: b9e73c5fd134c5c3be2de598477726a304b632de)
#33 method_vectorcall /home/realkumaraditya/cpython/Objects/classobject.c:72:20 (python+0x25ed10) (BuildId: b9e73c5fd134c5c3be2de598477726a304b632de)
#34 _PyVectorcall_Call /home/realkumaraditya/cpython/Objects/call.c:273:16 (python+0x25a10d) (BuildId: b9e73c5fd134c5c3be2de598477726a304b632de)
#35 _PyObject_Call /home/realkumaraditya/cpython/Objects/call.c:348:16 (python+0x25a3a3) (BuildId: b9e73c5fd134c5c3be2de598477726a304b632de)
#36 PyObject_Call /home/realkumaraditya/cpython/Objects/call.c:373:12 (python+0x25a567) (BuildId: b9e73c5fd134c5c3be2de598477726a304b632de)
#37 thread_run /home/realkumaraditya/cpython/./Modules/_threadmodule.c:374:21 (python+0x715ce8) (BuildId: b9e73c5fd134c5c3be2de598477726a304b632de)
#38 pythread_wrapper /home/realkumaraditya/cpython/Python/thread_pthread.h:242:5 (python+0x64b62b) (BuildId: b9e73c5fd134c5c3be2de598477726a304b632de)
Location is global '_PyRuntime' of size 380160 at 0x560af58f8580 (python+0xa0d378)
Thread T61 'Thread-61' (tid=22453, running) created by main thread at:
#0 pthread_create
Open Graph Description: This fixes the data race detected by tsan on last_mem. Details WARNING: ThreadSanitizer: data race (pid=21581) Write of size 8 at 0x560af591a378 by thread T61: #0 gc_collect_internal /home/re...
X Description: This fixes the data race detected by tsan on last_mem. Details WARNING: ThreadSanitizer: data race (pid=21581) Write of size 8 at 0x560af591a378 by thread T61: #0 gc_collect_internal /home/re...
Opengraph URL: https://github.com/python/cpython/pull/134692
X: @github
Domain: github.com
| route-pattern | /:user_id/:repository/pull/:id/files(.:format) |
| route-controller | pull_requests |
| route-action | files |
| fetch-nonce | v2:1424ac84-fc70-218d-0a8a-f0729cfc2dbe |
| current-catalog-service-hash | ae870bc5e265a340912cde392f23dad3671a0a881730ffdadd82f2f57d81641b |
| request-id | E052:23560F:1AA40F1:245614A:6A536B92 |
| html-safe-nonce | 5435a69b8e1179866afeba57cb6c870858094d14a5b9d534ad7546699e96ea8f |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJFMDUyOjIzNTYwRjoxQUE0MEYxOjI0NTYxNEE6NkE1MzZCOTIiLCJ2aXNpdG9yX2lkIjoiNTI4NDg4ODQ2NzAyMDY3MTg5MCIsInJlZ2lvbl9lZGdlIjoiaWFkIiwicmVnaW9uX3JlbmRlciI6ImlhZCJ9 |
| visitor-hmac | 0aed94719c4019c4e5cf0c20a52877efc368e6ddef7e71fce898611fc8c9a497 |
| hovercard-subject-tag | pull_request:2543232758 |
| github-keyboard-shortcuts | repository,pull-request-list,pull-request-conversation,pull-request-files-changed,copilot |
| google-site-verification | Apib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I |
| octolytics-url | https://collector.github.com/github/collect |
| analytics-location | / |
| fb:app_id | 1401488693436528 |
| apple-itunes-app | app-id=1477376905, app-argument=https://github.com/python/cpython/pull/134692/files |
| twitter:image | https://avatars.githubusercontent.com/u/59607654?s=400&v=4 |
| twitter:card | summary_large_image |
| og:image | https://avatars.githubusercontent.com/u/59607654?s=400&v=4 |
| og:image:alt | This fixes the data race detected by tsan on last_mem. Details WARNING: ThreadSanitizer: data race (pid=21581) Write of size 8 at 0x560af591a378 by thread T61: #0 gc_collect_internal /home/re... |
| og:site_name | GitHub |
| og:type | object |
| hostname | github.com |
| expected-hostname | github.com |
| None | b9a586c06a05a7a86fc7e3f4dbd03e42f6869085879aa184aa6369456dbd50fb |
| turbo-cache-control | no-preview |
| diff-view | unified |
| go-import | github.com/python/cpython git https://github.com/python/cpython.git |
| octolytics-dimension-user_id | 1525981 |
| octolytics-dimension-user_login | python |
| octolytics-dimension-repository_id | 81598961 |
| octolytics-dimension-repository_nwo | python/cpython |
| octolytics-dimension-repository_public | true |
| octolytics-dimension-repository_is_fork | false |
| octolytics-dimension-repository_network_root_id | 81598961 |
| octolytics-dimension-repository_network_root_nwo | python/cpython |
| turbo-body-classes | logged-out env-production page-responsive |
| disable-turbo | true |
| browser-stats-url | https://api.github.com/_private/browser/stats |
| browser-errors-url | https://api.github.com/_private/browser/errors |
| release | 07a982c1d40157c619b364352b704c3ce66bb332 |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
Links:
Viewport: width=device-width