[ 
https://issues.apache.org/jira/browse/SOLR-18647?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

ASF GitHub Bot updated SOLR-18647:
----------------------------------
    Labels: cats pull-request-available windows  (was: cats windows)

> bin/solr.cmd silently ignores "stop --all" whenever SOLR_PORT_LISTEN is set
> ---------------------------------------------------------------------------
>
>                 Key: SOLR-18647
>                 URL: https://issues.apache.org/jira/browse/SOLR-18647
>             Project: Solr
>          Issue Type: Bug
>          Components: cli
>            Reporter: Jan Høydahl
>            Priority: Major
>              Labels: cats, pull-request-available, windows
>          Time Spent: 10m
>  Remaining Estimate: 0h
>
> *Found by CATS*, the cross-platform CLI test framework proposed in SOLR-18642 
> — see [PR #5323|https://github.com/apache/solr/pull/5323]. Two tests there 
> expose this, and will be marked {{@AwaitsFix}} against this issue so the 
> suite stays green. A fix can land before CATS is merged or after; if it lands 
> first, please also drop the {{@AwaitsFix}} annotation from those two tests on 
> that PR.
> h3. The bug
> {{bin/solr.cmd}} nests the whole {{--all}} implementation inside a test for 
> the port being unset:
> {code}
> 826: IF "%SOLR_PORT_LISTEN%"=="" (
> 827:   IF "%STOP_ALL%"=="1" (
>             ... walks %SOLR_PID_DIR%, stops every node it finds ...
> 860:     if "!found_it!"=="0" echo No Solr nodes found to stop.
>        )
> 865: ) ELSE (
>             ... stops exactly %SOLR_PORT_LISTEN% ...
> 887:   if "!found_it!"=="0" echo No Solr found running on port 
> %SOLR_PORT_LISTEN%
> {code}
> So when a port is in effect, {{--all}} is parsed, accepted, and then ignored: 
> control goes to the single-port branch and {{STOP_ALL}} is never read again. 
> The user is not told.
> {{bin/solr}} has no such condition — its {{--all}} branch at line 951 ({{if 
> $stop_all; then}}) runs whenever the command is {{stop}}, so the two scripts 
> disagree about precedence.
> h3. Why this is the ordinary case, not an exotic one
> {{SOLR_PORT_LISTEN}} is a documented setting in {{solr.in.cmd}}, and it also 
> comes from the environment and from {{-p}}. Anyone who pins the port that way 
> loses {{solr stop \-\-all}} entirely, silently.
> h3. Evidence
> From the first full run of the CATS suite under cmd.exe:
> {{StartSolrTest.solr11740CheckSolrStopConnection}} starts nodes on 22158 and 
> 22159, then {{solr stop \-\-all}} exits 0 having printed only {{Stopping Solr 
> process 7116 running on port 22158}} — node 22159 is still running 
> afterwards. {{\-\-all}} stopped one node of two.
> {{NoPidFileTest.stopAllReportsWhenItStoppedNothing}} runs {{solr stop 
> \-\-all}} with nothing running and gets {{No Solr found running on port 
> 22150}}, the single-port message at line 887. The global {{No Solr nodes 
> found to stop.}} at line 860 is unreachable, which is why the assertion fails 
> even though {{solr.cmd}} contains that exact string.
> h3. Secondary, not worth its own issue
> The two scripts word a graceful stop differently: {{bin/solr}} prints 
> {{Sending stop command}}, {{solr.cmd}} prints {{Stopping Solr process N 
> running on port P}}. A parity nit, worth folding in if a fix touches those 
> lines.
> 🤖 AI Assisted



--
This message was sent by Atlassian Jira
(v10.3.26#10030026)

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to