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

SolrCLI swallows errors from solr.cmd

    Details

    • Type: Improvement
    • Status: Closed
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: 6.3, 7.0
    • Fix Version/s: 6.6, 7.0
    • Component/s: Server
    • Security Level: Public (Default Security Level. Issues are Public)
    • Labels:

      Description

      It occurs on mad scenario in LUCENE-7534:

      • solr.cmd weren't granted +x (it happens under cygwin, yes)
      • coolhacker worked it around with cmd /C solr.cmd start -e ..
      • but when SolrCLI runs solr instances with the same solr.cmd, it just silently fails

      I think we can just pass ExecuteResultHandler which will dump exception to console.

      1. SOLR-9745.patch
        4 kB
        gopikannan venugopalsamy
      2. SOLR-9745.patch
        2 kB
        gopikannan venugopalsamy

        Issue Links

          Activity

          Hide
          mkhludnev Mikhail Khludnev added a comment -

          just a scratch

          diff --git a/solr/core/src/java/org/apache/solr/util/SolrCLI.java b/solr/core/src/java/org/apache/solr/util/SolrCLI.java
          index 2c2898d..e13de13 100644
          --- a/solr/core/src/java/org/apache/solr/util/SolrCLI.java
          +++ b/solr/core/src/java/org/apache/solr/util/SolrCLI.java
          @@ -2904,10 +2904,14 @@ public class SolrCLI {
                       }
                     }
                   }
          -        executor.execute(org.apache.commons.exec.CommandLine.parse(startCmd), startEnv, new DefaultExecuteResultHandler());
          +        DefaultExecuteResultHandler handler  = new DefaultExecuteResultHandler()
          +        executor.execute(org.apache.commons.exec.CommandLine.parse(startCmd), startEnv, handler);
          
                   // brief wait before proceeding on Windows
                   try {
          +          handler.waitFor();
          +          System.out.print(handler.getExitValue()+" "+handler.getException());
                     Thread.sleep(3000);
                   } catch (InterruptedException ie) {
                     // safe to ignore ...
          
          Show
          mkhludnev Mikhail Khludnev added a comment - just a scratch diff --git a/solr/core/src/java/org/apache/solr/util/SolrCLI.java b/solr/core/src/java/org/apache/solr/util/SolrCLI.java index 2c2898d..e13de13 100644 --- a/solr/core/src/java/org/apache/solr/util/SolrCLI.java +++ b/solr/core/src/java/org/apache/solr/util/SolrCLI.java @@ -2904,10 +2904,14 @@ public class SolrCLI { } } } - executor.execute(org.apache.commons.exec.CommandLine.parse(startCmd), startEnv, new DefaultExecuteResultHandler()); + DefaultExecuteResultHandler handler = new DefaultExecuteResultHandler() + executor.execute(org.apache.commons.exec.CommandLine.parse(startCmd), startEnv, handler); // brief wait before proceeding on Windows try { + handler.waitFor(); + System .out.print(handler.getExitValue()+ " " +handler.getException()); Thread .sleep(3000); } catch (InterruptedException ie) { // safe to ignore ...
          Hide
          gopikannan gopikannan venugopalsamy added a comment -

          Hi,
          Shall I create a patch with this fix?

          Show
          gopikannan gopikannan venugopalsamy added a comment - Hi, Shall I create a patch with this fix?
          Hide
          mkhludnev Mikhail Khludnev added a comment -

          Yes. Please.

          Show
          mkhludnev Mikhail Khludnev added a comment - Yes. Please.
          Hide
          gopikannan gopikannan venugopalsamy added a comment -

          patch

          Show
          gopikannan gopikannan venugopalsamy added a comment - patch
          Hide
          gopikannan gopikannan venugopalsamy added a comment -

          patch, Sorry for multiple patches, first time

          Show
          gopikannan gopikannan venugopalsamy added a comment - patch, Sorry for multiple patches, first time
          Hide
          mkhludnev Mikhail Khludnev added a comment -

          [~gopi21489], the patch looks good, but isn't there a chance to provide test coverage?

          Show
          mkhludnev Mikhail Khludnev added a comment - [~gopi21489] , the patch looks good, but isn't there a chance to provide test coverage?
          Hide
          gopikannan gopikannan venugopalsamy added a comment -

          Please check this patch, Added a test case to check if SolrCLI returns failure on unable to execute script.

          Show
          gopikannan gopikannan venugopalsamy added a comment - Please check this patch, Added a test case to check if SolrCLI returns failure on unable to execute script.
          Hide
          mkhludnev Mikhail Khludnev added a comment -

          Checking the patch. It make sense:

          ERROR: Failed to start Solr using command: C:\cygwin64\home\mike\lucene-solr\solr\bin\solr.cmd start -p 8983 -s "C:\cygwin64\home\mike\lucene-solr\solr\example\techproducts\solr" Exception : org.apache.commons.exec.ExecuteException: Execution failed (Exit value: -559038737. Caused by java.io.IOException: Cannot run program "C:\cygwin64\home\mike\lucene-solr\solr\bin\solr.cmd" (in directory "."): CreateProcess error=5, Отказано в доступе)

          Show
          mkhludnev Mikhail Khludnev added a comment - Checking the patch. It make sense: ERROR: Failed to start Solr using command: C:\cygwin64\home\mike\lucene-solr\solr\bin\solr.cmd start -p 8983 -s "C:\cygwin64\home\mike\lucene-solr\solr\example\techproducts\solr" Exception : org.apache.commons.exec.ExecuteException: Execution failed (Exit value: -559038737. Caused by java.io.IOException: Cannot run program "C:\cygwin64\home\mike\lucene-solr\solr\bin\solr.cmd" (in directory "."): CreateProcess error=5, Отказано в доступе)
          Hide
          jira-bot ASF subversion and git services added a comment -

          Commit 65b4530fb39842418eae8d2acb7c463182039083 in lucene-solr's branch refs/heads/master from Mikhail Khludnev
          [ https://git-wip-us.apache.org/repos/asf?p=lucene-solr.git;h=65b4530 ]

          SOLR-9745: fix solr.cmd to print errors from invoked script

          Show
          jira-bot ASF subversion and git services added a comment - Commit 65b4530fb39842418eae8d2acb7c463182039083 in lucene-solr's branch refs/heads/master from Mikhail Khludnev [ https://git-wip-us.apache.org/repos/asf?p=lucene-solr.git;h=65b4530 ] SOLR-9745 : fix solr.cmd to print errors from invoked script
          Hide
          jira-bot ASF subversion and git services added a comment -

          Commit 8bfe8c7b2400a6ae7d3c01d9cdb69558c1aceed5 in lucene-solr's branch refs/heads/branch_6x from Mikhail Khludnev
          [ https://git-wip-us.apache.org/repos/asf?p=lucene-solr.git;h=8bfe8c7 ]

          SOLR-9745: fix solr.cmd to print errors from invoked script

          Show
          jira-bot ASF subversion and git services added a comment - Commit 8bfe8c7b2400a6ae7d3c01d9cdb69558c1aceed5 in lucene-solr's branch refs/heads/branch_6x from Mikhail Khludnev [ https://git-wip-us.apache.org/repos/asf?p=lucene-solr.git;h=8bfe8c7 ] SOLR-9745 : fix solr.cmd to print errors from invoked script
          Hide
          jira-bot ASF subversion and git services added a comment -

          Commit 3f172a019b21c0dafaa7a18e0ccd0e99b1c5f3bd in lucene-solr's branch refs/heads/master from Mikhail Khludnev
          [ https://git-wip-us.apache.org/repos/asf?p=lucene-solr.git;h=3f172a0 ]

          SOLR-9745: bring back timeout value to fix tests

          Show
          jira-bot ASF subversion and git services added a comment - Commit 3f172a019b21c0dafaa7a18e0ccd0e99b1c5f3bd in lucene-solr's branch refs/heads/master from Mikhail Khludnev [ https://git-wip-us.apache.org/repos/asf?p=lucene-solr.git;h=3f172a0 ] SOLR-9745 : bring back timeout value to fix tests
          Hide
          jira-bot ASF subversion and git services added a comment -

          Commit 63aaf9183ce773bbaaedaf20fdae46e545eb6242 in lucene-solr's branch refs/heads/branch_6x from Mikhail Khludnev
          [ https://git-wip-us.apache.org/repos/asf?p=lucene-solr.git;h=63aaf91 ]

          SOLR-9745: bring back timeout value to fix tests

          Show
          jira-bot ASF subversion and git services added a comment - Commit 63aaf9183ce773bbaaedaf20fdae46e545eb6242 in lucene-solr's branch refs/heads/branch_6x from Mikhail Khludnev [ https://git-wip-us.apache.org/repos/asf?p=lucene-solr.git;h=63aaf91 ] SOLR-9745 : bring back timeout value to fix tests
          Hide
          gopikannan gopikannan venugopalsamy added a comment -

          My bad, I saw this failure in my setup and assumed that it is unrelated. Thanks

          Show
          gopikannan gopikannan venugopalsamy added a comment - My bad, I saw this failure in my setup and assumed that it is unrelated. Thanks
          Hide
          jira-bot ASF subversion and git services added a comment -

          Commit 8b87a474cbf6873935975302dbd856c3cbef53ec in lucene-solr's branch refs/heads/branch_6x from Mikhail Khludnev
          [ https://git-wip-us.apache.org/repos/asf?p=lucene-solr.git;h=8b87a47 ]

          SOLR-9745: check exit code only if process has finished

          Show
          jira-bot ASF subversion and git services added a comment - Commit 8b87a474cbf6873935975302dbd856c3cbef53ec in lucene-solr's branch refs/heads/branch_6x from Mikhail Khludnev [ https://git-wip-us.apache.org/repos/asf?p=lucene-solr.git;h=8b87a47 ] SOLR-9745 : check exit code only if process has finished
          Hide
          jira-bot ASF subversion and git services added a comment -

          Commit 4c737b8df9b130cf530d17271576730e21d5b4cc in lucene-solr's branch refs/heads/master from Mikhail Khludnev
          [ https://git-wip-us.apache.org/repos/asf?p=lucene-solr.git;h=4c737b8 ]

          SOLR-9745: check exit code only if process has finished

          Show
          jira-bot ASF subversion and git services added a comment - Commit 4c737b8df9b130cf530d17271576730e21d5b4cc in lucene-solr's branch refs/heads/master from Mikhail Khludnev [ https://git-wip-us.apache.org/repos/asf?p=lucene-solr.git;h=4c737b8 ] SOLR-9745 : check exit code only if process has finished
          Show
          mkhludnev Mikhail Khludnev added a comment - tests are fixed https://jenkins.thetaphi.de/job/Lucene-Solr-master-Windows/6498/console
          Hide
          mkhludnev Mikhail Khludnev added a comment -
          Show
          mkhludnev Mikhail Khludnev added a comment - Thansks, gopikannan venugopalsamy

            People

            • Assignee:
              mkhludnev Mikhail Khludnev
              Reporter:
              mkhludnev Mikhail Khludnev
            • Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved:

                Development