madrob commented on a change in pull request #250:
URL: https://github.com/apache/solr/pull/250#discussion_r798964034
##########
File path: solr/bin/solr
##########
@@ -884,8 +887,12 @@ function stop_solr() {
sleep 10
fi
- CHECK_PID=`ps auxww | awk '{print $2}' | grep -w $SOLR_PID | sort -r | tr -d
' '`
- if [ "$CHECK_PID" != "" ]; then
+ STAT=`ps -o stat='' $SOLR_PID | tr -d ' '`
+ if [ "$STAT" == "Z" ]; then
+ # This can happen if, for example, you are running Solr inside a docker
container with multiple processes
+ # rather than running it is as the only service. The --init flag on docker
avoids that particular problem.
+ echo -e "Solr process $SOLR_PID has terminated abnormally. Solr has exited
but a zombie process entry remains."
Review comment:
Is this considered an error condition? I'm not sure. Maybe worthwhile to
`exit 1` still? I'm not sure what your code calling this script would expect.
##########
File path: solr/bin/solr
##########
@@ -842,34 +842,37 @@ function stop_solr() {
STOP_KEY="$3"
SOLR_PID="$4"
- if [ "$SOLR_PID" != "" ]; then
- echo -e "Sending stop command to Solr running on port $SOLR_PORT ...
waiting up to $SOLR_STOP_WAIT seconds to allow Jetty process $SOLR_PID to stop
gracefully."
- "$JAVA" $SOLR_SSL_OPTS $AUTHC_OPTS -jar "$DIR/start.jar"
"STOP.PORT=$THIS_STOP_PORT" "STOP.KEY=$STOP_KEY" --stop || true
- (loops=0
- while true
- do
- CHECK_PID=`ps auxww | awk '{print $2}' | grep -w $SOLR_PID | sort -r |
tr -d ' '`
- if [ "$CHECK_PID" != "" ]; then
- slept=$((loops * 2))
- if [ $slept -lt $SOLR_STOP_WAIT ]; then
- sleep 2
- loops=$[$loops+1]
- else
- exit # subshell!
- fi
- else
- exit # subshell!
- fi
- done) &
- spinner $!
- rm -f "$SOLR_PID_DIR/solr-$SOLR_PORT.pid"
- else
+ if [ -z "$SOLR_PID" ]; then
Review comment:
nit: can we change this test to `-n` so that we minimize the diff a
little bit? Makes it easier to review.
--
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]