kryheb <krystianheberl...@gmail.com> added the comment:

Hi vstinner,

I apologize for the inaccurate code sample.
Please find a simplified example without threads `inittab-bug_no-threads.c` in 
attachments. Please notice that __main__.py has changed, there is no infinite 
loop anymore.

Steps to reproduce:

1. Append embedded module
2. Initialize Python from config with run_filename
3. Run main
4. Finalize
5. Repeat all above

Observed behavior:
The script is executed at the first iteration, but re-initialization fails with 
a segmentation fault:

gdb) r
Starting program: /home/kheb/proj/tmp/pyc/a.out 
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/lib64/libthread_db.so.1".
Run Python Script
>>> This is the python script
Python Script completed (0)

Program received signal SIGSEGV, Segmentation fault.
__strlen_avx2 () at ../sysdeps/x86_64/multiarch/strlen-avx2.S:65
65              VPCMPEQ (%rdi), %ymm0, %ymm1
Missing separate debuginfos, use: dnf debuginfo-install 
libxcrypt-4.4.20-2.fc33.x86_64
(gdb) bt
#0  __strlen_avx2 () at ../sysdeps/x86_64/multiarch/strlen-avx2.S:65
#1  0x00007ffff7d039f0 in PyUnicode_FromString (
    u=0xdddddddddddddddd <error: Cannot access memory at address 
0xdddddddddddddddd>)
    at Objects/unicodeobject.c:2309
#2  0x00007ffff7dbf049 in list_builtin_module_names () at 
./Python/sysmodule.c:2056
#3  0x00007ffff7dc1777 in _PySys_InitCore (tstate=tstate@entry=0x422ac0, 
sysdict=sysdict@entry=0x7fffea221070)
    at ./Python/sysmodule.c:2813
#4  0x00007ffff7dc36ef in _PySys_Create (tstate=tstate@entry=0x422ac0, 
sysmod_p=sysmod_p@entry=0x7fffffffd9d8)
    at ./Python/sysmodule.c:3087
#5  0x00007ffff7da9b32 in pycore_interp_init (tstate=0x422ac0) at 
Python/pylifecycle.c:824
#6  0x00007ffff7da9c8e in pyinit_config (runtime=runtime@entry=0x7ffff7fbe820 
<_PyRuntime>, 
    tstate_p=tstate_p@entry=0x7fffffffdca8, config=config@entry=0x7fffffffdac0) 
at Python/pylifecycle.c:866
#7  0x00007ffff7daba3e in pyinit_core (runtime=runtime@entry=0x7ffff7fbe820 
<_PyRuntime>, 
    src_config=src_config@entry=0x7fffffffdd40, 
tstate_p=tstate_p@entry=0x7fffffffdca8) at Python/pylifecycle.c:1029
#8  0x00007ffff7dabb18 in Py_InitializeFromConfig (config=0x7fffffffdd40) at 
Python/pylifecycle.c:1214
#9  0x00000000004012d3 in main (argc=1, argv=0x7fffffffdfc8) at 
inittab-bug_no-threads.c:45

I hope this example helps.

Best regards,
Krystian

----------
Added file: https://bugs.python.org/file50125/inittab-bug_no-threads.c

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

Reply via email to