[pypy-issue] [issue970] llexternal callbacks

Laurence Tratt tracker at bugs.pypy.org
Wed Dec 21 11:17:13 CET 2011


Laurence Tratt <laurie at tratt.net> added the comment:

To flesh out Armin's issue, I've stumbled across this in the Converge VM when
using libXML2, when I have to pass pointers to functions in a struct. See the
"parse" function in this module:

  https://github.com/ltratt/converge/blob/pypyvm/vm/Modules/libXML2.py

Basically the external C function xmlSAXUserParseMemory calls back to the
RPython functions _characters, _start_element, or _end_element.

On --opt=3 and below everything's fine. With --opt=jit and
--gcrootfinder=shadowstack everything is fine. On Linux --opt=jit and
--gcrootfinder=asmgcc one gets a blow-up when garbage collection happens
during a call that indirects via libXML2 and the VM dies with "cannot find gc
roots!". Here's an example backtrace:

  Program received signal SIGABRT, Aborted.
  0x00007ffff6a0da75 in *__GI_raise (sig=<value optimized out>)
      at ../nptl/sysdeps/unix/sysv/linux/raise.c:64
  64      ../nptl/sysdeps/unix/sysv/linux/raise.c: No such file or directory.
          in ../nptl/sysdeps/unix/sysv/linux/raise.c
  (gdb) bt
  #0  0x00007ffff6a0da75 in *__GI_raise (sig=<value optimized out>)
      at ../nptl/sysdeps/unix/sysv/linux/raise.c:64
  #1  0x00007ffff6a115c0 in *__GI_abort () at abort.c:92
  #2  0x0000000000583f47 in pypy_g_locate_caller_based_on_retaddr ()
  #3  0x0000000000583f6c in pypy_g_walk_to_parent_frame ()
  #4  0x0000000000584308 in pypy_g_walk_stack_from ()
  #5  0x0000000000584469 in pypy_g__asm_callback ()
  #6  0x000000000062be55 in pypy_asm_stackwalk ()
  #7  0x000000000042d6de in pypy_g_MiniMarkGC_minor_collection ()
  #8  0x000000000042e3d1 in pypy_g_MiniMarkGC_collect_and_reserve ()
  #9  0x00000000004eabef in pypy_g_Con_Boxed_Object_get_slot ()
  #10 0x0000000000509805 in pypy_g_VM__instr_slot_lookup ()
  #11 0x0000000000521456 in pypy_g_portal ()
  #12 0x0000000000445174 in
pypy_g_ll_portal_runner__Signed_arrayPtr_Core_BC_PCPtr_ ()
  #13 0x00000000004e7aac in pypy_g_VM_apply_closure ()
  #14 0x000000000051bec1 in pypy_g_VM__instr_apply ()
  #15 0x0000000000522366 in pypy_g_portal ()
  #16 0x0000000000445174 in
pypy_g_ll_portal_runner__Signed_arrayPtr_Core_BC_PCPtr_ ()
  #17 0x00000000004e7aac in pypy_g_VM_apply_closure ()
  #18 0x0000000000611e10 in
pypy_g_ll_dict_setitem__dicttablePtr_Core_Con_ThingyPtr_1 ()
  #19 0x0000000000510207 in pypy_g_Con_Set___init__ ()
  #20 0x00000000005bfa22 in pypy_g__start_element ()
  #21 0x00007ffff78a7381 in ?? () from /usr/lib/libxml2.so.2
  #22 0x00007ffff78a7fbc in xmlParseElement () from /usr/lib/libxml2.so.2
  #23 0x00007ffff78a850a in xmlParseContent () from /usr/lib/libxml2.so.2
  #24 0x00007ffff78a804b in xmlParseElement () from /usr/lib/libxml2.so.2
  #25 0x00007ffff78af1ba in xmlParseDocument () from /usr/lib/libxml2.so.2
  #26 0x00007ffff78afd7d in xmlSAXUserParseMemory () from /usr/lib/libxml2.so.2
  #27 0x000000000062be55 in pypy_asm_stackwalk ()
  #28 0x00000000005e0c8a in
pypy_g_xmlSAXUserParseMemory___xmlSAXHandlerPtr_arrayPt ()
  #29 0x00000000005c0b09 in pypy_g_parse ()
  #30 0x00000000004e7e66 in pypy_g_VM_apply_closure ()
  #31 0x000000000051bec1 in pypy_g_VM__instr_apply ()
  #32 0x0000000000522366 in pypy_g_portal ()
  #33 0x0000000000445174 in
pypy_g_ll_portal_runner__Signed_arrayPtr_Core_BC_PCPtr_ ()
  #34 0x00000000004e7aac in pypy_g_VM_apply_closure ()
  #35 0x000000000051bec1 in pypy_g_VM__instr_apply ()
  #36 0x0000000000522366 in pypy_g_portal ()
  #37 0x0000000000445174 in
pypy_g_ll_portal_runner__Signed_arrayPtr_Core_BC_PCPtr_ ()
  #38 0x00000000004e7aac in pypy_g_VM_apply_closure ()
  #39 0x00000000004fbc80 in pypy_g__new_func_Con_Object ()
  #40 0x00000000004e7e66 in pypy_g_VM_apply_closure ()
  #41 0x00000000004fb052 in pypy_g__Con_Class_new ()
  #42 0x00000000004e7e66 in pypy_g_VM_apply_closure ()
  #43 0x000000000051bec1 in pypy_g_VM__instr_apply ()
  #44 0x0000000000522366 in pypy_g_portal ()
  #45 0x0000000000445174 in
pypy_g_ll_portal_runner__Signed_arrayPtr_Core_BC_PCPtr_ ()
  #46 0x00000000004e7aac in pypy_g_VM_apply_closure ()
  #47 0x00000000004f5cbc in pypy_g_VM_apply ()
  #48 0x00000000004ff7ba in pypy_g_entry_point ()
  #49 0x00000000004038af in pypy_main_function ()
  #50 0x00007ffff69f8c4d in __libc_start_main (main=<value optimized out>, 
      argc=<value optimized out>, ubp_av=<value optimized out>, 
      init=<value optimized out>, fini=<value optimized out>, 
      rtld_fini=<value optimized out>, stack_end=0x7fffffffe7f8)
      at libc-start.c:226
  #51 0x0000000000402739 in _start ()

----------
nosy: +ltratt
status: unread -> chatting

________________________________________
PyPy bug tracker <tracker at bugs.pypy.org>
<https://bugs.pypy.org/issue970>
________________________________________


More information about the pypy-issue mailing list