Uploaded image for project: 'Solr'
  1. Solr
  2. SOLR-13408

Cannot start/stop DaemonStream repeatedly, other API improvements

    XMLWordPrintableJSON

    Details

      Description

      If I create a DaemonStream then use the API commands to stop it then start it repeatedly, after the first time it's stopped/started, it cannot be stopped again.

      DaemonStream.close() checks whether a local variable "closed" is true, and if so does nothing. Otherwise it closes the stream then sets "closed" to true.

      However, when the stream is started again, "closed" is not set to false, therefore the next time you try to stop the deamon, nothing happens and it continues to run. One other consequence of this is that you can have orphan threads running in the background. Say I

      stop the daemon
      start it again
      create another one with the same ID
      

      When the new one is created, this code is executed over in StreamHandler.handleRequestBody:

      daemons.remove(daemonStream.getId()).close();
      

      which will not terminate the stream thread as above. Then the open() method executes this:

      this.streamRunner = new StreamRunner(runInterval, id);
      

      leaving the thread running.

      Finally, there's an NPE if I try to start a non-existent daemon.

        Attachments

        1. SOLR-13408.patch
          5 kB
          Erick Erickson
        2. SOLR-13408.patch
          22 kB
          Erick Erickson
        3. SOLR-13408.patch
          23 kB
          Erick Erickson

          Activity

            People

            • Assignee:
              erickerickson Erick Erickson
              Reporter:
              erickerickson Erick Erickson
            • Votes:
              0 Vote for this issue
              Watchers:
              4 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: