#48 ✓invalid
Jon Crosby

Segfault on shutdown

Reported by Jon Crosby | April 6th, 2009 @ 07:35 AM

When running specs on CloudKit using Johnson, I am getting a consistent error at the end of every run of specs:

296 examples, 0 failures, 27 pending JS engine warning: leaking GC root 'JSScriptProxy' at 0x10e4870 JS engine warning: 1 GC root remains after destroying the JSRuntime at 0x3d7000.

               This root may point to freed memory. Objects reachable
               through it have not been finalized.

/Library/Ruby/Gems/1.8/gems/rspec-1.1.12/bin/spec:4: [BUG] Segmentation fault ruby 1.8.6 (2008-03-03) [universal-darwin9.0]

Abort trap

The odd part about this is that the spec suite always runs completely and then crashes when shutting down. Also, it doesn't matter which specs I run, as long as the examples pass the 259 mark (or somewhere around there), they will fail with this error at the end.

I'll clean up a diff and post it to the jsonquery branch for CloudKit on GitHub, then post back here with a link.

Comments and changes to this ticket

  • Jon Crosby

    Jon Crosby April 6th, 2009 @ 09:49 AM

    I pushed the code to GitHub. If you check out the jsonquery branch for CloudKit, you will see it. The direct link is here:

    http://github.com/jcrosby/cloudk...

    The spots where CloudKit interacts with Johnson are:

    1. Setting up the environment: http://github.com/jcrosby/cloudk...

    2. Filtering using JSONQuery: http://github.com/jcrosby/cloudk...

    You can run the specs with rake or with spec -c spec to see the segfault on shutdown. This could be due to my misuse of the library, but I thought it would be helpful to have a few other eyes on it too.

  • John Barnette

    John Barnette April 6th, 2009 @ 09:51 AM

    It's not you. :) We're definitely having some problems with double
    frees on runtime shutdown. Could you possibly run your spec process
    under GDB and attach the backtrace to this ticket? You can look in
    johnson/lib/tasks/testing.rake for an example if you don't run under
    GDB often.

    Also, are you using the 1.1 release of Johnson (the one from RubyForge)?

  • Jon Crosby

    Jon Crosby April 6th, 2009 @ 09:52 AM

    One more bit of info: the only spec that exercises Johnson is in spec/resource_spec.rb and this spec runs on its own without errors. As mentioned above, the problem only happens when enough of the specs are run to surpass some point near or just below 259 specs.

  • Jon Crosby

    Jon Crosby April 6th, 2009 @ 09:59 AM

    Thanks for the GDB tip. I'll run using that and post output here.

    Regarding 1.1, I am using the latest SHA from GitHub installed using the rake task: http://github.com/jbarnette/john...

    (I could not get the rubyforge version to install due to the Manifest.txt error reported separately here.)

  • Jon Crosby

    Jon Crosby April 6th, 2009 @ 01:32 PM

    Running the following simply opens the gdb prompt. Running it without gdb produces the segfault. Is there some other argument I should be passing to gdb?

    gdb --args /System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/bin/ruby -I"/Library/Ruby/Gems/1.8/gems/rspec-1.1.12/lib" "/Library/Ruby/Gems/1.8/gems/rspec-1.1.12/bin/spec" "spec/ext_spec.rb" "spec/flash_session_spec.rb" "spec/memory_table_spec.rb" "spec/oauth_filter_spec.rb" "spec/oauth_store_spec.rb" "spec/openid_filter_spec.rb" "spec/openid_store_spec.rb" "spec/rack_builder_spec.rb" "spec/request_spec.rb" "spec/resource_spec.rb" "spec/service_spec.rb" "spec/store_spec.rb" "spec/uri_spec.rb" "spec/user_store_spec.rb" "spec/util_spec.rb"

  • Jon Crosby

    Jon Crosby April 6th, 2009 @ 01:48 PM

    After issuing "run" at the gdb prompt, here is the output:

    Program received signal EXC_BAD_ACCESS, Could not access memory. Reason: KERN_INVALID_ADDRESS at address: 0x001b80a8 0x00655887 in JS_DHashTableOperate (table=0x1b808c, key=0x162f510, op=JS_DHASH_REMOVE) at jsdhash.c:578 578 JS_ASSERT(op == JS_DHASH_LOOKUP || RECURSION_LEVEL(table) == 0);

  • John Barnette

    John Barnette April 6th, 2009 @ 02:00 PM

    After you "run", run "bt" and attach the backtrace. Thanks! :)

    ~ j. // mobile. bad spelling, etc.

    On Apr 6, 2009, at 1:48 PM, Lighthouse no-reply@lighthouseapp.com
    wrote:

  • Jon Crosby

    Jon Crosby April 6th, 2009 @ 02:35 PM

    Here you go:

    296 examples, 0 failures, 27 pending JS engine warning: leaking GC root 'JSScriptProxy' at 0x1e0e040 JS engine warning: 1 GC root remains after destroying the JSRuntime at 0x1b8000.

                   This root may point to freed memory. Objects reachable
                   through it have not been finalized.
    
    

    Program received signal EXC_BAD_ACCESS, Could not access memory. Reason: KERN_INVALID_ADDRESS at address: 0x001b80a8 0x00655887 in JS_DHashTableOperate (table=0x1b808c, key=0x1e0e040, op=JS_DHASH_REMOVE) at jsdhash.c:578 578 JS_ASSERT(op == JS_DHASH_LOOKUP || RECURSION_LEVEL(table) == 0); (gdb) bt #0 0x00655887 in JS_DHashTableOperate (table=0x1b808c, key=0x1e0e040, op=JS_DHASH_REMOVE) at jsdhash.c:578 #1 0x006796b3 in js_RemoveRoot (rt=0x1b8000, rp=0x1e0e040) at jsgc.c:1502 #2 0x0063630e in JS_RemoveRootRT (rt=0x1b8000, rp=0x1e0e040) at jsapi.c:1888 #3 0x0062624c in finalize (proxy=0x1e0e040) at /Library/Ruby/Gems/1.8/gems/johnson-1.1.0/ext/spidermonkey/ruby_land_proxy.c:463 #4 0x000ee8aa in rb_gc_call_finalizer_at_exit () #5 0x000d1f26 in ruby_native_thread_kill () #6 0x000e27bb in ruby_cleanup () #7 0x000e2872 in ruby_stop () #8 0x000e8fe6 in ruby_run () #9 0x00001fff in main ()

  • John Barnette

    John Barnette July 29th, 2009 @ 02:26 PM

    • State changed from “new” to “invalid”

    Duplicated in a GitHub Issues ticket, since I'm shutting LightHouse down soon.

Please Sign in or create a free account to add a new ticket.

With your very own profile, you can contribute to projects, track your activity, watch tickets, receive and update tickets through your email and much more.

New-ticket Create new ticket

Create your profile

Help contribute to this project by taking a few moments to create your personal profile. Create your profile ยป

People watching this ticket

Pages