Coder Social home page Coder Social logo

[BUG] Random Segfault about cython HOT 9 CLOSED

YoSTEALTH avatar YoSTEALTH commented on June 1, 2024
[BUG] Random Segfault

from cython.

Comments (9)

da-woods avatar da-woods commented on June 1, 2024

I'm going to close this because I think it's pretty unlikely to be a Python or Cython bug, and we try to keep support questions on the mailing list (https://groups.google.com/g/cython-users) rather than on the bug tracker.

My advice is:

  • A C debugger (gdb, lldb) is the right level of tool to use.
  • it's reasonably likely that it's memory getting overwritten and that the bug is some distance from where you see the error. Especially because it's crashing in unpredictable places.
  • Debugging is much easier if you compile without optimizations (-O0 cflag) although that doesn't help you see through Python code.
  • I'd also try tools like address sanitizer, memory sanitizer, undefined behaviour sanitizer (you can turn them on with compiler flags). They're more likely to show where the initial mistake is.

from cython.

YoSTEALTH avatar YoSTEALTH commented on June 1, 2024

@da-woods Thanks for your input.

After enabling -fsanitize=address I am getting sleep.cpython-313-x86_64-linux-gnu.so: undefined symbol: __asan_option_detect_stack_use_after_return

I can't use that mailing list or else I would have done so.

from cython.

YoSTEALTH avatar YoSTEALTH commented on June 1, 2024

I finally got -fsanitize=address to work with compile and link and enabled LD_PRELOAD, I got tons of memory leak messages!So I ran the compiler with just 1 empty.pyx file and I still got memory leak messages!!!

from os import environ
from setuptools import setup
from Cython.Build import cythonize
from Cython.Distutils import Extension


environ['LD_PRELOAD'] = 'libasan.so'
extension = [Extension(name='empty',  # where the `.so` will be saved.
                       sources=['empty.pyx'],
                       language='c',
                       extra_compile_args=[
                            '-fsanitize=address',
                        ],
                       extra_link_args=[
                            '-fsanitize=address',
                        ])]
setup(
    name='testing',
    ext_modules=cythonize(extension, compiler_directives={'language_level': 3}),
    zip_safe=False,
Running ...                                                                                    
                                                                 
Compiling empty.pyx because it changed.             
[1/1] Cythonizing empty.pyx
running build_ext                                        
building 'empty' extension                                                                     
creating build  
creating build/temp.linux-x86_64-cpython-313                                                
gcc -fno-strict-overflow -Wsign-compare -DNDEBUG -g -O3 -Wall -fPIC -I/opt/python/3.13/include/python3.13 -c empty.c -o build/temp.linux-x86_64-cpython-313/empty.o -fsanitize=address
                                                                                               
=================================================================
==12103==ERROR: LeakSanitizer: detected memory leaks                                        

Direct leak of 2763 byte(s) in 309 object(s) allocated from:
    #0 0x744265ce1359 in __interceptor_malloc /usr/src/debug/gcc/gcc/libsanitizer/asan/asan_malloc_linux.cpp:69
    #1 0x199ac1f in xstrdup (/usr/lib/gcc/x86_64-pc-linux-gnu/13.2.1/cc1+0x199ac1f) (BuildId: f32049cda0cd81a36bd1543f6b3b6dcb629abdeb)
                                                        
Direct leak of 2320 byte(s) in 58 object(s) allocated from:                                    
    #0 0x744265ce1359 in __interceptor_malloc /usr/src/debug/gcc/gcc/libsanitizer/asan/asan_malloc_linux.cpp:69                                                                            
    #1 0x7fc0c4 in symtab_node::create_reference(symtab_node*, ipa_ref_use, gimple*) (/usr/lib/gcc/x86_64-pc-linux-gnu/13.2.1/cc1+0x7fc0c4) (BuildId: f32049cda0cd81a36bd1543f6b3b6dcb629abdeb)                                                                                              
                
Direct leak of 1913 byte(s) in 215 object(s) allocated from:                                
    #0 0x744265ce1359 in __interceptor_malloc /usr/src/debug/gcc/gcc/libsanitizer/asan/asan_malloc_linux.cpp:69                                                 
    #1 0x199ac1f in xstrdup (/usr/lib/gcc/x86_64-pc-linux-gnu/13.2.1/cc1+0x199ac1f) (BuildId: f32049cda0cd81a36bd1543f6b3b6dcb629abdeb)                                                       
    #2 0x66b9f1cbefeac7ff  (<unknown module>)

Direct leak of 732 byte(s) in 1 object(s) allocated from:
    #0 0x744265ce007a in __interceptor_realloc /usr/src/debug/gcc/gcc/libsanitizer/asan/asan_malloc_linux.cpp:85
    #1 0x829bad in cgraph_node::remove_callees() (/usr/lib/gcc/x86_64-pc-linux-gnu/13.2.1/cc1+0x829bad) (BuildId: f32049cda0cd81a36bd1543f6b3b6dcb629abdeb)

Direct leak of 688 byte(s) in 2 object(s) allocated from:
    #0 0x744265ce1359 in __interceptor_malloc /usr/src/debug/gcc/gcc/libsanitizer/asan/asan_malloc_linux.cpp:69
    #1 0xa1f9ee in ipa_fn_summary::account_size_time(int, sreal, ipa_predicate const&, ipa_predicate const&, bool) (/usr/lib/gcc/x86_64-pc-linux-gnu/13.2.1/cc1+0xa1f9ee) (BuildId: f32049cda0cd81a36bd1543f6b3b6dcb629abdeb)

Direct leak of 550 byte(s) in 55 object(s) allocated from:
    #0 0x744265ce1359 in __interceptor_malloc /usr/src/debug/gcc/gcc/libsanitizer/asan/asan_malloc_linux.cpp:69
    #1 0x199ac1f in xstrdup (/usr/lib/gcc/x86_64-pc-linux-gnu/13.2.1/cc1+0x199ac1f) (BuildId: f32049cda0cd81a36bd1543f6b3b6dcb629abdeb)
    #2 0x66b9f1cbefea0031  (<unknown module>)

Direct leak of 550 byte(s) in 55 object(s) allocated from:
    #0 0x744265ce1359 in __interceptor_malloc /usr/src/debug/gcc/gcc/libsanitizer/asan/asan_malloc_linux.cpp:69
    #1 0x199ac1f in xstrdup (/usr/lib/gcc/x86_64-pc-linux-gnu/13.2.1/cc1+0x199ac1f) (BuildId: f32049cda0cd81a36bd1543f6b3b6dcb629abdeb)
    #2 0x66b9f1cbefea0030  (<unknown module>)

Direct leak of 540 byte(s) in 54 object(s) allocated from:
    #0 0x744265ce1359 in __interceptor_malloc /usr/src/debug/gcc/gcc/libsanitizer/asan/asan_malloc_linux.cpp:69
    #1 0x199ac1f in xstrdup (/usr/lib/gcc/x86_64-pc-linux-gnu/13.2.1/cc1+0x199ac1f) (BuildId: f32049cda0cd81a36bd1543f6b3b6dcb629abdeb)
    #2 0x66b9f1cbefea0032  (<unknown module>)

Direct leak of 530 byte(s) in 53 object(s) allocated from:
    #0 0x744265ce1359 in __interceptor_malloc /usr/src/debug/gcc/gcc/libsanitizer/asan/asan_malloc_linux.cpp:69
    #1 0x199ac1f in xstrdup (/usr/lib/gcc/x86_64-pc-linux-gnu/13.2.1/cc1+0x199ac1f) (BuildId: f32049cda0cd81a36bd1543f6b3b6dcb629abdeb)
    #2 0x66b9f1cbefea002f  (<unknown module>)

Direct leak of 520 byte(s) in 52 object(s) allocated from:
    #0 0x744265ce1359 in __interceptor_malloc /usr/src/debug/gcc/gcc/libsanitizer/asan/asan_malloc_linux.cpp:69
    #1 0x199ac1f in xstrdup (/usr/lib/gcc/x86_64-pc-linux-gnu/13.2.1/cc1+0x199ac1f) (BuildId: f32049cda0cd81a36bd1543f6b3b6dcb629abdeb)
    #2 0x66b9f1cbefea0036  (<unknown module>)

Direct leak of 520 byte(s) in 52 object(s) allocated from:
    #0 0x744265ce1359 in __interceptor_malloc /usr/src/debug/gcc/gcc/libsanitizer/asan/asan_malloc_linux.cpp:69
    #1 0x199ac1f in xstrdup (/usr/lib/gcc/x86_64-pc-linux-gnu/13.2.1/cc1+0x199ac1f) (BuildId: f32049cda0cd81a36bd1543f6b3b6dcb629abdeb)
    #2 0x66b9f1cbefea0033  (<unknown module>)

Direct leak of 520 byte(s) in 52 object(s) allocated from:
    #0 0x744265ce1359 in __interceptor_malloc /usr/src/debug/gcc/gcc/libsanitizer/asan/asan_malloc_linux.cpp:69
    #1 0x199ac1f in xstrdup (/usr/lib/gcc/x86_64-pc-linux-gnu/13.2.1/cc1+0x199ac1f) (BuildId: f32049cda0cd81a36bd1543f6b3b6dcb629abdeb)
    #2 0x66b9f1cbefea0034  (<unknown module>)

Direct leak of 500 byte(s) in 50 object(s) allocated from:
    #0 0x744265ce1359 in __interceptor_malloc /usr/src/debug/gcc/gcc/libsanitizer/asan/asan_malloc_linux.cpp:69
    #1 0x199ac1f in xstrdup (/usr/lib/gcc/x86_64-pc-linux-gnu/13.2.1/cc1+0x199ac1f) (BuildId: f32049cda0cd81a36bd1543f6b3b6dcb629abdeb)
    #2 0x66b9f1cbefea0037  (<unknown module>)

Direct leak of 500 byte(s) in 50 object(s) allocated from:
    #0 0x744265ce1359 in __interceptor_malloc /usr/src/debug/gcc/gcc/libsanitizer/asan/asan_malloc_linux.cpp:69
    #1 0x199ac1f in xstrdup (/usr/lib/gcc/x86_64-pc-linux-gnu/13.2.1/cc1+0x199ac1f) (BuildId: f32049cda0cd81a36bd1543f6b3b6dcb629abdeb)
    #2 0x66b9f1cbefea0038  (<unknown module>)

Direct leak of 500 byte(s) in 50 object(s) allocated from:
    #0 0x744265ce1359 in __interceptor_malloc /usr/src/debug/gcc/gcc/libsanitizer/asan/asan_malloc_linux.cpp:69
    #1 0x199ac1f in xstrdup (/usr/lib/gcc/x86_64-pc-linux-gnu/13.2.1/cc1+0x199ac1f) (BuildId: f32049cda0cd81a36bd1543f6b3b6dcb629abdeb)
    #2 0x66b9f1cbefea0035  (<unknown module>)

Direct leak of 336 byte(s) in 2 object(s) allocated from:
    #0 0x744265ce1359 in __interceptor_malloc /usr/src/debug/gcc/gcc/libsanitizer/asan/asan_malloc_linux.cpp:69
    #1 0xa3d27a in modref_access_node::insert_kill(vec<modref_access_node, va_heap, vl_ptr>&, modref_access_node&, bool) (/usr/lib/gcc/x86_64-pc-linux-gnu/13.2.1/cc1+0xa3d27a) (BuildId: f32049cda0cd81a36bd1543f6b3b6dcb629abdeb)

Direct leak of 336 byte(s) in 2 object(s) allocated from:
    #0 0x744265ce007a in __interceptor_realloc /usr/src/debug/gcc/gcc/libsanitizer/asan/asan_malloc_linux.cpp:85
    #1 0x7fbe12 in symtab_node::create_reference(symtab_node*, ipa_ref_use, gimple*) (/usr/lib/gcc/x86_64-pc-linux-gnu/13.2.1/cc1+0x7fbe12) (BuildId: f32049cda0cd81a36bd1543f6b3b6dcb629abdeb)

Direct leak of 260 byte(s) in 29 object(s) allocated from:
    #0 0x744265ce1359 in __interceptor_malloc /usr/src/debug/gcc/gcc/libsanitizer/asan/asan_malloc_linux.cpp:69
    #1 0x199ac1f in xstrdup (/usr/lib/gcc/x86_64-pc-linux-gnu/13.2.1/cc1+0x199ac1f) (BuildId: f32049cda0cd81a36bd1543f6b3b6dcb629abdeb)
    #2 0x7441ffffffff  (<unknown module>)

Direct leak of 179 byte(s) in 20 object(s) allocated from:
    #0 0x744265ce1359 in __interceptor_malloc /usr/src/debug/gcc/gcc/libsanitizer/asan/asan_malloc_linux.cpp:69
    #1 0x199ac1f in xstrdup (/usr/lib/gcc/x86_64-pc-linux-gnu/13.2.1/cc1+0x199ac1f) (BuildId: f32049cda0cd81a36bd1543f6b3b6dcb629abdeb)
    #2 0x66b9f1caffffffff  (<unknown module>)

Direct leak of 162 byte(s) in 18 object(s) allocated from:
    #0 0x744265ce1359 in __interceptor_malloc /usr/src/debug/gcc/gcc/libsanitizer/asan/asan_malloc_linux.cpp:69
    #1 0x199ac1f in xstrdup (/usr/lib/gcc/x86_64-pc-linux-gnu/13.2.1/cc1+0x199ac1f) (BuildId: f32049cda0cd81a36bd1543f6b3b6dcb629abdeb)
    #2 0x744260cfb6ff  (<unknown module>)

Direct leak of 112 byte(s) in 1 object(s) allocated from:
    #0 0x744265ce0cc1 in __interceptor_calloc /usr/src/debug/gcc/gcc/libsanitizer/asan/asan_malloc_linux.cpp:77
    #1 0x199a735 in htab_create (/usr/lib/gcc/x86_64-pc-linux-gnu/13.2.1/cc1+0x199a735) (BuildId: f32049cda0cd81a36bd1543f6b3b6dcb629abdeb)

Direct leak of 104 byte(s) in 1 object(s) allocated from:
    #0 0x744265ce007a in __interceptor_realloc /usr/src/debug/gcc/gcc/libsanitizer/asan/asan_malloc_linux.cpp:85
    #1 0x7583f8  (/usr/lib/gcc/x86_64-pc-linux-gnu/13.2.1/cc1+0x7583f8) (BuildId: f32049cda0cd81a36bd1543f6b3b6dcb629abdeb)

Direct leak of 104 byte(s) in 1 object(s) allocated from:
    #0 0x744265ce0cc1 in __interceptor_calloc /usr/src/debug/gcc/gcc/libsanitizer/asan/asan_malloc_linux.cpp:77
    #1 0x199a6b5 in xcalloc (/usr/lib/gcc/x86_64-pc-linux-gnu/13.2.1/cc1+0x199a6b5) (BuildId: f32049cda0cd81a36bd1543f6b3b6dcb629abdeb)

Direct leak of 102 byte(s) in 7 object(s) allocated from:
    #0 0x744265ce1359 in __interceptor_malloc /usr/src/debug/gcc/gcc/libsanitizer/asan/asan_malloc_linux.cpp:69
    #1 0x19bd79a  (/usr/lib/gcc/x86_64-pc-linux-gnu/13.2.1/cc1+0x19bd79a) (BuildId: f32049cda0cd81a36bd1543f6b3b6dcb629abdeb)

Direct leak of 72 byte(s) in 8 object(s) allocated from:
    #0 0x744265ce1359 in __interceptor_malloc /usr/src/debug/gcc/gcc/libsanitizer/asan/asan_malloc_linux.cpp:69
    #1 0x199ac1f in xstrdup (/usr/lib/gcc/x86_64-pc-linux-gnu/13.2.1/cc1+0x199ac1f) (BuildId: f32049cda0cd81a36bd1543f6b3b6dcb629abdeb)
    #2 0x7ffc094d8dff  ([stack]+0x2ddff)

Direct leak of 36 byte(s) in 4 object(s) allocated from:
    #0 0x744265ce1359 in __interceptor_malloc /usr/src/debug/gcc/gcc/libsanitizer/asan/asan_malloc_linux.cpp:69
    #1 0x199ac1f in xstrdup (/usr/lib/gcc/x86_64-pc-linux-gnu/13.2.1/cc1+0x199ac1f) (BuildId: f32049cda0cd81a36bd1543f6b3b6dcb629abdeb)
    #2 0x7ffc094d89ff  ([stack]+0x2d9ff)

Direct leak of 36 byte(s) in 4 object(s) allocated from:
    #0 0x744265ce1359 in __interceptor_malloc /usr/src/debug/gcc/gcc/libsanitizer/asan/asan_malloc_linux.cpp:69
    #1 0x199ac1f in xstrdup (/usr/lib/gcc/x86_64-pc-linux-gnu/13.2.1/cc1+0x199ac1f) (BuildId: f32049cda0cd81a36bd1543f6b3b6dcb629abdeb)
    #2 0x8962ff  (/usr/lib/gcc/x86_64-pc-linux-gnu/13.2.1/cc1+0x8962ff) (BuildId: f32049cda0cd81a36bd1543f6b3b6dcb629abdeb)

Direct leak of 27 byte(s) in 3 object(s) allocated from:
    #0 0x744265ce1359 in __interceptor_malloc /usr/src/debug/gcc/gcc/libsanitizer/asan/asan_malloc_linux.cpp:69
    #1 0x199ac1f in xstrdup (/usr/lib/gcc/x86_64-pc-linux-gnu/13.2.1/cc1+0x199ac1f) (BuildId: f32049cda0cd81a36bd1543f6b3b6dcb629abdeb)
    #2 0x744260cfb3ff  (<unknown module>)

Direct leak of 27 byte(s) in 3 object(s) allocated from:
    #0 0x744265ce1359 in __interceptor_malloc /usr/src/debug/gcc/gcc/libsanitizer/asan/asan_malloc_linux.cpp:69
    #1 0x199ac1f in xstrdup (/usr/lib/gcc/x86_64-pc-linux-gnu/13.2.1/cc1+0x199ac1f) (BuildId: f32049cda0cd81a36bd1543f6b3b6dcb629abdeb)
    #2 0x744260cfbbff  (<unknown module>)

Direct leak of 24 byte(s) in 1 object(s) allocated from:
    #0 0x744265ce1359 in __interceptor_malloc /usr/src/debug/gcc/gcc/libsanitizer/asan/asan_malloc_linux.cpp:69
    #1 0xa66d08  (/usr/lib/gcc/x86_64-pc-linux-gnu/13.2.1/cc1+0xa66d08) (BuildId: f32049cda0cd81a36bd1543f6b3b6dcb629abdeb)

Direct leak of 24 byte(s) in 1 object(s) allocated from:
    #0 0x744265ce1359 in __interceptor_malloc /usr/src/debug/gcc/gcc/libsanitizer/asan/asan_malloc_linux.cpp:69
    #1 0xa460c5 in ipa_register_cgraph_hooks() (/usr/lib/gcc/x86_64-pc-linux-gnu/13.2.1/cc1+0xa460c5) (BuildId: f32049cda0cd81a36bd1543f6b3b6dcb629abdeb)

Direct leak of 24 byte(s) in 1 object(s) allocated from:
    #0 0x744265ce1359 in __interceptor_malloc /usr/src/debug/gcc/gcc/libsanitizer/asan/asan_malloc_linux.cpp:69
    #1 0xa6667a  (/usr/lib/gcc/x86_64-pc-linux-gnu/13.2.1/cc1+0xa6667a) (BuildId: f32049cda0cd81a36bd1543f6b3b6dcb629abdeb)

Direct leak of 20 byte(s) in 2 object(s) allocated from:
    #0 0x744265ce1359 in __interceptor_malloc /usr/src/debug/gcc/gcc/libsanitizer/asan/asan_malloc_linux.cpp:69
    #1 0x199ac1f in xstrdup (/usr/lib/gcc/x86_64-pc-linux-gnu/13.2.1/cc1+0x199ac1f) (BuildId: f32049cda0cd81a36bd1543f6b3b6dcb629abdeb)
    #2 0x890032 in mem_loc_descriptor(rtx_def*, machine_mode, machine_mode, var_init_status) (/usr/lib/gcc/x86_64-pc-linux-gnu/13.2.1/cc1+0x890032) (BuildId: f32049cda0cd81a36bd1543f6b3b6dcb629abdeb)

Direct leak of 20 byte(s) in 2 object(s) allocated from:
    #0 0x744265ce1359 in __interceptor_malloc /usr/src/debug/gcc/gcc/libsanitizer/asan/asan_malloc_linux.cpp:69
    #1 0x199ac1f in xstrdup (/usr/lib/gcc/x86_64-pc-linux-gnu/13.2.1/cc1+0x199ac1f) (BuildId: f32049cda0cd81a36bd1543f6b3b6dcb629abdeb)
    #2 0x890034 in mem_loc_descriptor(rtx_def*, machine_mode, machine_mode, var_init_status) (/usr/lib/gcc/x86_64-pc-linux-gnu/13.2.1/cc1+0x890034) (BuildId: f32049cda0cd81a36bd1543f6b3b6dcb629abdeb)

Direct leak of 18 byte(s) in 2 object(s) allocated from:
    #0 0x744265ce1359 in __interceptor_malloc /usr/src/debug/gcc/gcc/libsanitizer/asan/asan_malloc_linux.cpp:69
    #1 0x199ac1f in xstrdup (/usr/lib/gcc/x86_64-pc-linux-gnu/13.2.1/cc1+0x199ac1f) (BuildId: f32049cda0cd81a36bd1543f6b3b6dcb629abdeb)
    #2 0x744260d82eff  (<unknown module>)

Direct leak of 18 byte(s) in 2 object(s) allocated from:
    #0 0x744265ce1359 in __interceptor_malloc /usr/src/debug/gcc/gcc/libsanitizer/asan/asan_malloc_linux.cpp:69
    #1 0x199ac1f in xstrdup (/usr/lib/gcc/x86_64-pc-linux-gnu/13.2.1/cc1+0x199ac1f) (BuildId: f32049cda0cd81a36bd1543f6b3b6dcb629abdeb)
    #2 0x744260a7bcff  (<unknown module>)

Direct leak of 18 byte(s) in 2 object(s) allocated from:
    #0 0x744265ce1359 in __interceptor_malloc /usr/src/debug/gcc/gcc/libsanitizer/asan/asan_malloc_linux.cpp:69
    #1 0x199ac1f in xstrdup (/usr/lib/gcc/x86_64-pc-linux-gnu/13.2.1/cc1+0x199ac1f) (BuildId: f32049cda0cd81a36bd1543f6b3b6dcb629abdeb)
    #2 0x7442608430ff  (<unknown module>)

Direct leak of 18 byte(s) in 2 object(s) allocated from:
    #0 0x744265ce1359 in __interceptor_malloc /usr/src/debug/gcc/gcc/libsanitizer/asan/asan_malloc_linux.cpp:69
    #1 0x199ac1f in xstrdup (/usr/lib/gcc/x86_64-pc-linux-gnu/13.2.1/cc1+0x199ac1f) (BuildId: f32049cda0cd81a36bd1543f6b3b6dcb629abdeb)
    #2 0x7ffc094d8cff  ([stack]+0x2dcff)

Direct leak of 18 byte(s) in 2 object(s) allocated from:
    #0 0x744265ce1359 in __interceptor_malloc /usr/src/debug/gcc/gcc/libsanitizer/asan/asan_malloc_linux.cpp:69
    #1 0x199ac1f in xstrdup (/usr/lib/gcc/x86_64-pc-linux-gnu/13.2.1/cc1+0x199ac1f) (BuildId: f32049cda0cd81a36bd1543f6b3b6dcb629abdeb)
    #2 0x744260f6a3ff  (<unknown module>)

Direct leak of 18 byte(s) in 2 object(s) allocated from:
    #0 0x744265ce1359 in __interceptor_malloc /usr/src/debug/gcc/gcc/libsanitizer/asan/asan_malloc_linux.cpp:69
    #1 0x199ac1f in xstrdup (/usr/lib/gcc/x86_64-pc-linux-gnu/13.2.1/cc1+0x199ac1f) (BuildId: f32049cda0cd81a36bd1543f6b3b6dcb629abdeb)
    #2 0xefeac7ff  (<unknown module>)

Direct leak of 18 byte(s) in 2 object(s) allocated from:
    #0 0x744265ce1359 in __interceptor_malloc /usr/src/debug/gcc/gcc/libsanitizer/asan/asan_malloc_linux.cpp:69
    #1 0x199ac1f in xstrdup (/usr/lib/gcc/x86_64-pc-linux-gnu/13.2.1/cc1+0x199ac1f) (BuildId: f32049cda0cd81a36bd1543f6b3b6dcb629abdeb)
    #2 0x744260a057ff  (<unknown module>)

Direct leak of 18 byte(s) in 2 object(s) allocated from:
    #0 0x744265ce1359 in __interceptor_malloc /usr/src/debug/gcc/gcc/libsanitizer/asan/asan_malloc_linux.cpp:69
    #1 0x199ac1f in xstrdup (/usr/lib/gcc/x86_64-pc-linux-gnu/13.2.1/cc1+0x199ac1f) (BuildId: f32049cda0cd81a36bd1543f6b3b6dcb629abdeb)
    #2 0x744260a3e7ff  (<unknown module>)

Direct leak of 18 byte(s) in 2 object(s) allocated from:
    #0 0x744265ce1359 in __interceptor_malloc /usr/src/debug/gcc/gcc/libsanitizer/asan/asan_malloc_linux.cpp:69
    #1 0x199ac1f in xstrdup (/usr/lib/gcc/x86_64-pc-linux-gnu/13.2.1/cc1+0x199ac1f) (BuildId: f32049cda0cd81a36bd1543f6b3b6dcb629abdeb)
    #2 0x744260d9faff  (<unknown module>)

Direct leak of 18 byte(s) in 2 object(s) allocated from:
    #0 0x744265ce1359 in __interceptor_malloc /usr/src/debug/gcc/gcc/libsanitizer/asan/asan_malloc_linux.cpp:69
    #1 0x199ac1f in xstrdup (/usr/lib/gcc/x86_64-pc-linux-gnu/13.2.1/cc1+0x199ac1f) (BuildId: f32049cda0cd81a36bd1543f6b3b6dcb629abdeb)
    #2 0x46ff  (<unknown module>)

Direct leak of 18 byte(s) in 2 object(s) allocated from:
    #0 0x744265ce1359 in __interceptor_malloc /usr/src/debug/gcc/gcc/libsanitizer/asan/asan_malloc_linux.cpp:69
    #1 0x199ac1f in xstrdup (/usr/lib/gcc/x86_64-pc-linux-gnu/13.2.1/cc1+0x199ac1f) (BuildId: f32049cda0cd81a36bd1543f6b3b6dcb629abdeb)
    #2 0x744260dcffff  (<unknown module>)

Direct leak of 18 byte(s) in 2 object(s) allocated from:
    #0 0x744265ce1359 in __interceptor_malloc /usr/src/debug/gcc/gcc/libsanitizer/asan/asan_malloc_linux.cpp:69
    #1 0x199ac1f in xstrdup (/usr/lib/gcc/x86_64-pc-linux-gnu/13.2.1/cc1+0x199ac1f) (BuildId: f32049cda0cd81a36bd1543f6b3b6dcb629abdeb)
    #2 0x744260cfbdff  (<unknown module>)

Direct leak of 18 byte(s) in 2 object(s) allocated from:
    #0 0x744265ce1359 in __interceptor_malloc /usr/src/debug/gcc/gcc/libsanitizer/asan/asan_malloc_linux.cpp:69
    #1 0x199ac1f in xstrdup (/usr/lib/gcc/x86_64-pc-linux-gnu/13.2.1/cc1+0x199ac1f) (BuildId: f32049cda0cd81a36bd1543f6b3b6dcb629abdeb)
    #2 0x7442608456ff  (<unknown module>)

Direct leak of 18 byte(s) in 2 object(s) allocated from:
    #0 0x744265ce1359 in __interceptor_malloc /usr/src/debug/gcc/gcc/libsanitizer/asan/asan_malloc_linux.cpp:69
    #1 0x199ac1f in xstrdup (/usr/lib/gcc/x86_64-pc-linux-gnu/13.2.1/cc1+0x199ac1f) (BuildId: f32049cda0cd81a36bd1543f6b3b6dcb629abdeb)
    #2 0x7442617123ff  (<unknown module>)

Direct leak of 16 byte(s) in 2 object(s) allocated from:
    #0 0x744265ce1359 in __interceptor_malloc /usr/src/debug/gcc/gcc/libsanitizer/asan/asan_malloc_linux.cpp:69
    #1 0x199ac1f in xstrdup (/usr/lib/gcc/x86_64-pc-linux-gnu/13.2.1/cc1+0x199ac1f) (BuildId: f32049cda0cd81a36bd1543f6b3b6dcb629abdeb)
    #2 0x8963fa  (/usr/lib/gcc/x86_64-pc-linux-gnu/13.2.1/cc1+0x8963fa) (BuildId: f32049cda0cd81a36bd1543f6b3b6dcb629abdeb)

Direct leak of 15 byte(s) in 1 object(s) allocated from:
    #0 0x744265ce1359 in __interceptor_malloc /usr/src/debug/gcc/gcc/libsanitizer/asan/asan_malloc_linux.cpp:69
    #1 0x199ac1f in xstrdup (/usr/lib/gcc/x86_64-pc-linux-gnu/13.2.1/cc1+0x199ac1f) (BuildId: f32049cda0cd81a36bd1543f6b3b6dcb629abdeb)
    #2 0x30656e696c5e  (<unknown module>)

Direct leak of 14 byte(s) in 2 object(s) allocated from:
    #0 0x744265ce1359 in __interceptor_malloc /usr/src/debug/gcc/gcc/libsanitizer/asan/asan_malloc_linux.cpp:69
    #1 0x199ac1f in xstrdup (/usr/lib/gcc/x86_64-pc-linux-gnu/13.2.1/cc1+0x199ac1f) (BuildId: f32049cda0cd81a36bd1543f6b3b6dcb629abdeb)
    #2 0x744260f6a47f  (<unknown module>)

Direct leak of 14 byte(s) in 2 object(s) allocated from:
    #0 0x744265ce1359 in __interceptor_malloc /usr/src/debug/gcc/gcc/libsanitizer/asan/asan_malloc_linux.cpp:69
    #1 0x199ac1f in xstrdup (/usr/lib/gcc/x86_64-pc-linux-gnu/13.2.1/cc1+0x199ac1f) (BuildId: f32049cda0cd81a36bd1543f6b3b6dcb629abdeb)
    #2 0x8b518a  (/usr/lib/gcc/x86_64-pc-linux-gnu/13.2.1/cc1+0x8b518a) (BuildId: f32049cda0cd81a36bd1543f6b3b6dcb629abdeb)

Direct leak of 10 byte(s) in 1 object(s) allocated from:
    #0 0x744265ce1359 in __interceptor_malloc /usr/src/debug/gcc/gcc/libsanitizer/asan/asan_malloc_linux.cpp:69
    #1 0x199ac1f in xstrdup (/usr/lib/gcc/x86_64-pc-linux-gnu/13.2.1/cc1+0x199ac1f) (BuildId: f32049cda0cd81a36bd1543f6b3b6dcb629abdeb)
    #2 0x744261a20036  (<unknown module>)

Direct leak of 10 byte(s) in 1 object(s) allocated from:
    #0 0x744265ce1359 in __interceptor_malloc /usr/src/debug/gcc/gcc/libsanitizer/asan/asan_malloc_linux.cpp:69
    #1 0x199ac1f in xstrdup (/usr/lib/gcc/x86_64-pc-linux-gnu/13.2.1/cc1+0x199ac1f) (BuildId: f32049cda0cd81a36bd1543f6b3b6dcb629abdeb)
    #2 0x744260d30035  (<unknown module>)

Direct leak of 10 byte(s) in 1 object(s) allocated from:
    #0 0x744265ce1359 in __interceptor_malloc /usr/src/debug/gcc/gcc/libsanitizer/asan/asan_malloc_linux.cpp:69
    #1 0x199ac1f in xstrdup (/usr/lib/gcc/x86_64-pc-linux-gnu/13.2.1/cc1+0x199ac1f) (BuildId: f32049cda0cd81a36bd1543f6b3b6dcb629abdeb)
    #2 0x744260cb0037  (<unknown module>)

Direct leak of 10 byte(s) in 1 object(s) allocated from:
    #0 0x744265ce1359 in __interceptor_malloc /usr/src/debug/gcc/gcc/libsanitizer/asan/asan_malloc_linux.cpp:69
    #1 0x199ac1f in xstrdup (/usr/lib/gcc/x86_64-pc-linux-gnu/13.2.1/cc1+0x199ac1f) (BuildId: f32049cda0cd81a36bd1543f6b3b6dcb629abdeb)
    #2 0x744260cb0035  (<unknown module>)

Direct leak of 10 byte(s) in 1 object(s) allocated from:
    #0 0x744265ce1359 in __interceptor_malloc /usr/src/debug/gcc/gcc/libsanitizer/asan/asan_malloc_linux.cpp:69
    #1 0x199ac1f in xstrdup (/usr/lib/gcc/x86_64-pc-linux-gnu/13.2.1/cc1+0x199ac1f) (BuildId: f32049cda0cd81a36bd1543f6b3b6dcb629abdeb)
    #2 0x744260cb002f  (<unknown module>)

Direct leak of 9 byte(s) in 1 object(s) allocated from:
    #0 0x744265ce1359 in __interceptor_malloc /usr/src/debug/gcc/gcc/libsanitizer/asan/asan_malloc_linux.cpp:69
    #1 0x199ac1f in xstrdup (/usr/lib/gcc/x86_64-pc-linux-gnu/13.2.1/cc1+0x199ac1f) (BuildId: f32049cda0cd81a36bd1543f6b3b6dcb629abdeb)
    #2 0x744260d3a0ff  (<unknown module>)

Direct leak of 9 byte(s) in 1 object(s) allocated from:
    #0 0x744265ce1359 in __interceptor_malloc /usr/src/debug/gcc/gcc/libsanitizer/asan/asan_malloc_linux.cpp:69
    #1 0x199ac1f in xstrdup (/usr/lib/gcc/x86_64-pc-linux-gnu/13.2.1/cc1+0x199ac1f) (BuildId: f32049cda0cd81a36bd1543f6b3b6dcb629abdeb)
    #2 0x744260c945ff  (<unknown module>)

Direct leak of 9 byte(s) in 1 object(s) allocated from:
    #0 0x744265ce1359 in __interceptor_malloc /usr/src/debug/gcc/gcc/libsanitizer/asan/asan_malloc_linux.cpp:69
    #1 0x199ac1f in xstrdup (/usr/lib/gcc/x86_64-pc-linux-gnu/13.2.1/cc1+0x199ac1f) (BuildId: f32049cda0cd81a36bd1543f6b3b6dcb629abdeb)
    #2 0x744260d39fff  (<unknown module>)

Direct leak of 9 byte(s) in 1 object(s) allocated from:
    #0 0x744265ce1359 in __interceptor_malloc /usr/src/debug/gcc/gcc/libsanitizer/asan/asan_malloc_linux.cpp:69
    #1 0x199ac1f in xstrdup (/usr/lib/gcc/x86_64-pc-linux-gnu/13.2.1/cc1+0x199ac1f) (BuildId: f32049cda0cd81a36bd1543f6b3b6dcb629abdeb)
    #2 0x744260cb53ff  (<unknown module>)

Direct leak of 9 byte(s) in 1 object(s) allocated from:
    #0 0x744265ce1359 in __interceptor_malloc /usr/src/debug/gcc/gcc/libsanitizer/asan/asan_malloc_linux.cpp:69
    #1 0x199ac1f in xstrdup (/usr/lib/gcc/x86_64-pc-linux-gnu/13.2.1/cc1+0x199ac1f) (BuildId: f32049cda0cd81a36bd1543f6b3b6dcb629abdeb)
    #2 0x8b50ff  (/usr/lib/gcc/x86_64-pc-linux-gnu/13.2.1/cc1+0x8b50ff) (BuildId: f32049cda0cd81a36bd1543f6b3b6dcb629abdeb)

Direct leak of 9 byte(s) in 1 object(s) allocated from:
    #0 0x744265ce1359 in __interceptor_malloc /usr/src/debug/gcc/gcc/libsanitizer/asan/asan_malloc_linux.cpp:69
    #1 0x199ac1f in xstrdup (/usr/lib/gcc/x86_64-pc-linux-gnu/13.2.1/cc1+0x199ac1f) (BuildId: f32049cda0cd81a36bd1543f6b3b6dcb629abdeb)
    #2 0x8b1cff  (/usr/lib/gcc/x86_64-pc-linux-gnu/13.2.1/cc1+0x8b1cff) (BuildId: f32049cda0cd81a36bd1543f6b3b6dcb629abdeb)

Direct leak of 9 byte(s) in 1 object(s) allocated from:
    #0 0x744265ce1359 in __interceptor_malloc /usr/src/debug/gcc/gcc/libsanitizer/asan/asan_malloc_linux.cpp:69
    #1 0x199ac1f in xstrdup (/usr/lib/gcc/x86_64-pc-linux-gnu/13.2.1/cc1+0x199ac1f) (BuildId: f32049cda0cd81a36bd1543f6b3b6dcb629abdeb)
    #2 0x744260d57bff  (<unknown module>)

Direct leak of 9 byte(s) in 1 object(s) allocated from:
    #0 0x744265ce1359 in __interceptor_malloc /usr/src/debug/gcc/gcc/libsanitizer/asan/asan_malloc_linux.cpp:69
    #1 0x199ac1f in xstrdup (/usr/lib/gcc/x86_64-pc-linux-gnu/13.2.1/cc1+0x199ac1f) (BuildId: f32049cda0cd81a36bd1543f6b3b6dcb629abdeb)
    #2 0x744260dd4bff  (<unknown module>)

Direct leak of 9 byte(s) in 1 object(s) allocated from:
    #0 0x744265ce1359 in __interceptor_malloc /usr/src/debug/gcc/gcc/libsanitizer/asan/asan_malloc_linux.cpp:69
    #1 0x199ac1f in xstrdup (/usr/lib/gcc/x86_64-pc-linux-gnu/13.2.1/cc1+0x199ac1f) (BuildId: f32049cda0cd81a36bd1543f6b3b6dcb629abdeb)
    #2 0x744260cc7aff  (<unknown module>)

Direct leak of 9 byte(s) in 1 object(s) allocated from:
    #0 0x744265ce1359 in __interceptor_malloc /usr/src/debug/gcc/gcc/libsanitizer/asan/asan_malloc_linux.cpp:69
    #1 0x199ac1f in xstrdup (/usr/lib/gcc/x86_64-pc-linux-gnu/13.2.1/cc1+0x199ac1f) (BuildId: f32049cda0cd81a36bd1543f6b3b6dcb629abdeb)
    #2 0x744260cc78ff  (<unknown module>)

Direct leak of 9 byte(s) in 1 object(s) allocated from:
    #0 0x744265ce1359 in __interceptor_malloc /usr/src/debug/gcc/gcc/libsanitizer/asan/asan_malloc_linux.cpp:69
    #1 0x199ac1f in xstrdup (/usr/lib/gcc/x86_64-pc-linux-gnu/13.2.1/cc1+0x199ac1f) (BuildId: f32049cda0cd81a36bd1543f6b3b6dcb629abdeb)
    #2 0x744260cadeff  (<unknown module>)

Direct leak of 9 byte(s) in 1 object(s) allocated from:
    #0 0x744265ce1359 in __interceptor_malloc /usr/src/debug/gcc/gcc/libsanitizer/asan/asan_malloc_linux.cpp:69
    #1 0x199ac1f in xstrdup (/usr/lib/gcc/x86_64-pc-linux-gnu/13.2.1/cc1+0x199ac1f) (BuildId: f32049cda0cd81a36bd1543f6b3b6dcb629abdeb)
    #2 0x744260ca51ff  (<unknown module>)

Direct leak of 8 byte(s) in 1 object(s) allocated from:
    #0 0x744265ce1359 in __interceptor_malloc /usr/src/debug/gcc/gcc/libsanitizer/asan/asan_malloc_linux.cpp:69
    #1 0x199ac1f in xstrdup (/usr/lib/gcc/x86_64-pc-linux-gnu/13.2.1/cc1+0x199ac1f) (BuildId: f32049cda0cd81a36bd1543f6b3b6dcb629abdeb)
    #2 0x744260d3a3bf  (<unknown module>)

Direct leak of 8 byte(s) in 1 object(s) allocated from:
    #0 0x744265ce1359 in __interceptor_malloc /usr/src/debug/gcc/gcc/libsanitizer/asan/asan_malloc_linux.cpp:69
    #1 0x199ac1f in xstrdup (/usr/lib/gcc/x86_64-pc-linux-gnu/13.2.1/cc1+0x199ac1f) (BuildId: f32049cda0cd81a36bd1543f6b3b6dcb629abdeb)
    #2 0x744260d0341f  (<unknown module>)

Direct leak of 8 byte(s) in 1 object(s) allocated from:
    #0 0x744265ce1359 in __interceptor_malloc /usr/src/debug/gcc/gcc/libsanitizer/asan/asan_malloc_linux.cpp:69
    #1 0x199ac1f in xstrdup (/usr/lib/gcc/x86_64-pc-linux-gnu/13.2.1/cc1+0x199ac1f) (BuildId: f32049cda0cd81a36bd1543f6b3b6dcb629abdeb)
    #2 0x744260d0343f  (<unknown module>)

Direct leak of 7 byte(s) in 1 object(s) allocated from:
    #0 0x744265ce1359 in __interceptor_malloc /usr/src/debug/gcc/gcc/libsanitizer/asan/asan_malloc_linux.cpp:69
    #1 0x199ac1f in xstrdup (/usr/lib/gcc/x86_64-pc-linux-gnu/13.2.1/cc1+0x199ac1f) (BuildId: f32049cda0cd81a36bd1543f6b3b6dcb629abdeb)
    #2 0x744260f6a37f  (<unknown module>)

Indirect leak of 261992 byte(s) in 1 object(s) allocated from:
    #0 0x744265ce0cc1 in __interceptor_calloc /usr/src/debug/gcc/gcc/libsanitizer/asan/asan_malloc_linux.cpp:77
    #1 0x199a6b5 in xcalloc (/usr/lib/gcc/x86_64-pc-linux-gnu/13.2.1/cc1+0x199a6b5) (BuildId: f32049cda0cd81a36bd1543f6b3b6dcb629abdeb)

Indirect leak of 2168 byte(s) in 1 object(s) allocated from:
    #0 0x744265ce007a in __interceptor_realloc /usr/src/debug/gcc/gcc/libsanitizer/asan/asan_malloc_linux.cpp:85
    #1 0x7fbf1d in symtab_node::create_reference(symtab_node*, ipa_ref_use, gimple*) (/usr/lib/gcc/x86_64-pc-linux-gnu/13.2.1/cc1+0x7fbf1d) (BuildId: f32049cda0cd81a36bd1543f6b3b6dcb629abdeb)

Indirect leak of 336 byte(s) in 2 object(s) allocated from:
    #0 0x744265ce1359 in __interceptor_malloc /usr/src/debug/gcc/gcc/libsanitizer/asan/asan_malloc_linux.cpp:69
    #1 0x7fbd58 in symtab_node::create_reference(symtab_node*, ipa_ref_use, gimple*) (/usr/lib/gcc/x86_64-pc-linux-gnu/13.2.1/cc1+0x7fbd58) (BuildId: f32049cda0cd81a36bd1543f6b3b6dcb629abdeb)

Indirect leak of 24 byte(s) in 1 object(s) allocated from:
    #0 0x744265ce1359 in __interceptor_malloc /usr/src/debug/gcc/gcc/libsanitizer/asan/asan_malloc_linux.cpp:69
    #1 0xa66628  (/usr/lib/gcc/x86_64-pc-linux-gnu/13.2.1/cc1+0xa66628) (BuildId: f32049cda0cd81a36bd1543f6b3b6dcb629abdeb)

Indirect leak of 24 byte(s) in 1 object(s) allocated from:
    #0 0x744265ce1359 in __interceptor_malloc /usr/src/debug/gcc/gcc/libsanitizer/asan/asan_malloc_linux.cpp:69
    #1 0x16c7c75 in clone_info::get_create(cgraph_node*) (/usr/lib/gcc/x86_64-pc-linux-gnu/13.2.1/cc1+0x16c7c75) (BuildId: f32049cda0cd81a36bd1543f6b3b6dcb629abdeb)

Indirect leak of 24 byte(s) in 1 object(s) allocated from:
    #0 0x744265ce1359 in __interceptor_malloc /usr/src/debug/gcc/gcc/libsanitizer/asan/asan_malloc_linux.cpp:69
    #1 0xa46576 in ipcp_transformation_initialize() (/usr/lib/gcc/x86_64-pc-linux-gnu/13.2.1/cc1+0xa46576) (BuildId: f32049cda0cd81a36bd1543f6b3b6dcb629abdeb)

Indirect leak of 24 byte(s) in 1 object(s) allocated from:
    #0 0x744265ce1359 in __interceptor_malloc /usr/src/debug/gcc/gcc/libsanitizer/asan/asan_malloc_linux.cpp:69
    #1 0xa46435 in ipcp_transformation_initialize() (/usr/lib/gcc/x86_64-pc-linux-gnu/13.2.1/cc1+0xa46435) (BuildId: f32049cda0cd81a36bd1543f6b3b6dcb629abdeb)

SUMMARY: AddressSanitizer: 280743 byte(s) leaked in 1282 allocation(s).

=================================================================
==12102==ERROR: LeakSanitizer: detected memory leaks

Direct leak of 286 byte(s) in 4 object(s) allocated from:
    #0 0x7ae19e6e1359 in __interceptor_malloc /usr/src/debug/gcc/gcc/libsanitizer/asan/asan_malloc_linux.cpp:69
    #1 0x457327  (/usr/bin/gcc+0x457327) (BuildId: 7392cfd0fa10a20584133c316cc717abc268fd55)

Direct leak of 176 byte(s) in 2 object(s) allocated from:
    #0 0x7ae19e6e1359 in __interceptor_malloc /usr/src/debug/gcc/gcc/libsanitizer/asan/asan_malloc_linux.cpp:69
    #1 0x414672  (/usr/bin/gcc+0x414672) (BuildId: 7392cfd0fa10a20584133c316cc717abc268fd55)

Direct leak of 88 byte(s) in 1 object(s) allocated from:
    #0 0x7ae19e6e1359 in __interceptor_malloc /usr/src/debug/gcc/gcc/libsanitizer/asan/asan_malloc_linux.cpp:69
    #1 0x409b18  (/usr/bin/gcc+0x409b18) (BuildId: 7392cfd0fa10a20584133c316cc717abc268fd55)

Direct leak of 16 byte(s) in 1 object(s) allocated from:
    #0 0x7ae19e6e1359 in __interceptor_malloc /usr/src/debug/gcc/gcc/libsanitizer/asan/asan_malloc_linux.cpp:69
    #1 0x40cb42  (/usr/bin/gcc+0x40cb42) (BuildId: 7392cfd0fa10a20584133c316cc717abc268fd55)

Indirect leak of 16 byte(s) in 1 object(s) allocated from:
    #0 0x7ae19e6e1359 in __interceptor_malloc /usr/src/debug/gcc/gcc/libsanitizer/asan/asan_malloc_linux.cpp:69
    #1 0x4579ff  (/usr/bin/gcc+0x4579ff) (BuildId: 7392cfd0fa10a20584133c316cc717abc268fd55)

SUMMARY: AddressSanitizer: 582 byte(s) leaked in 9 allocation(s).
error: command '/usr/bin/gcc' failed with exit code 1

from cython.

da-woods avatar da-woods commented on June 1, 2024

You're not looking for leaks so can ignore them as in https://stackoverflow.com/a/51061314/

from cython.

YoSTEALTH avatar YoSTEALTH commented on June 1, 2024

I am having no luck tracking down the bug. Would you mind looking at https://github.com/YoSTEALTH/Shakti/actions/runs/9293027524/job/25575275512 I am not sure who else I can ask to help with this! #Python #C not much help when it comes to Cython.

Just simply running async function gives segfault! doesn't make much sense.

async def nope_test():
    print('nope_test()')


shakti.run(
    nope_test(),
    nope_test(),
    nope_test(),
    nope_test(),
    nope_test(),
    nope_test(),
    nope_test(),
    nope_test(),
    nope_test(),
    nope_test(),
    nope_test(),
    nope_test(),
    nope_test(),
    nope_test(),
    nope_test(),
    nope_test(),
    nope_test(),
    nope_test()
)

# Fatal Python error: Segmentation fault

# Current thread 0x0000746ae74d0740 (most recent call first):
#   Garbage-collecting
#   <no Python frame>

# Extension modules: liburing.error, liburing.queue, liburing.time, liburing.os, liburing.version, liburing._test, liburing.helper, liburing.common, liburing.register, liburing.futex, liburing.file, liburing.syscall, liburing.xattr, liburing.statx, liburing.poll, liburing.socket, liburing.socket_extra, liburing.probe, liburing.other, shakti.event.entry, shakti.event.sleep, shakti.event.run, shakti.core.base, shakti.lib.time, shakti.os._test, shakti.os.random, shakti.os.rename, shakti.os.mkdir, shakti.os.remove, shakti.io.file, shakti.io.statx, shakti.io.socket (total: 32)

from cython.

YoSTEALTH avatar YoSTEALTH commented on June 1, 2024

Using Valgrind to run above gives me:


==14783== Memcheck, a memory error detector
==14783== Copyright (C) 2002-2024, and GNU GPL'd, by Julian Seward et al.
==14783== Using Valgrind-3.23.0 and LibVEX; rerun with -h for copyright info
==14783== Command: /opt/python/3.13/bin/python3 _3.py
==14783== Parent PID: 14781
==14783== 
==14783== Invalid read of size 8
==14783==    at 0x3A8ACB: block_free (pyarena.c:95)
==14783==    by 0x3A8ACB: _PyArena_Free (pyarena.c:170)
==14783==    by 0x3B51D3: pyrun_file (pythonrun.c:1215)
==14783==    by 0x3B51D3: _PyRun_SimpleFileObject (pythonrun.c:459)
==14783==    by 0x3B57AB: _PyRun_AnyFileObject (pythonrun.c:77)
==14783==    by 0x3DF700: pymain_run_file_obj (main.c:357)
==14783==    by 0x3DF700: pymain_run_file (main.c:376)
==14783==    by 0x3DF700: pymain_run_python.constprop.0 (main.c:639)
==14783==    by 0x3DFDE9: Py_RunMain (main.c:718)
==14783==    by 0x3DFDE9: pymain_main (main.c:748)
==14783==    by 0x3DFDE9: Py_BytesMain (main.c:772)
==14783==    by 0x49A4C87: (below main) (libc_start_call_main.h:58)
==14783==  Address 0x7fc792f25120 is not stack'd, malloc'd or (recently) free'd
==14783== 
==14783== 
==14783== Process terminating with default action of signal 11 (SIGSEGV): dumping core
==14783==  Access not within mapped region at address 0x7FC792F25120
==14783==    at 0x3A8ACB: block_free (pyarena.c:95)
==14783==    by 0x3A8ACB: _PyArena_Free (pyarena.c:170)
==14783==    by 0x3B51D3: pyrun_file (pythonrun.c:1215)
==14783==    by 0x3B51D3: _PyRun_SimpleFileObject (pythonrun.c:459)
==14783==    by 0x3B57AB: _PyRun_AnyFileObject (pythonrun.c:77)
==14783==    by 0x3DF700: pymain_run_file_obj (main.c:357)
==14783==    by 0x3DF700: pymain_run_file (main.c:376)
==14783==    by 0x3DF700: pymain_run_python.constprop.0 (main.c:639)
==14783==    by 0x3DFDE9: Py_RunMain (main.c:718)
==14783==    by 0x3DFDE9: pymain_main (main.c:748)
==14783==    by 0x3DFDE9: Py_BytesMain (main.c:772)
==14783==    by 0x49A4C87: (below main) (libc_start_call_main.h:58)
==14783==  If you believe this happened as a result of a stack
==14783==  overflow in your program's main thread (unlikely but
==14783==  possible), you can try to increase the size of the
==14783==  main thread stack using the --main-stacksize= flag.
==14783==  The main thread stack size used in this run was 8388608.
==14783== 
==14783== HEAP SUMMARY:
==14783==     in use at exit: 2,118,903 bytes in 2,532 blocks
==14783==   total heap usage: 5,203 allocs, 2,671 frees, 7,648,034 bytes allocated
==14783== 
==14783== 1 bytes in 1 blocks are definitely lost in loss record 3 of 1,521
==14783==    at 0x4842788: malloc (vg_replace_malloc.c:446)
==14783==    by 0x27CB7F: PyMem_RawMalloc (obmalloc.c:940)
==14783==    by 0x27CB7F: _PyObject_Malloc (obmalloc.c:2132)
==14783==    by 0x25B3BC: PyModule_ExecDef (moduleobject.c:470)
==14783==    by 0x386CEA: exec_builtin_or_dynamic (import.c:873)
==14783==    by 0x386CEA: _imp_exec_dynamic_impl (import.c:4773)
==14783==    by 0x386CEA: _imp_exec_dynamic (import.c.h:513)
==14783==    by 0x258A5A: cfunction_vectorcall_O (methodobject.c:512)
==14783==    by 0x1896CB: _PyEval_EvalFrameDefault (generated_cases.c.h:1353)
==14783==    by 0x34A08C: _PyEval_EvalFrame (pycore_ceval.h:119)
==14783==    by 0x34A08C: _PyEval_Vector (ceval.c:1818)
==14783==    by 0x34A08C: PyEval_EvalCode (ceval.c:598)
==14783==    by 0x3449A8: builtin_exec_impl (bltinmodule.c:1145)
==14783==    by 0x3449A8: builtin_exec (bltinmodule.c.h:556)
==14783==    by 0x258EDE: cfunction_vectorcall_FASTCALL_KEYWORDS (methodobject.c:441)
==14783==    by 0x1896CB: _PyEval_EvalFrameDefault (generated_cases.c.h:1353)
==14783==    by 0x1F3956: _PyObject_VectorcallTstate (pycore_call.h:168)
==14783==    by 0x1F3956: object_vacall (call.c:819)
==14783==    by 0x1F4F74: PyObject_CallMethodObjArgs (call.c:880)
==14783== 
==14783== 520 bytes in 1 blocks are possibly lost in loss record 1,013 of 1,521
==14783==    at 0x4842788: malloc (vg_replace_malloc.c:446)
==14783==    by 0x27CB7F: PyMem_RawMalloc (obmalloc.c:940)
==14783==    by 0x27CB7F: _PyObject_Malloc (obmalloc.c:2132)
==14783==    by 0x3796E4: _PyObject_MallocWithType (pycore_object_alloc.h:46)
==14783==    by 0x3796E4: gc_alloc (gc.c:2022)
==14783==    by 0x3796E4: _PyObject_GC_NewVar (gc.c:2061)
==14783==    by 0x289BE7: PyTuple_New (tupleobject.c:76)
==14783==    by 0x289BE7: PyTuple_New (tupleobject.c:70)
==14783==    by 0x3A07CC: r_object (marshal.c:1243)
==14783==    by 0x3A0A37: r_object (marshal.c:1428)
==14783==    by 0x3A07F4: r_object (marshal.c:1249)
==14783==    by 0x3A0A1E: r_object (marshal.c:1425)
==14783==    by 0x3A07F4: r_object (marshal.c:1249)
==14783==    by 0x3A0A1E: r_object (marshal.c:1425)
==14783==    by 0x3A2B27: read_object (marshal.c:1556)
==14783==    by 0x3A2CB8: marshal_loads_impl (marshal.c:1899)
==14783==    by 0x3A2CB8: marshal_loads (marshal.c.h:332)
==14783== 
==14783== 600 bytes in 1 blocks are possibly lost in loss record 1,030 of 1,521
==14783==    at 0x4842788: malloc (vg_replace_malloc.c:446)
==14783==    by 0x27CB7F: PyMem_RawMalloc (obmalloc.c:940)
==14783==    by 0x27CB7F: _PyObject_Malloc (obmalloc.c:2132)
==14783==    by 0x3796E4: _PyObject_MallocWithType (pycore_object_alloc.h:46)
==14783==    by 0x3796E4: gc_alloc (gc.c:2022)
==14783==    by 0x3796E4: _PyObject_GC_NewVar (gc.c:2061)
==14783==    by 0x289BE7: PyTuple_New (tupleobject.c:76)
==14783==    by 0x289BE7: PyTuple_New (tupleobject.c:70)
==14783==    by 0x3A07CC: r_object (marshal.c:1243)
==14783==    by 0x3A0A37: r_object (marshal.c:1428)
==14783==    by 0x3A07F4: r_object (marshal.c:1249)
==14783==    by 0x3A0A1E: r_object (marshal.c:1425)
==14783==    by 0x3A2B27: read_object (marshal.c:1556)
==14783==    by 0x3A2CB8: marshal_loads_impl (marshal.c:1899)
==14783==    by 0x3A2CB8: marshal_loads (marshal.c.h:332)
==14783==    by 0x18E825: _PyEval_EvalFrameDefault (generated_cases.c.h:1215)
==14783==    by 0x1F3956: _PyObject_VectorcallTstate (pycore_call.h:168)
==14783==    by 0x1F3956: object_vacall (call.c:819)
==14783== 
==14783== 4,608 bytes in 2 blocks are possibly lost in loss record 1,469 of 1,521
==14783==    at 0x4842788: malloc (vg_replace_malloc.c:446)
==14783==    by 0x4004A8D: malloc (rtld-malloc.h:56)
==14783==    by 0x4004A8D: _dlfo_mappings_segment_allocate (dl-find_object.c:217)
==14783==    by 0x4004A8D: _dl_find_object_update_1 (dl-find_object.c:671)
==14783==    by 0x4004A8D: _dl_find_object_update (dl-find_object.c:805)
==14783==    by 0x400CD1F: dl_open_worker_begin (dl-open.c:756)
==14783==    by 0x4001522: _dl_catch_exception (dl-catch.c:237)
==14783==    by 0x400C0DF: dl_open_worker (dl-open.c:803)
==14783==    by 0x4001522: _dl_catch_exception (dl-catch.c:237)
==14783==    by 0x400C533: _dl_open (dl-open.c:905)
==14783==    by 0x4A0D9E3: dlopen_doit (dlopen.c:56)
==14783==    by 0x4001522: _dl_catch_exception (dl-catch.c:237)
==14783==    by 0x4001678: _dl_catch_error (dl-catch.c:256)
==14783==    by 0x4A0D4C2: _dlerror_run (dlerror.c:138)
==14783==    by 0x4A0DA9E: dlopen_implementation (dlopen.c:71)
==14783==    by 0x4A0DA9E: dlopen@@GLIBC_2.34 (dlopen.c:81)
==14783== 
==14783== 5,296 bytes in 1 blocks are possibly lost in loss record 1,473 of 1,521
==14783==    at 0x4842788: malloc (vg_replace_malloc.c:446)
==14783==    by 0x27CB7F: PyMem_RawMalloc (obmalloc.c:940)
==14783==    by 0x27CB7F: _PyObject_Malloc (obmalloc.c:2132)
==14783==    by 0x3796E4: _PyObject_MallocWithType (pycore_object_alloc.h:46)
==14783==    by 0x3796E4: gc_alloc (gc.c:2022)
==14783==    by 0x3796E4: _PyObject_GC_NewVar (gc.c:2061)
==14783==    by 0x289493: _PyTuple_FromArray.part.0 (tupleobject.c:380)
==14783==    by 0x18D400: _PyEval_EvalFrameDefault (generated_cases.c.h:1374)
==14783==    by 0x1F625F: _PyObject_VectorcallDictTstate (call.c:135)
==14783==    by 0x1F625F: _PyObject_Call_Prepend (call.c:504)
==14783==    by 0x29D941: slot_tp_init (typeobject.c:9646)
==14783==    by 0x2906F6: type_call (typeobject.c:1909)
==14783==    by 0x1F3503: _PyObject_MakeTpCall (call.c:242)
==14783==    by 0x18AA2D: _PyEval_EvalFrameDefault (generated_cases.c.h:813)
==14783==    by 0x34A08C: _PyEval_EvalFrame (pycore_ceval.h:119)
==14783==    by 0x34A08C: _PyEval_Vector (ceval.c:1818)
==14783==    by 0x34A08C: PyEval_EvalCode (ceval.c:598)
==14783==    by 0x3449A8: builtin_exec_impl (bltinmodule.c:1145)
==14783==    by 0x3449A8: builtin_exec (bltinmodule.c.h:556)
==14783== 
==14783== 8,224 bytes in 1 blocks are possibly lost in loss record 1,483 of 1,521
==14783==    at 0x4842788: malloc (vg_replace_malloc.c:446)
==14783==    by 0x27CB7F: PyMem_RawMalloc (obmalloc.c:940)
==14783==    by 0x27CB7F: _PyObject_Malloc (obmalloc.c:2132)
==14783==    by 0x3A8A11: block_new (pyarena.c:81)
==14783==    by 0x3A8A11: _PyArena_New (pyarena.c:135)
==14783==    by 0x3B5155: pyrun_file (pythonrun.c:1195)
==14783==    by 0x3B5155: _PyRun_SimpleFileObject (pythonrun.c:459)
==14783==    by 0x3B57AB: _PyRun_AnyFileObject (pythonrun.c:77)
==14783==    by 0x3DF700: pymain_run_file_obj (main.c:357)
==14783==    by 0x3DF700: pymain_run_file (main.c:376)
==14783==    by 0x3DF700: pymain_run_python.constprop.0 (main.c:639)
==14783==    by 0x3DFDE9: Py_RunMain (main.c:718)
==14783==    by 0x3DFDE9: pymain_main (main.c:748)
==14783==    by 0x3DFDE9: Py_BytesMain (main.c:772)
==14783==    by 0x49A4C87: (below main) (libc_start_call_main.h:58)
==14783== 
==14783== 8,224 bytes in 1 blocks are possibly lost in loss record 1,484 of 1,521
==14783==    at 0x4842788: malloc (vg_replace_malloc.c:446)
==14783==    by 0x27CB7F: PyMem_RawMalloc (obmalloc.c:940)
==14783==    by 0x27CB7F: _PyObject_Malloc (obmalloc.c:2132)
==14783==    by 0x3A8B8F: block_new (pyarena.c:81)
==14783==    by 0x3A8B8F: block_alloc (pyarena.c:112)
==14783==    by 0x3A8B8F: _PyArena_Malloc (pyarena.c:183)
==14783==    by 0x195613: _PyPegen_insert_memo (pegen.c:54)
==14783==    by 0x1A4934: conjunction_rule (parser.c:12086)
==14783==    by 0x1A4B04: disjunction_rule (parser.c:11950)
==14783==    by 0x1A511C: expression_rule (parser.c:11238)
==14783==    by 0x1AE0C1: _tmp_122_rule (parser.c:33162)
==14783==    by 0x1B5A96: genexp_rule (parser.c:17396)
==14783==    by 0x1A17FB: primary_raw (parser.c:14405)
==14783==    by 0x1A17FB: primary_rule (parser.c:14320)
==14783==    by 0x1A1C67: await_primary_rule (parser.c:14274)
==14783==    by 0x1A1F99: power_rule (parser.c:14150)
==14783==    by 0x1A1F99: factor_rule (parser.c:14100)
==14783== 
==14783== 8,224 bytes in 1 blocks are possibly lost in loss record 1,485 of 1,521
==14783==    at 0x4842788: malloc (vg_replace_malloc.c:446)
==14783==    by 0x27CB7F: PyMem_RawMalloc (obmalloc.c:940)
==14783==    by 0x27CB7F: _PyObject_Malloc (obmalloc.c:2132)
==14783==    by 0x3A8B8F: block_new (pyarena.c:81)
==14783==    by 0x3A8B8F: block_alloc (pyarena.c:112)
==14783==    by 0x3A8B8F: _PyArena_Malloc (pyarena.c:183)
==14783==    by 0x1956B5: _PyPegen_insert_memo (pegen.c:54)
==14783==    by 0x1956B5: _PyPegen_update_memo (pegen.c:79)
==14783==    by 0x1A376E: bitwise_or_rule (parser.c:12964)
==14783==    by 0x1A3B4D: comparison_rule (parser.c:12210)
==14783==    by 0x1A3B4D: inversion_rule (parser.c:12161)
==14783==    by 0x1A46E4: conjunction_rule (parser.c:12038)
==14783==    by 0x1A4B04: disjunction_rule (parser.c:11950)
==14783==    by 0x1A511C: expression_rule (parser.c:11238)
==14783==    by 0x1AE0C1: _tmp_122_rule (parser.c:33162)
==14783==    by 0x1B5A96: genexp_rule (parser.c:17396)
==14783==    by 0x1A17FB: primary_raw (parser.c:14405)
==14783==    by 0x1A17FB: primary_rule (parser.c:14320)
==14783== 
==14783== 8,224 bytes in 1 blocks are possibly lost in loss record 1,486 of 1,521
==14783==    at 0x4842788: malloc (vg_replace_malloc.c:446)
==14783==    by 0x27CB7F: PyMem_RawMalloc (obmalloc.c:940)
==14783==    by 0x27CB7F: _PyObject_Malloc (obmalloc.c:2132)
==14783==    by 0x3A8B8F: block_new (pyarena.c:81)
==14783==    by 0x3A8B8F: block_alloc (pyarena.c:112)
==14783==    by 0x3A8B8F: _PyArena_Malloc (pyarena.c:183)
==14783==    by 0x1956B5: _PyPegen_insert_memo (pegen.c:54)
==14783==    by 0x1956B5: _PyPegen_update_memo (pegen.c:79)
==14783==    by 0x1A376E: bitwise_or_rule (parser.c:12964)
==14783==    by 0x1A3B4D: comparison_rule (parser.c:12210)
==14783==    by 0x1A3B4D: inversion_rule (parser.c:12161)
==14783==    by 0x1A46E4: conjunction_rule (parser.c:12038)
==14783==    by 0x1A4B04: disjunction_rule (parser.c:11950)
==14783==    by 0x1A511C: expression_rule (parser.c:11238)
==14783==    by 0x1AE0C1: _tmp_122_rule (parser.c:33162)
==14783==    by 0x1AE330: _tmp_258_rule (parser.c:41274)
==14783==    by 0x1AE330: _loop0_124_rule (parser.c:33214)
==14783==    by 0x1AE330: _gather_123_rule (parser.c:33282)
==14783==    by 0x1B8C4E: args_rule (parser.c:17645)
==14783== 
==14783== LEAK SUMMARY:
==14783==    definitely lost: 1 bytes in 1 blocks
==14783==    indirectly lost: 0 bytes in 0 blocks
==14783==      possibly lost: 43,920 bytes in 9 blocks
==14783==    still reachable: 2,074,982 bytes in 2,522 blocks
==14783==         suppressed: 0 bytes in 0 blocks
==14783== Reachable blocks (those to which a pointer was found) are not shown.
==14783== To see them, rerun with: --leak-check=full --show-leak-kinds=all
==14783== 
==14783== For lists of detected and suppressed errors, rerun with: -s
==14783== ERROR SUMMARY: 10 errors from 10 contexts (suppressed: 0 from 0)

from cython.

YoSTEALTH avatar YoSTEALTH commented on June 1, 2024

Running using lldb gives:

$ lldb -- /opt/python/3.13/bin/python3 _3.py
(lldb) target create "/opt/python/3.13/bin/python3"
Current executable set to '/opt/python/3.13/bin/python3' (x86_64).
(lldb) settings set -- target.run-args  "_3.py"
(lldb) run
Process 20821 launched: '/opt/python/3.13/bin/python3' (x86_64)
nope_test()
nope_test()
nope_test()
nope_test()
nope_test()
nope_test()
nope_test()
nope_test()
nope_test()
nope_test()
nope_test()
nope_test()
nope_test()
nope_test()
nope_test()
nope_test()
nope_test()
nope_test()
Process 20821 stopped
* thread #1, name = 'python3', stop reason = signal SIGSEGV: address not mapped to object (fault address: 0x7ffff6973120)
    frame #0: 0x00005555557f4acb python3`_PyArena_Free at pyarena.c:95:16
(lldb) bt
* thread #1, name = 'python3', stop reason = signal SIGSEGV: address not mapped to object (fault address: 0x7ffff6973120)
  * frame #0: 0x00005555557f4acb python3`_PyArena_Free at pyarena.c:95:16
    frame #1: 0x00005555557f4abc python3`_PyArena_Free(arena=0x00007ffff7bc7cd0) at pyarena.c:170:5
    frame #2: 0x00005555558011d4 python3`_PyRun_SimpleFileObject at pythonrun.c:1215:5
    frame #3: 0x0000555555801151 python3`_PyRun_SimpleFileObject(fp=0x0000555555b5ed40, filename=0x00007ffff7599700, closeit=1, flags=0x00007fffffffdc48) at pythonrun.c:459:13
    frame #4: 0x00005555558017ac python3`_PyRun_AnyFileObject(fp=0x0000555555b5ed40, filename=0x00007ffff7599700, closeit=1, flags=0x00007fffffffdc48) at pythonrun.c:77:15
    frame #5: 0x000055555582b701 python3`pymain_run_python at main.c:357:15
    frame #6: 0x000055555582b66b python3`pymain_run_python at main.c:376:15
    frame #7: 0x000055555582b618 python3`pymain_run_python(exitcode=0x00007fffffffdd90) at main.c:639:21
    frame #8: 0x000055555582bdea python3`Py_BytesMain at main.c:718:5
    frame #9: 0x00007ffff7cd3c88 libc.so.6`___lldb_unnamed_symbol3256 + 120
    frame #10: 0x00007ffff7cd3d4c libc.so.6`__libc_start_main + 140
    frame #11: 0x00005555555e0ed5 python3`_start + 37
(lldb)

from cython.

YoSTEALTH avatar YoSTEALTH commented on June 1, 2024

@da-woods axboe/liburing#1159 from what I can tell, cqe does not get populated consistently from C side into Cython class https://github.com/YoSTEALTH/Liburing/blob/master/src/liburing/queue.pyx#L131 any insight into this?

from cython.

da-woods avatar da-woods commented on June 1, 2024

I haven't tested this, but what I'm very suspicious of is:

            sqe = <SQE><void*><uintptr_t>user_data
            sqe.result = res
            if sqe.job & CORO:
                Py_DECREF(sqe)
                value = None    # start coroutine
            else:
                value = False   # bogus value

When you do

sqe = <SQE><void*><uintptr_t>user_data

Cython doesn't INCREF user_data but it does take ownership of it. Therefore in the

                Py_DECREF(sqe)
                value = None    # start coroutine

path sqe will get DECREFed twice - once by you and once by Cython. Since you only have one reference to it I think that's wrong.

Similarly in the

                value = False   # bogus value

path, sqe will get DECREFed once by Cython and thus destroyed, which I suspect isn't what you intend.

I think what you want is

            sqe = <SQE><void*><uintptr_t>user_data
            sqe.result = res
            if sqe.job & CORO:
                # sqe is decrefed by Cython
                value = None    # start coroutine
            else:
                Py_INCREF(sqe)  # sqe survives
                value = False   # bogus value

You could probably find that out for sure by using a debug build of Python, which has extra asserts in to catch reference counting bugs. But I'm not sure whether that's worth it vs just making the change.

from cython.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.