New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Bug: elasticsearch PID file writing fails #8771
Comments
is it possible that |
I got two more failure modes:
2 when I use no path at all (i.e. specifying a PID file in the local working directory) I get
@s1monw were you able to reproduce the issue? |
This change fixes various failure modes on PID file creation which have been introduced by using nio: - check if PID file has a directory part - Allow PID directory creation fail w/ FileAlreadyExistsException (thrown if directory exists and is a soft link) - create PID file if it doesn't exist, truncate it if it does fixes elastic#8771 Signed-off-by: Thilo Fromm <github@thilo-fromm.de>
@s1monw wrote
Looking at this agan, actually, yes, it exists and is a soft link to a directory. D'uh. The other failure modes' causes were
All gone if you accept my pull request. |
yes that is what I figured... yet there are more problems with this as you also found out. The real problem is that there is no tests for this at all which is a pain and needs to be fixed. I didn't see your PR until now and I fixed it this morning as well. I factored it out and added unittests so this doesn't happen again. I also found out that |
I disagree - integration tests for this exists but they run too late and don't have enough variation. We need to have tests that fail while you develop everything else is error prone and from the last decade IMO. Stuff can happen once but never more than once because we need to add tests for it. |
This commit factors out the PID file creation from bootstrap and adds tests for error conditions etc. We also can't rely on DELETE_ON_CLOSE since it might not even write the file depending on the OS and JVM implementation. This impl uses a shutdown hook to best-effort remove the pid file if it was written. Closes elastic#8771
Prerequisites
Steps to reproduce
mvn -DskipTests=true package
cd target/releases; tar xzf elasticsearch-2.0.0-SNAPSHOT.tar.gz
elasticsearch-2.0.0-SNAPSHOT/bin/elasticsearch -p /var/run/es-fail.pid
Expected result
Actual result
elasticsearch instantly produces a stack trace and crashes:
Further information
Checking Bootstrap.java yields:
Ping @s1monw :)
The text was updated successfully, but these errors were encountered: