rubypython segfaults after some time

Anonymous avatarAnonymous created an issue

I'm running a Ruby daemon which runs a loop and periodically uses a global RubyPython object to get data from a Python library. After some time the process crashes:

/opt/local/lib/ruby/gems/1.8/gems/rubypython-0.5.3/lib/rubypython/pyobject.rb:114: [BUG] Segmentation fault

ruby 1.8.7 (2010-08-16 patchlevel 302) [x86_64-darwin10]

Abort trap

The process runs on Mac OSX 10.6 with Ruby 1.8.7 (2010-08-16 patchlevel 302) and RubyPython 0.5.3. It also crashes on Ubuntu Linux 11.10 with Ruby 1.8.7 (2011-06-30 patchlevel 352) and RubyPython-0.5.1.

Comments (5)

  1. Anonymous

    This is the GDB output on Linux:

    Program received signal SIGSEGV, Segmentation fault.
    0x00007f06eaefc795 in PyObject_Malloc () from /usr/lib/libpython2.7.so
    
    bt
    #0  0x00007f06eaefc795 in PyObject_Malloc () from /usr/lib/libpython2.7.so
    #1  0x00007f06eaef92cd in _PyObject_New () from /usr/lib/libpython2.7.so
    #2  0x00007f06e8778880 in PyCArgObject_new () from /usr/lib/python2.7/lib-dynload/_ctypes.so
    #3  0x00007f06e876fa99 in ?? () from /usr/lib/python2.7/lib-dynload/_ctypes.so
    #4  0x00007f06e8778dd6 in _ctypes_callproc () from /usr/lib/python2.7/lib-dynload/_ctypes.so
    #5  0x00007f06e87705f7 in ?? () from /usr/lib/python2.7/lib-dynload/_ctypes.so
    #6  0x00007f06eaeb91f3 in PyObject_Call () from /usr/lib/libpython2.7.so
    #7  0x00007f06eaf5bc6d in PyEval_EvalFrameEx () from /usr/lib/libpython2.7.so
    #8  0x00007f06eaf5e064 in PyEval_EvalFrameEx () from /usr/lib/libpython2.7.so
    #9  0x00007f06eaf5ef05 in PyEval_EvalCodeEx () from /usr/lib/libpython2.7.so
    #10 0x00007f06eaee1a1c in ?? () from /usr/lib/libpython2.7.so
    #11 0x00007f06eaeb91f3 in PyObject_Call () from /usr/lib/libpython2.7.so
    #12 0x00007f06eaeb92cb in ?? () from /usr/lib/libpython2.7.so
    #13 0x00007f06eaeb939e in PyObject_CallFunction () from /usr/lib/libpython2.7.so
    #14 0x00007f06eaefa61a in _PyObject_GenericGetAttrWithDict () from /usr/lib/libpython2.7.so
    #15 0x00007f06eaf59f3a in PyEval_EvalFrameEx () from /usr/lib/libpython2.7.so
    #16 0x00007f06eaf5e064 in PyEval_EvalFrameEx () from /usr/lib/libpython2.7.so
    #17 0x00007f06eaf5ef05 in PyEval_EvalCodeEx () from /usr/lib/libpython2.7.so
    #18 0x00007f06eaf5d075 in PyEval_EvalFrameEx () from /usr/lib/libpython2.7.so
    #19 0x00007f06eaf5ef05 in PyEval_EvalCodeEx () from /usr/lib/libpython2.7.so
    #20 0x00007f06eaf5d075 in PyEval_EvalFrameEx () from /usr/lib/libpython2.7.so
    #21 0x00007f06eaf5ef05 in PyEval_EvalCodeEx () from /usr/lib/libpython2.7.so
    #22 0x00007f06eaee1b13 in ?? () from /usr/lib/libpython2.7.so
    #23 0x00007f06eaeb91f3 in PyObject_Call () from /usr/lib/libpython2.7.so
    #24 0x00007f06eaf5a959 in PyEval_EvalFrameEx () from /usr/lib/libpython2.7.so
    #25 0x00007f06eaf5ef05 in PyEval_EvalCodeEx () from /usr/lib/libpython2.7.so
    #26 0x00007f06eaf5d075 in PyEval_EvalFrameEx () from /usr/lib/libpython2.7.so
    #27 0x00007f06eaf5ef05 in PyEval_EvalCodeEx () from /usr/lib/libpython2.7.so
    #28 0x00007f06eaf5d075 in PyEval_EvalFrameEx () from /usr/lib/libpython2.7.so
    #29 0x00007f06eaf5e064 in PyEval_EvalFrameEx () from /usr/lib/libpython2.7.so
    #30 0x00007f06eaf5ef05 in PyEval_EvalCodeEx () from /usr/lib/libpython2.7.so
    #31 0x00007f06eaee1a1c in ?? () from /usr/lib/libpython2.7.so
    #32 0x00007f06eaeb91f3 in PyObject_Call () from /usr/lib/libpython2.7.so
    #33 0x00007f06eaec694f in ?? () from /usr/lib/libpython2.7.so
    #34 0x00007f06eaeb91f3 in PyObject_Call () from /usr/lib/libpython2.7.so
    #35 0x00007f06eaf57807 in PyEval_CallObjectWithKeywords () from /usr/lib/libpython2.7.so
    #36 0x00007f06eb377254 in ffi_call_unix64 () from /usr/lib/ruby/gems/1.8/gems/ffi-1.0.11/lib/ffi_c.so
    #37 0x00007f06eb376d30 in ffi_call (cif=0xb11788, fn=0x7f06eaeb9190 <PyObject_CallObject>, rvalue=0x7fff5c74efd0, avalue=0x7fff5c74efb0) at src/x86/ffi64.c:484
    #38 0x00007f06eb365ca0 in rbffi_CallFunction (argc=<optimized out>, argv=<optimized out>, function=0x7f06eaeb9190, fnInfo=0xb11740) at Call.c:332
    #39 0x00007f06eb371c86 in custom_trampoline (argc=<optimized out>, argv=<optimized out>, self=139667697834800, handle=<optimized out>) at MethodHandle.c:216
    #40 0x00007f06ecbbe73f in ?? () from /usr/lib/libruby1.8.so.1.8
    #41 0x00007f06ecbbe9bf in ?? () from /usr/lib/libruby1.8.so.1.8
    #42 0x00007f06ecbc3c79 in ?? () from /usr/lib/libruby1.8.so.1.8
    #43 0x00007f06ecbc5270 in ?? () from /usr/lib/libruby1.8.so.1.8
    #44 0x00007f06ecbbdd73 in ?? () from /usr/lib/libruby1.8.so.1.8
    #45 0x00007f06ecbbe9bf in ?? () from /usr/lib/libruby1.8.so.1.8
    #46 0x00007f06ecbc3c79 in ?? () from /usr/lib/libruby1.8.so.1.8
    #47 0x00007f06ecbc5270 in ?? () from /usr/lib/libruby1.8.so.1.8
    #48 0x00007f06ecbc4fd3 in ?? () from /usr/lib/libruby1.8.so.1.8
    #49 0x00007f06ecbbdd73 in ?? () from /usr/lib/libruby1.8.so.1.8
    #50 0x00007f06ecbbe9bf in ?? () from /usr/lib/libruby1.8.so.1.8
    #51 0x00007f06ecbbed35 in rb_funcall2 () from /usr/lib/libruby1.8.so.1.8
    #52 0x00007f06ecbc1c11 in ?? () from /usr/lib/libruby1.8.so.1.8
    #53 0x00007f06ecbbea16 in ?? () from /usr/lib/libruby1.8.so.1.8
    #54 0x00007f06ecbc3c79 in ?? () from /usr/lib/libruby1.8.so.1.8
    #55 0x00007f06ecbc4120 in ?? () from /usr/lib/libruby1.8.so.1.8
    #56 0x00007f06ecbbdd73 in ?? () from /usr/lib/libruby1.8.so.1.8
    #57 0x00007f06ecbbe9bf in ?? () from /usr/lib/libruby1.8.so.1.8
    #58 0x00007f06ecbc3c79 in ?? () from /usr/lib/libruby1.8.so.1.8
    #59 0x00007f06ecbc3b58 in ?? () from /usr/lib/libruby1.8.so.1.8
    #60 0x00007f06ecbc5d19 in ?? () from /usr/lib/libruby1.8.so.1.8
    #61 0x00007f06ecbbc6fa in ?? () from /usr/lib/libruby1.8.so.1.8
    #62 0x00007f06ecbc4174 in ?? () from /usr/lib/libruby1.8.so.1.8
    #63 0x00007f06ecbbc6fa in ?? () from /usr/lib/libruby1.8.so.1.8
    #64 0x00007f06ecbc4174 in ?? () from /usr/lib/libruby1.8.so.1.8
    #65 0x00007f06ecbc5cba in ?? () from /usr/lib/libruby1.8.so.1.8
    #66 0x00007f06ecbbc6fa in ?? () from /usr/lib/libruby1.8.so.1.8
    #67 0x00007f06ecbc4174 in ?? () from /usr/lib/libruby1.8.so.1.8
    #68 0x00007f06ecbc6cdc in ?? () from /usr/lib/libruby1.8.so.1.8
    #69 0x00007f06ecbbdd73 in ?? () from /usr/lib/libruby1.8.so.1.8
    #70 0x00007f06ecbbe9bf in ?? () from /usr/lib/libruby1.8.so.1.8
    #71 0x00007f06ecbc62db in ?? () from /usr/lib/libruby1.8.so.1.8
    #72 0x00007f06ecbc748e in ?? () from /usr/lib/libruby1.8.so.1.8
    #73 0x00007f06ecbbdd73 in ?? () from /usr/lib/libruby1.8.so.1.8
    #74 0x00007f06ecbbe9bf in ?? () from /usr/lib/libruby1.8.so.1.8
    #75 0x00007f06ecbc3c79 in ?? () from /usr/lib/libruby1.8.so.1.8
    #76 0x00007f06ecbc748e in ?? () from /usr/lib/libruby1.8.so.1.8
    #77 0x00007f06ecbbdd73 in ?? () from /usr/lib/libruby1.8.so.1.8
    #78 0x00007f06ecbbe9bf in ?? () from /usr/lib/libruby1.8.so.1.8
    #79 0x00007f06ecbc3c79 in ?? () from /usr/lib/libruby1.8.so.1.8
    #80 0x00007f06ecbc826b in ?? () from /usr/lib/libruby1.8.so.1.8
    #81 0x00007f06ecbc451a in ?? () from /usr/lib/libruby1.8.so.1.8
    #82 0x00007f06ecbbc6fa in ?? () from /usr/lib/libruby1.8.so.1.8
    #83 0x00007f06ecbebf79 in rb_obj_tap () from /usr/lib/libruby1.8.so.1.8
    #84 0x00007f06ecbbe722 in ?? () from /usr/lib/libruby1.8.so.1.8
    #85 0x00007f06ecbbe9bf in ?? () from /usr/lib/libruby1.8.so.1.8
    #86 0x00007f06ecbc62db in ?? () from /usr/lib/libruby1.8.so.1.8
    #87 0x00007f06ecbc748e in ?? () from /usr/lib/libruby1.8.so.1.8
    #88 0x00007f06ecbbdd73 in ?? () from /usr/lib/libruby1.8.so.1.8
    #89 0x00007f06ecbbe9bf in ?? () from /usr/lib/libruby1.8.so.1.8
    #90 0x00007f06ecbc3c79 in ?? () from /usr/lib/libruby1.8.so.1.8
    #91 0x00007f06ecbc748e in ?? () from /usr/lib/libruby1.8.so.1.8
    #92 0x00007f06ecbbc6fa in ?? () from /usr/lib/libruby1.8.so.1.8
    #93 0x00007f06ecbc4174 in ?? () from /usr/lib/libruby1.8.so.1.8
    #94 0x00007f06ecbbc6fa in ?? () from /usr/lib/libruby1.8.so.1.8
    #95 0x00007f06ecbc4174 in ?? () from /usr/lib/libruby1.8.so.1.8
    #96 0x00007f06ecbc5cba in ?? () from /usr/lib/libruby1.8.so.1.8
    #97 0x00007f06ecbbc6fa in ?? () from /usr/lib/libruby1.8.so.1.8
    #98 0x00007f06ecbc4174 in ?? () from /usr/lib/libruby1.8.so.1.8
    #99 0x00007f06ecbc6cdc in ?? () from /usr/lib/libruby1.8.so.1.8
    #100 0x00007f06ecbbdd73 in ?? () from /usr/lib/libruby1.8.so.1.8
    #101 0x00007f06ecbbe9bf in ?? () from /usr/lib/libruby1.8.so.1.8
    #102 0x00007f06ecbc62db in ?? () from /usr/lib/libruby1.8.so.1.8
    #103 0x00007f06ecbc748e in ?? () from /usr/lib/libruby1.8.so.1.8
    #104 0x00007f06ecbbdd73 in ?? () from /usr/lib/libruby1.8.so.1.8
    #105 0x00007f06ecbbe9bf in ?? () from /usr/lib/libruby1.8.so.1.8
    #106 0x00007f06ecbc3c79 in ?? () from /usr/lib/libruby1.8.so.1.8
    #107 0x00007f06ecbc748e in ?? () from /usr/lib/libruby1.8.so.1.8
    #108 0x00007f06ecbbdd73 in ?? () from /usr/lib/libruby1.8.so.1.8
    #109 0x00007f06ecbbe9bf in ?? () from /usr/lib/libruby1.8.so.1.8
    #110 0x00007f06ecbc3c79 in ?? () from /usr/lib/libruby1.8.so.1.8
    #111 0x00007f06ecbc826b in ?? () from /usr/lib/libruby1.8.so.1.8
    #112 0x00007f06ecbc451a in ?? () from /usr/lib/libruby1.8.so.1.8
    #113 0x00007f06ecbbc6fa in ?? () from /usr/lib/libruby1.8.so.1.8
    #114 0x00007f06ecbebf79 in rb_obj_tap () from /usr/lib/libruby1.8.so.1.8
    #115 0x00007f06ecbbe722 in ?? () from /usr/lib/libruby1.8.so.1.8
    #116 0x00007f06ecbbe9bf in ?? () from /usr/lib/libruby1.8.so.1.8
    #117 0x00007f06ecbc62db in ?? () from /usr/lib/libruby1.8.so.1.8
    #118 0x00007f06ecbc748e in ?? () from /usr/lib/libruby1.8.so.1.8
    #119 0x00007f06ecbbdd73 in ?? () from /usr/lib/libruby1.8.so.1.8
    #120 0x00007f06ecbbe9bf in ?? () from /usr/lib/libruby1.8.so.1.8
    #121 0x00007f06ecbc3c79 in ?? () from /usr/lib/libruby1.8.so.1.8
    #122 0x00007f06ecbc748e in ?? () from /usr/lib/libruby1.8.so.1.8
    #123 0x00007f06ecbbc6fa in ?? () from /usr/lib/libruby1.8.so.1.8
    #124 0x00007f06ecbcc053 in ?? () from /usr/lib/libruby1.8.so.1.8
    #125 0x00007f06ecbb8737 in rb_rescue2 () from /usr/lib/libruby1.8.so.1.8
    #126 0x00007f06ecbb88f5 in ?? () from /usr/lib/libruby1.8.so.1.8
    #127 0x00007f06ecbbe722 in ?? () from /usr/lib/libruby1.8.so.1.8
    #128 0x00007f06ecbbe9bf in ?? () from /usr/lib/libruby1.8.so.1.8
    #129 0x00007f06ecbc62db in ?? () from /usr/lib/libruby1.8.so.1.8
    #130 0x00007f06ecbc748e in ?? () from /usr/lib/libruby1.8.so.1.8
    #131 0x00007f06ecbcc72b in rb_load () from /usr/lib/libruby1.8.so.1.8
    #132 0x00007f06ecbcc852 in ?? () from /usr/lib/libruby1.8.so.1.8
    #133 0x00007f06ecbbe73f in ?? () from /usr/lib/libruby1.8.so.1.8
    #134 0x00007f06ecbbe9bf in ?? () from /usr/lib/libruby1.8.so.1.8
    #135 0x00007f06ecbc62db in ?? () from /usr/lib/libruby1.8.so.1.8
    #136 0x00007f06ecbbdd73 in ?? () from /usr/lib/libruby1.8.so.1.8
    #137 0x00007f06ecbbe9bf in ?? () from /usr/lib/libruby1.8.so.1.8
    #138 0x00007f06ecbc3dd7 in ?? () from /usr/lib/libruby1.8.so.1.8
    #139 0x00007f06ecbbdd73 in ?? () from /usr/lib/libruby1.8.so.1.8
    #140 0x00007f06ecbbe9bf in ?? () from /usr/lib/libruby1.8.so.1.8
    #141 0x00007f06ecbc3c79 in ?? () from /usr/lib/libruby1.8.so.1.8
    #142 0x00007f06ecbbdd73 in ?? () from /usr/lib/libruby1.8.so.1.8
    #143 0x00007f06ecbbe9bf in ?? () from /usr/lib/libruby1.8.so.1.8
    #144 0x00007f06ecbc3c79 in ?? () from /usr/lib/libruby1.8.so.1.8
    #145 0x00007f06ecbbc6fa in ?? () from /usr/lib/libruby1.8.so.1.8
    #146 0x00007f06ecbbcc7f in ?? () from /usr/lib/libruby1.8.so.1.8
    #147 0x00007f06ecbbe765 in ?? () from /usr/lib/libruby1.8.so.1.8
    #148 0x00007f06ecbbe9bf in ?? () from /usr/lib/libruby1.8.so.1.8
    #149 0x00007f06ecbc3c79 in ?? () from /usr/lib/libruby1.8.so.1.8
    #150 0x00007f06ecbc6cdc in ?? () from /usr/lib/libruby1.8.so.1.8
    #151 0x00007f06ecbbdd73 in ?? () from /usr/lib/libruby1.8.so.1.8
    #152 0x00007f06ecbbe9bf in ?? () from /usr/lib/libruby1.8.so.1.8
    #153 0x00007f06ecbc3c79 in ?? () from /usr/lib/libruby1.8.so.1.8
    #154 0x00007f06ecbc748e in ?? () from /usr/lib/libruby1.8.so.1.8
    #155 0x00007f06ecbbdd73 in ?? () from /usr/lib/libruby1.8.so.1.8
    #156 0x00007f06ecbbe9bf in ?? () from /usr/lib/libruby1.8.so.1.8
    #157 0x00007f06ecbc3c79 in ?? () from /usr/lib/libruby1.8.so.1.8
    #158 0x00007f06ecbca6d9 in ?? () from /usr/lib/libruby1.8.so.1.8
    #159 0x00007f06ecbca725 in ruby_exec () from /usr/lib/libruby1.8.so.1.8
    #160 0x00007f06ecbcd2f2 in ruby_run () from /usr/lib/libruby1.8.so.1.8
    #161 0x0000000000400739 in main ()
    
  2. raineszm

    It appears we may have a memory leak somewhere? What version of python are you using?

    Could you try updating to the newest release of RubyPython?

    And if possible, could you attach a code sample that reproduces the above crash?

    Sorry for the extremely delayed response.

  3. Anonymous

    This also happens with the current release:

    /usr/lib/ruby/gems/1.8/gems/rubypython-0.6.0/lib/rubypython/pyobject.rb:115: [BUG] Segmentation fault
    ruby 1.8.7 (2011-06-30 patchlevel 352) [x86_64-linux]
    

    My Python version is:

    Python 2.7.2+ (default, Oct  4 2011, 20:06:09) 
    [GCC 4.6.1] on linux2
    
  4. Anonymous

    The crash happens for example every now and then at this line https://github.com/kaazoo/DrQueueCloudControl/blob/master/dqcc.rb#L63 of my main loop. It calls the function fetch_job_info ( https://github.com/kaazoo/DrQueueCloudControl/blob/master/queue_func.rb#L34 ) which then calls a Ruby function of my global RubyPython object ( https://github.com/kaazoo/DrQueueIPython/blob/master/DrQueue/client.py#L326 ).

    I can't really tell why it crashes sometimes and why not the other times.

    Sorry, I have no shorter example code at the moment.

  5. Anonymous

    So far I can only reproduce the problem on Ubuntu. I installed the same software stack (Apache2, Passenger, Python-2.7, RubyPython-0.6, Ruby-1.8) on Mac OSX and didn't get the segfault. While on the other hand, I installed Ubuntu 11.10 x64 in another VM with the same software versions as on the original problem machine and was again able to reproduce the segfault.

  6. Log in to comment
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.