Uploaded image for project: 'Nutch'
  1. Nutch
  2. NUTCH-151

CommandRunner can hang after the main thread exec is finished and has inefficient busy loop

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Major
    • Resolution: Fixed
    • 0.8
    • 0.8
    • indexer
    • None
    • all

    Description

      I encountered a case where the JVM of a Tasktracker child did not exit after the main thread returned; a thread dump showed only the threads named STDOUT and STDERR from CommandRunner as non-daemon threads, and both were doing a read().

      CommandRunner usually works correctly when the subprocess is expected to be finished before the timeout or when no timeout is used. By usually, I mean in the absence of external thread interrupts. The busy loop that waits for the process to finish has a sleep that is skipped over by an exception; this causes the waiting main thread to compete with the subprocess in a tight loop and effectively reduces the available cpu by 50%.

      Attachments

        1. CommandRunner.060110.patch
          0.5 kB
          Jerome Charron
        2. CommandRunner.java.patch
          6 kB
          Paul Baclace
        3. CommandRunner.java
          8 kB
          Paul Baclace

        Activity

          People

            Unassigned Unassigned
            pbaclace Paul Baclace
            Votes:
            1 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: