Details

    • Type: Bug Bug
    • Status: Resolved Resolved
    • Priority: Major Major
    • Resolution: Fixed
    • Affects Version/s: JRuby 1.6
    • Fix Version/s: JRuby 1.7.0.RC1
    • Component/s: IBM/Other VM
    • Labels:
      None
    • Environment:
    • Number of attachments :
      0

      Description

      Running various commands and scripts it appears that they complete however the last line is "Segmentation fault". I can reproduce this by running various gem commands and warbler as well. See below for an example. There are no core dumps created and the commands complete fairly quickly so I haven't been able to pull off a threadump.

      $ gem help commands
      GEM commands are:

      build Build a gem from a gemspec
      cert Manage RubyGems certificates and signing settings
      check Check installed gems
      cleanup Clean up old versions of installed gems in the local
      repository
      contents Display the contents of the installed gems
      dependency Show the dependencies of an installed gem
      environment Display information about the RubyGems environment
      fetch Download a gem and place it in the current directory
      generate_index Generates the index files for a gem server directory
      help Provide help on the 'gem' command
      install Install a gem into the local repository
      list Display gems whose name starts with STRING
      lock Generate a lockdown list of gems
      outdated Display all gems that need updates
      owner Manage gem owners on RubyGems.org.
      pristine Restores installed gems to pristine condition from files
      located in the gem cache
      push Push a gem up to RubyGems.org
      query Query gem information in local or remote repositories
      rdoc Generates RDoc for pre-installed gems
      search Display all gems whose name contains STRING
      server Documentation and gem repository HTTP server
      sources Manage the sources and cache file RubyGems uses to search
      for gems
      specification Display gem specification (in yaml)
      stale List gems along with access times
      uninstall Uninstall gems from the local repository
      unpack Unpack an installed gem to the current directory
      update Update the named gems (or all installed gems) in the local
      repository
      which Find the location of a library file you can require

      For help on a particular command, use 'gem help COMMAND'.

      Commands may be abbreviated, so long as they are unambiguous.
      e.g. 'gem i rake' is short for 'gem install rake'.
      Segmentation fault

        Activity

        Hide
        Charles Oliver Nutter added a comment -

        Hmm, I can't reproduce this with a rather old version of J9:

        deploy@domU-12-31-39-17-29-BD ~/jruby $ $JAVA_HOME/bin/java -version
        java version "1.6.0"
        Java(TM) SE Runtime Environment (build pxi3260-20071123_01)
        IBM J9 VM (build 2.4, J2RE 1.6.0 IBM J9 2.4 Linux x86-32 jvmxi3260-20071121_15015 (JIT enabled)
        J9VM - 20071121_015015_lHdSMR
        JIT  - r9_20071121_1330
        GC   - 20071031_AA)
        JCL  - 20071118_01
        
        
        Show
        Charles Oliver Nutter added a comment - Hmm, I can't reproduce this with a rather old version of J9: deploy@domU-12-31-39-17-29-BD ~/jruby $ $JAVA_HOME/bin/java -version java version "1.6.0" Java(TM) SE Runtime Environment (build pxi3260-20071123_01) IBM J9 VM (build 2.4, J2RE 1.6.0 IBM J9 2.4 Linux x86-32 jvmxi3260-20071121_15015 (JIT enabled) J9VM - 20071121_015015_lHdSMR JIT - r9_20071121_1330 GC - 20071031_AA) JCL - 20071118_01
        Hide
        Dax added a comment -

        I'm not seeing issues running this sdk.

        java version "1.5.0"
        Java(TM) 2 Runtime Environment, Standard Edition (build pxi32devifx-20101008a (SR12 FP2 ))
        IBM J9 VM (build 2.3, J2RE 1.5.0 IBM J9 2.3 Linux x86-32 j9vmxi3223ifx-20101008 (JIT enabled)
        J9VM - 20101007_66049_lHdSMr
        JIT - 20100623_16197ifx1_r8
        GC - 20100211_AA)
        JCL - 20101008

        Obviously I'd rather run java6 versus java5

        Show
        Dax added a comment - I'm not seeing issues running this sdk. java version "1.5.0" Java(TM) 2 Runtime Environment, Standard Edition (build pxi32devifx-20101008a (SR12 FP2 )) IBM J9 VM (build 2.3, J2RE 1.5.0 IBM J9 2.3 Linux x86-32 j9vmxi3223ifx-20101008 (JIT enabled) J9VM - 20101007_66049_lHdSMr JIT - 20100623_16197ifx1_r8 GC - 20100211_AA) JCL - 20101008 Obviously I'd rather run java6 versus java5
        Hide
        Charles Oliver Nutter added a comment -

        I'm testing out a more recent version to see if I can isolate the crash. One thing you might try would be to pass -Xnative.enabled=false and see if the segfault goes away.

        Show
        Charles Oliver Nutter added a comment - I'm testing out a more recent version to see if I can isolate the crash. One thing you might try would be to pass -Xnative.enabled=false and see if the segfault goes away.
        Hide
        Dax added a comment -

        The segfault does indeed go away with the native.enabled=false parameter

        Show
        Dax added a comment - The segfault does indeed go away with the native.enabled=false parameter
        Hide
        Thomas E Enebo added a comment -

        Dax, can you confirm that this is still happening with a later version of IBM JRE? Moving to 1.x since no one is actively working on it and we cannot reproduce locally.

        Show
        Thomas E Enebo added a comment - Dax, can you confirm that this is still happening with a later version of IBM JRE? Moving to 1.x since no one is actively working on it and we cannot reproduce locally.
        Hide
        Dax added a comment -

        It still happens unless you set the native.enabled=false parameter

        Show
        Dax added a comment - It still happens unless you set the native.enabled=false parameter
        Hide
        Dax added a comment -

        sorry, java6 doesn't have the issue, java5 still does without the parameter

        Show
        Dax added a comment - sorry, java6 doesn't have the issue, java5 still does without the parameter
        Hide
        Thomas E Enebo added a comment -

        Thanks for the update.

        Show
        Thomas E Enebo added a comment - Thanks for the update.
        Hide
        Marc D'Arcy added a comment -

        The issue looks to be caused by the JFFI library used by JRuby.

        The library calls pthread_key_create(pthread_key_t key, void (*destructor)(void)); from its JNI_OnLoad() method to create some kind of thread-specific data. The destructor is a function defined in the shared library.

        The jvm appropriately attempts to free resources allocated in classloaders at shutdown, resulting in the library being unloaded. When the destructor is then called during thread exit, the segv occurs since the library providing the instructions for the function has been unloaded.

        This situation occurs because the jffi library is missing the appropriate JNI_OnUnload method and call to pthread_key_delete to remove the value destructor which was added using pthread_key_create().

        Ref.1: http://download.oracle.com/javase/6/docs/technotes/guides/jni/spec/invocation.html#JNI_OnUnload
        Ref.2: http://pubs.opengroup.org/onlinepubs/009604499/functions/pthread_key_delete.html

        I'm happy to run tests against a JRuby build with included fixes to verify correct operation.

        Show
        Marc D'Arcy added a comment - The issue looks to be caused by the JFFI library used by JRuby. The library calls pthread_key_create(pthread_key_t key, void (*destructor)(void )); from its JNI_OnLoad() method to create some kind of thread-specific data. The destructor is a function defined in the shared library. The jvm appropriately attempts to free resources allocated in classloaders at shutdown, resulting in the library being unloaded. When the destructor is then called during thread exit, the segv occurs since the library providing the instructions for the function has been unloaded. This situation occurs because the jffi library is missing the appropriate JNI_OnUnload method and call to pthread_key_delete to remove the value destructor which was added using pthread_key_create(). Ref.1: http://download.oracle.com/javase/6/docs/technotes/guides/jni/spec/invocation.html#JNI_OnUnload Ref.2: http://pubs.opengroup.org/onlinepubs/009604499/functions/pthread_key_delete.html I'm happy to run tests against a JRuby build with included fixes to verify correct operation.
        Hide
        Geraint Jones added a comment -

        Is there a JRuby build that includes fixes for this? I'd like to run the JRuby tests to verify that the fixes work.

        Show
        Geraint Jones added a comment - Is there a JRuby build that includes fixes for this? I'd like to run the JRuby tests to verify that the fixes work.
        Hide
        Charles Oliver Nutter added a comment -

        Can you try one of the snapshot nightly builds from http://ci.jruby.org/snapshots/?

        Show
        Charles Oliver Nutter added a comment - Can you try one of the snapshot nightly builds from http://ci.jruby.org/snapshots/?
        Hide
        Charles Oliver Nutter added a comment -

        Marc: Can you put that in the form of a patch for JFFI? Or did you do that already?

        Show
        Charles Oliver Nutter added a comment - Marc: Can you put that in the form of a patch for JFFI? Or did you do that already?
        Hide
        Charles Oliver Nutter added a comment -

        This appears to be fixed with a proper JNI_OnUnload + pthread_key_delete call on jffi master, so I'm optimistically marking this resolves in RC1.

        Show
        Charles Oliver Nutter added a comment - This appears to be fixed with a proper JNI_OnUnload + pthread_key_delete call on jffi master, so I'm optimistically marking this resolves in RC1.

          People

          • Assignee:
            Charles Oliver Nutter
            Reporter:
            Dax
          • Votes:
            3 Vote for this issue
            Watchers:
            6 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved: