Steve Stagg <stest...@gmail.com> added the comment:

Reproducible on master, but doesn't occur with a debug build.

My configure:

> ./configure --prefix=$PREFIX --exec-prefix=$EPREFIX 
> --cache-file=../config.cache --without-ensurepip > /dev/null
> PYTHONMALLOC=pymalloc_debug $EPREFIX/bin/python3 ../test.py

Crash comes out of the child process, I modified example to invoke lldb for 
child:

```
import os
import time
import subprocess

def daemon():
    pid = os.fork()
    if pid != 0:
        subprocess.run(["lldb", '-p', str(pid)])
        time.sleep(10)
        os._exit(0)
    time.sleep(1)

daemon()
```


Attaching to the child gives this backtrace:

(lldb) bt
* thread #1, name = 'python3', stop reason = signal SIGSEGV: invalid address 
(fault address: 0x0)
    frame #0: 0x0000564a5a325f9c 
python3.10`_PyObject_DebugDumpAddress(p=0x0000564a5aa2c630) at 
obmalloc.c:2457:12
    frame #1: 0x0000564a5a326571 
python3.10`_PyMem_DebugCheckAddress(func="_PyMem_DebugRawFree", 
api=<unavailable>, p=<unavailable>) at obmalloc.c:2375:9
  * frame #2: 0x0000564a5a326d29 python3.10`_PyMem_DebugRawFree at 
obmalloc.c:2208:5
    frame #3: 0x0000564a5a326d17 
python3.10`_PyMem_DebugRawFree(ctx=0x0000564a5a5d37e0, p=0x0000564a5aa2c630) at 
obmalloc.c:2197
    frame #4: 0x0000564a5a3d4aa3 
python3.10`PyInterpreterState_Delete(interp=0x0000564a5aa4e6b0) at 
pystate.c:396:9
    frame #5: 0x0000564a5a3d1921 python3.10`Py_FinalizeEx [inlined] 
finalize_interp_delete(tstate=<unavailable>) at pylifecycle.c:1633:5
    frame #6: 0x0000564a5a3d190b python3.10`Py_FinalizeEx at pylifecycle.c:1782
    frame #7: 0x0000564a5a2dab80 python3.10`Py_BytesMain at main.c:679:9
    frame #8: 0x0000564a5a2dab69 python3.10`Py_BytesMain at main.c:707
    frame #9: 0x0000564a5a2dab4f python3.10`Py_BytesMain(argc=<unavailable>, 
argv=<unavailable>) at main.c:731
    frame #10: 0x00007ff2e6251152 libc.so.6`__libc_start_main + 242
    frame #11: 0x0000564a5a2d978e python3.10`_start + 46


The call stack is trying to free an interpreter mutex:
    PyThread_free_lock(interp->id_mutex);

----------
nosy: +stestagg

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

Reply via email to