Jan Høydahl created SOLR-18661:
----------------------------------

             Summary: Windows: write a real PID file instead of the .port file
                 Key: SOLR-18661
                 URL: https://issues.apache.org/jira/browse/SOLR-18661
             Project: Solr
          Issue Type: Improvement
          Components: scripts and tools
            Reporter: Jan Høydahl


h3. Background
{{bin\solr.cmd}} has written {{solr\-<port>.port}} into {{SOLR_PID_DIR}} since 
the original start script (SOLR-3617, 2014): {{START /B}} gives cmd.exe no 
handle on the child's PID, so the script records the port and resolves port to 
PID with {{netstat \-aon}} when stopping. {{bin/solr}} writes 
{{solr\-<port>.pid}} from {{$!}}.

h3. Who reads these files today
* {{bin/solr stop}}: the PID file for {{\-p}} (with a {{ps}} fallback), 
{{\-\-all}} walks {{solr\-*.pid}}, the no-port form stops the single node that 
has one.
* {{bin\solr.cmd stop}}: {{\-\-all}} walks {{solr\-*.port}} and maps each port 
to a PID with netstat; {{\-p}} deletes the file.
* {{SolrProcessManager.scanSolrPidFiles()}}, called by {{solr status}}, reads 
both kinds only to prune stale ones; discovery scans live processes 
(SOLR-18607).
* {{bin/systemd/solr.service}} is {{Type=forking}} without {{PIDFile=}}; 
SOLR-18633 wants the PID file in {{/run}}.
* The CATS harness (SOLR-18642) deletes both after a force-kill.

h3. Proposal
* 10.2: {{solr.cmd}} writes {{solr\-<port>.pid}}, resolving the PID the way 
{{stop}} already does (netstat on the listen port, after the start wait), and 
both {{solr.cmd}} and {{SolrProcessManager}} read only PID files from then on. 
The {{.port}} file is still written, purely for external scripts that may 
depend on it, and is deprecated in the 10.2 upgrade notes.
* 11.0: stop writing the {{.port}} file. Nothing else changes, since nothing of 
ours reads it any more.
* A foreground start ({{\-f}}) writes no file on either platform, as 
{{bin/solr}} already does.




--
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