[ 
https://issues.apache.org/jira/browse/SOLR-9360?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15433324#comment-15433324
 ] 

Shalin Shekhar Mangar edited comment on SOLR-9360 at 8/23/16 6:21 PM:
----------------------------------------------------------------------

bq. Is there no standard way, supported also by minimal OS, to effectively 
check if the port is available or not ?

Typically, startup scripts write the pid of the started process to a file and 
use that pid for figuring out if the process is still running and for killing 
the process. Solr doesn't do that which is why we have this problem.

bq. To me simply using the grep , even with the exact phrase ( 
"-Djetty.port=$SOLR_PORT"), could drive to errors.

Short of writing/using pid files, I think this is the best available workaround?

<edit> - I wasn't clear earlier but the intention is to match the whole word 
i.e. grepping for -Djetty.port=1050 should not match -Djetty.port=10500


was (Author: shalinmangar):
bq. Is there no standard way, supported also by minimal OS, to effectively 
check if the port is available or not ?

Typically, startup scripts write the pid of the started process to a file and 
use that pid for figuring out if the process is still running and for killing 
the process. Solr doesn't do that which is why we have this problem.

bq. To me simply using the grep , even with the exact phrase ( 
"-Djetty.port=$SOLR_PORT"), could drive to errors.

Short of writing/using pid files, I think this is the best available workaround?

> Solr script not properly checking SOLR_PID
> ------------------------------------------
>
>                 Key: SOLR-9360
>                 URL: https://issues.apache.org/jira/browse/SOLR-9360
>             Project: Solr
>          Issue Type: Bug
>      Security Level: Public(Default Security Level. Issues are Public) 
>          Components: scripts and tools
>    Affects Versions: 6.1
>            Reporter: Alessandro Benedetti
>            Assignee: Erick Erickson
>         Attachments: SOLR_9360.patch
>
>
> In the solr script we see in 3-4 areas  this check :
> SOLR_PID=`ps auxww | grep start\.jar | grep -w $SOLR_PORT | grep -v grep | 
> awk '{print $2}' | sort -r`
> This can potentially prevent a solr instance to start in the case another 
> process by any chance contains the port int the command itself ( not 
> necessarily actually using the port) .
> e.g.
> java -server -Djetty.port=10504 -DSTOP.PORT=9504 -DSTOP.KEY=solrrocks 
> -DMASTER_CORE_URL=external-server:10500/solr -jar start.jar --module=http
> A solr is running on 10504.
> A new Solr will not be able to start on 10500 ( but actually the port is 
> free).
> This should be replaced by a real check if the port is used ( like netstat or 
> similar) .



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

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

Reply via email to