Details

    • Type: Bug Bug
    • Status: Closed Closed
    • Priority: Major Major
    • Resolution: Fixed
    • Affects Version/s: JRuby 1.5.2
    • Fix Version/s: JRuby 1.6RC1
    • Component/s: Core Classes/Modules
    • Labels:
      None
    • Environment:
      Mac OS X Snow Leopard using JRuby through RVM.
    • Testcase included:
      yes
    • Number of attachments :
      0

      Description

      To see the issue, run this code:

      trap("INT") do
      puts "Exiting..."
      exit
      end

      puts "Sleeping..."
      select(nil, nil, nil, nil)

      and press Control-C after "Sleeping..." is printed. Note that even using exit!() does not work.

        Activity

        Hide
        Charles Oliver Nutter added a comment -

        See this gist, where I replace Kernel#exit with a "real" native one: http://gist.github.com/579505

        Unlike the exec case in JRUBY-5082, this is probably safe to do for all exit calls when JRuby was started at the command-line. Under other circumstances, it would probably be ill-advised to hard exit the process, since we've likely been embedded in another application or deployed into a shared server.

        Show
        Charles Oliver Nutter added a comment - See this gist, where I replace Kernel#exit with a "real" native one: http://gist.github.com/579505 Unlike the exec case in JRUBY-5082 , this is probably safe to do for all exit calls when JRuby was started at the command-line. Under other circumstances, it would probably be ill-advised to hard exit the process, since we've likely been embedded in another application or deployed into a shared server.
        Hide
        James Edward Gray II added a comment -

        I agree this one is definitely the bigger issue.

        Just so you know, I found it while using Stalker (which is using beanstalk-client under the hood). The beanstalk-client select()s over IO objects, meaning you cannot exit() or even exit!() a process while Stalker waits for a job (pretty much all the time). I find that to be a pretty significant bug since I have to kill -9 the process to stop it. It would exit() after a job is reserved and control returns, which is another big problem since it wastes a reserve timeout sequence for no reason.

        I think it's hard to think of a case where I call exit!() and I don't want my process to end right now. Preventing that seems like a pretty big surprise.

        Show
        James Edward Gray II added a comment - I agree this one is definitely the bigger issue. Just so you know, I found it while using Stalker (which is using beanstalk-client under the hood). The beanstalk-client select()s over IO objects, meaning you cannot exit() or even exit!() a process while Stalker waits for a job (pretty much all the time). I find that to be a pretty significant bug since I have to kill -9 the process to stop it. It would exit() after a job is reserved and control returns, which is another big problem since it wastes a reserve timeout sequence for no reason. I think it's hard to think of a case where I call exit!() and I don't want my process to end right now. Preventing that seems like a pretty big surprise.
        Hide
        Charles Oliver Nutter added a comment -

        Ok, I decided to go with the solution I described, where command-line execution sets a flag that makes exit! actually do a hard system exit.

        commit d0f5663d0930373a66125d5a7eddf26810fb5a28
        Author: Charles Oliver Nutter <headius@headius.com>
        Date: Fri Oct 22 18:11:25 2010 -0500

        Fix for JRUBY-5079: Kernel#select() prevents exit during a signal handler

        Make Kernel#exit! actually do System.exit, when the current JRuby instance was started from command line.

        Show
        Charles Oliver Nutter added a comment - Ok, I decided to go with the solution I described, where command-line execution sets a flag that makes exit! actually do a hard system exit. commit d0f5663d0930373a66125d5a7eddf26810fb5a28 Author: Charles Oliver Nutter <headius@headius.com> Date: Fri Oct 22 18:11:25 2010 -0500 Fix for JRUBY-5079 : Kernel#select() prevents exit during a signal handler Make Kernel#exit! actually do System.exit, when the current JRuby instance was started from command line.

          People

          • Assignee:
            Charles Oliver Nutter
            Reporter:
            James Edward Gray II
          • Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved: