Details

    • Type: Bug Bug
    • Status: Resolved Resolved
    • Priority: Major Major
    • Resolution: Fixed
    • Affects Version/s: JRuby 1.6.5, JRuby 1.7.0.pre1
    • Fix Version/s: JRuby 1.7.0.pre1
    • Component/s: Core Classes/Modules
    • Labels:
      None
    • Environment:
      OS X JDK 1.6.0_26
    • Number of attachments :
      0

      Description

      When attempting to use IO.popen to send SQL to a mysql child process, I noticed the child processes were getting forcibly killed when the IO object is closed.

      IO.popen("mysql -u root", "w") do |io|
        io.puts <<-SQL
      ... SQL here ...
      SQL
      end
      

      Looking inside ShellLauncher.POpenProcess, I tried inserting a Process#waitFor instead of RubyIO.obliterateProcess (which uses Process#destroy).

      This works well except that there appears to be a JDK bug on OS X where the child process's stdout file descriptor is not closed when the Java process's InputStream is closed. Thus the following program hangs.

      https://gist.github.com/1304893

      To work around this, POpenProcess will only use child.waitFor if the process is opened for writing.

        Activity

        Hide
        Nick Sieger added a comment -

        Fixed in 7443186 (http://git.io/eUUKWg)

        Show
        Nick Sieger added a comment - Fixed in 7443186 ( http://git.io/eUUKWg )

          People

          • Assignee:
            Nick Sieger
            Reporter:
            Nick Sieger
          • Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved: