JRuby (please use github issues at http://bugs.jruby.org)
  1. JRuby (please use github issues at http://bugs.jruby.org)
  2. JRUBY-2608

Examine whether -Xrs flag to JVM could be used to improve our signal-handling logic

    Details

    • Type: Improvement Improvement
    • Status: Closed Closed
    • Priority: Major Major
    • Resolution: Not A Bug
    • Affects Version/s: None
    • Fix Version/s: None
    • Component/s: Core Classes/Modules
    • Labels:
      None
    • Number of attachments :
      0

      Description

      The -Xrs flag turns off the JVM's use of signal handlers that might otherwise be used for Ruby programs in JRuby. It could be useful for us. From the docs:

      -Xrs
          Reduces use of operating-system signals by the Java virtual machine (JVM).
      
          In a previous release, the Shutdown Hooks facility was added to allow orderly shutdown of a Java application. The intent was to allow user cleanup code (such as closing database
       connections) to run at shutdown, even if the JVM terminates abruptly.
      
          Sun's JVM catches signals to implement shutdown hooks for abnormal JVM termination. The JVM uses SIGHUP, SIGINT, and SIGTERM to initiate the running of shutdown hooks.
      
          The JVM uses a similar mechanism to implement the pre-1.2 feature of dumping thread stacks for debugging purposes. Sun's JVM uses SIGQUIT to perform thread dumps.
      
          Applications embedding the JVM frequently need to trap signals like SIGINT or SIGTERM, which can lead to interference with the JVM's own signal handlers. The -Xrs 
      command-line option is available to address this issue. When -Xrs is used on Sun's JVM, the signal masks for SIGINT, SIGTERM, SIGHUP, and SIGQUIT are not changed by the 
      JVM, and signal handlers for these signals are not installed.
      
          There are two consequences of specifying -Xrs:
      
              * SIGQUIT thread dumps are not available.
              * User code is responsible for causing shutdown hooks to run, for example by calling System.exit() when the JVM is to be terminated.
      
      

        Activity

        Hide
        Charles Oliver Nutter added a comment -

        There are no current critical issues relating to signal handling or JVM's hooking of these signals, so I'm bumping to post 1.1.3. I think there's probably something here when using JRuby as a subprocess of a larger run, but that's not a common use case right now and it's unlikely most people will want to hook these events to do other things.

        Show
        Charles Oliver Nutter added a comment - There are no current critical issues relating to signal handling or JVM's hooking of these signals, so I'm bumping to post 1.1.3. I think there's probably something here when using JRuby as a subprocess of a larger run, but that's not a common use case right now and it's unlikely most people will want to hook these events to do other things.
        Hide
        Charles Oliver Nutter added a comment -

        This is a pretty amorphous bug, but -Xrs has been examined. It would help us allow people to register sigquit, etc, but largely they can do that already. The risks associated with assigning a new trap to a given signal are still there, since the JVM may depend on them, but that is to some extent a problem -Xrs can't help.

        Show
        Charles Oliver Nutter added a comment - This is a pretty amorphous bug, but -Xrs has been examined. It would help us allow people to register sigquit, etc, but largely they can do that already. The risks associated with assigning a new trap to a given signal are still there, since the JVM may depend on them, but that is to some extent a problem -Xrs can't help.

          People

          • Assignee:
            Charles Oliver Nutter
            Reporter:
            Charles Oliver Nutter
          • Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved: