Repository navigation
Need to defer GC tracking of array.array construction #153083
Copy link
Copy link
Closed
Labels
3.14bugs and security fixesbugs and security fixes3.15bugs and security fixesbugs and security fixes3.16new features, bugs and security fixesnew features, bugs and security fixesinterpreter-core(Objects, Python, Grammar, and Parser dirs)(Objects, Python, Grammar, and Parser dirs)topic-free-threadingtype-bugAn unexpected behavior, bug, or errorAn unexpected behavior, bug, or error
Description
The same bug affects
array.array: construction GC-tracks the object before
it's filled, so another thread can reach the half-built object via
gc.get_objects() mid-construction and race with the fill.
I am working on this.
WARNING: ThreadSanitizer: data race (pid=86250)
SUMMARY: ThreadSanitizer: data race arraymodule.c:964 in array_length
WARNING: ThreadSanitizer: data race (pid=86250)
SUMMARY: ThreadSanitizer: data race arraymodule.c:515 in q_getitem
WARNING: ThreadSanitizer: data race (pid=86250)
SUMMARY: ThreadSanitizer: data race alloc.c:746 in _mi_heap_realloc_zero
WARNING: ThreadSanitizer: data race (pid=86250)
SUMMARY: ThreadSanitizer: data race arraymodule.c:195 in array_resize
WARNING: ThreadSanitizer: data race (pid=86250)
SUMMARY: ThreadSanitizer: data race arraymodule.c:515 in q_getitem
WARNING: ThreadSanitizer: data race (pid=86250)
SUMMARY: ThreadSanitizer: data race arraymodule.c:159 in array_resize
WARNING: ThreadSanitizer: data race (pid=86250)
SUMMARY: ThreadSanitizer: data race arraymodule.c:515 in q_getitem
WARNING: ThreadSanitizer: data race (pid=86250)
SUMMARY: ThreadSanitizer: data race alloc.c:746 in _mi_heap_realloc_zero
WARNING: ThreadSanitizer: data race (pid=86250)
SUMMARY: ThreadSanitizer: data race arraymodule.c:195 in array_resize
==86250==ERROR: ThreadSanitizer: SEGV on unknown address 0x000102000100 (pc 0x000103c83aec bp 0x00016efe9ff0 sp 0x00016efe9fb0 T4883198)
SUMMARY: ThreadSanitizer: SEGV obmalloc.c:298 in _PyMem_MiFree
Linked PRs
- gh-153083: Defer GC tracking of an array to the end of construction. #153284
- [3.15] gh-153083: Defer GC tracking of an array to the end of construction. (gh-153284) #153336
- [3.14] gh-153083: Defer GC tracking of an array to the end of construction. (gh-153284) #153337
- [3.13] gh-153083: Defer GC tracking of an array to the end of construction. (gh-153284) #153338
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
3.14bugs and security fixesbugs and security fixes3.15bugs and security fixesbugs and security fixes3.16new features, bugs and security fixesnew features, bugs and security fixesinterpreter-core(Objects, Python, Grammar, and Parser dirs)(Objects, Python, Grammar, and Parser dirs)topic-free-threadingtype-bugAn unexpected behavior, bug, or errorAn unexpected behavior, bug, or error
Projects
- StatusShow more project fieldsDone
Activity
gh-153083: Defer GC tracking of an array to the end of construction. (g…
[3.15] gh-153083: Defer GC tracking of an array to the end of constru…
[3.13] gh-153083: Defer GC tracking of an array to the end of constru…
[3.14] gh-153083: Defer GC tracking of an array to the end of constru…