colvinco opened a new pull request #250:
URL: https://github.com/apache/solr/pull/250


   https://issues.apache.org/jira/browse/SOLR-15558
   
   <!--
   _(If you are a project committer then you may remove some/all of the 
following template.)_
   
   Before creating a pull request, please file an issue in the ASF Jira system 
for Solr:
   
   * https://issues.apache.org/jira/projects/SOLR
   
   You will need to create an account in Jira in order to create an issue.
   
   The title of the PR should reference the Jira issue number in the form:
   
   * SOLR-####: <short description of problem or changes>
   
   SOLR must be fully capitalized. A short description helps people scanning 
pull requests for items they can work on.
   
   Properly referencing the issue in the title ensures that Jira is correctly 
updated with code review comments and commits. -->
   
   
   # Description
   
   Identify zombie processes when stopping Solr, since a zombie has already 
terminated there is no need to wait 3 minutes.
   Also simplified some of the other `ps` usage to filter by id rather than 
`grep`ing.
   
   # Solution
   
   `ps -o stat --no-headers $SOLR_PID` will output the STAT for a process (if 
it is running). If the process is a Zombie/defunct then the stat will be `Z`. 
If the process isn't running then no output will be generated.
   Also simplified some of the other `ps` usage to filter by id rather than 
`grep`ing.
   GitHub makes the diff look bigger than it is
   
   # Tests
   
   Manually checked on Ubuntu 16.04.6 in a docker container, by starting and 
stopping Solr.
   
   When running `solr stop` inside a container that was started with `docker 
run -dit <image> tail -f /dev/null` [the docker PID 1 reaping problem 
occurs](https://issues.apache.org/jira/browse/SOLR-15558) and the following 
output is generated without this patch (and 3 minutes elapses):
   ```
   root@6683526ba504:/opt/solr-8.9.0# bin/solr stop
   Sending stop command to Solr running on port 8983 ... waiting up to 180 
seconds to allow Jetty process 454 to stop gracefully.
   Solr process 454 is still running; jattach threaddumping it now.
   Could not start attach mechanism: No such file or directory
   Solr process 454 is still running; forcefully killing it now.
   Killed process 454
   ERROR: Failed to kill previous Solr Java process 454 ... script fails.
   ```
   with this patch:
   ```
   root@b457f11bf485:/opt/solr-8.9.0# bin/solr stop
   Sending stop command to Solr running on port 8983 ... waiting up to 180 
seconds to allow Jetty process 2288 to stop gracefully.
   Solr process 2288 has terminated abnormally. Solr has exited but a zombie 
process entry remains.
   ```
   On a container that is started with  `docker run -dit --init <image> tail -f 
/dev/null` the reaping problem doesn't occur and the following output is 
generated with or without the patch and the process terminates normally:
   ```
   root@262baa4c3c28:/opt/solr-8.9.0# bin/solr stop
   Sending stop command to Solr running on port 8983 ... waiting up to 180 
seconds to allow Jetty process 135 to stop gracefully.
   ```
   
   
   # Checklist
   
   Please review the following and check all that apply:
   
   - [x] I have reviewed the guidelines for [How to 
Contribute](https://wiki.apache.org/solr/HowToContribute) and my code conforms 
to the standards described there to the best of my ability.
   - [x] I have created a Jira issue and added the issue ID to my pull request 
title.
   - [x] I have given Solr maintainers 
[access](https://help.github.com/en/articles/allowing-changes-to-a-pull-request-branch-created-from-a-fork)
 to contribute to my PR branch. (optional but recommended)
   - [x] I have developed this patch against the `main` branch.
   - [ ] I have run `./gradlew check`.
   - [ ] I have added tests for my changes.
   - [ ] I have added documentation for the [Reference 
Guide](https://github.com/apache/solr/tree/main/solr/solr-ref-guide)
   


-- 
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: issues-unsubscr...@solr.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscr...@solr.apache.org
For additional commands, e-mail: issues-h...@solr.apache.org

Reply via email to