janhoy opened a new pull request, #5325:
URL: https://github.com/apache/solr/pull/5325

   https://issues.apache.org/jira/browse/SOLR-18644
   
   `bin\solr.cmd` hardcoded `%SOLR_TIP%\bin` as the place to write and read the 
files that record running nodes, in five places. `bin/solr` has defaulted 
`SOLR_PID_DIR` to the same directory since forever and uses the variable 
throughout, and `SolrProcessManager` reads the `solr.pid.dir` system property 
that `bin/solr` passes from it — so Windows was the only one of the three 
ignoring it.
   
   A user who sets `SOLR_PID_DIR` on Windows is silently ignored today: the 
port files land in `%SOLR_TIP%\bin`, and `stop --all` and `status` then look 
there too. Self-consistent, but not what was asked for, and not what the 
documentation promises — `solr-control-script-reference.adoc` states that 
`status` uses `SOLR_PID_DIR`, and `taking-solr-to-production.adoc` tells the 
reader to set it, neither qualified to POSIX. It matters most for a packaged or 
read-only install, which is the reason the variable exists: if the installation 
directory is not writable the port file silently never appears, and `stop 
--all` then finds nothing to stop.
   
   ## What changed
   
   One default, next to the existing `SOLR_TIP` handling, and the five 
hardcoded paths replaced:
   
   ```bat
   IF NOT DEFINED SOLR_PID_DIR set "SOLR_PID_DIR=%SOLR_TIP%\bin"
   ```
   
   Same variable, same default, so nothing changes for anyone who does not set 
it.
   
   ## Testing
   
   Verified on a Windows 11 ARM64 VM: with `SOLR_PID_DIR` set, the port file is 
written there, and `stop --all` and `status` find the node through it; unset, 
behaviour is unchanged.
   
   No automated test comes with this, because Solr has no test that runs 
`bin\solr.cmd` at all. That is exactly what SOLR-18642 / #5323 adds, and that 
harness is where this bug was found — it cannot run test classes in parallel on 
Windows without this fix, since `stop --all` walks this directory. Once the 
harness lands, `NoPidFileTest` and the parallel-isolation machinery cover this 
on Windows continuously.
   
   Not addressed here: the pid file spelling still differs between the 
platforms (`solr-<port>.pid` on bash, `solr-<port>.port` on Windows), which 
`SolrProcessManager.pidFilePattern` already copes with.
   
   🤖 AI Assisted
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


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

Reply via email to