New submission from STINNER Victor <vstin...@redhat.com>:

test_asyncio started to crash in https://github.com/python/cpython/pull/7487

I debugged the crash with Yury: _PyHAMT_New() triggers indirectly a GC 
collection at "o->h_root = hamt_node_bitmap_new(0);". Problem: the object that 
is being created is already tracked by the GC, whereas its h_root field is not 
set. Then the GC does crash because the field is a random pointer.

hamt_alloc() must initialize h_root and h_count before tracking the object in 
the GC.

Thinking about the GC when writing an object constructor is hard :-(

Maybe we should add a debug option to trigger the GC more often to make such 
random bug more likely. contextvars has been implemented a few months ago, and 
we only spotted the bug a few days before Python 3.7.0 final release...

----------
components: Interpreter Core
messages: 318990
nosy: ned.deily, vstinner, yselivanov
priority: release blocker
severity: normal
status: open
type: crash
versions: Python 3.7, Python 3.8

_______________________________________
Python tracker <rep...@bugs.python.org>
<https://bugs.python.org/issue33803>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to