The following error occurs whenever the following command is executed:
# '/bin/systemctl stop pki-tomcatd@redhat.com-foobar.service' Contents of '/var/log/messages': ... Jun 7 09:29:29 pkilinux systemd[1]: pki-tomcatd@redhat.com-foobar.service: main process exited, code=exited, status=143 Jun 7 09:29:29 pkilinux systemd[1]: Unit pki-tomcatd@redhat.com-foobar.service entered failed state.
The current code adds the following temporary comment to precede the error message in '/var/log/messages':
Jun 7 09:29:25 pkilinux pkidaemon[29705]: An exit status of '143' refers to the 'systemd' method of using 'SIGTERM' to shutdown a Java process and can safely be ignored. Jun 7 09:29:29 pkilinux systemd[1]: pki-tomcatd@redhat.com-foobar.service: main process exited, code=exited, status=143 Jun 7 09:29:29 pkilinux systemd[1]: Unit pki-tomcatd@redhat.com-foobar.service entered failed state.
This is a known error, and the following work-around has been proposed by Lennart Poettering:
On Mon, 28.11.11 15:12, Chris Paulson-Ellis (chris at edesix.com) wrote: > Hi, > > I'm running a Java JVM service using: > > ExecStart=/usr/bin/java -jar foo.jar > > When I stop the service with systemctl, it goes into the failed > state because the JVM exits with status 143 instead of 0. > > There doesn't seem to be any way to get a JVM to exit(0) on SIGTERM. > You can run code on the signal with Runtime.addShutdownHook(), but > you cannot call Runtime.exit(0) from within a shutdown hook, so you > cannot influence the exit status. > > Is there any way to get systemd to treat the 143 exit status as > normal termination if it sent a SIGTERM? I'd rather not write a > signal catching C or shell-script wrapper around the JVM as I'll > probably introduce a race condition or other error. Use ExecStart=-/usr/bin/java... (i.e. add the - in there, to ignore failure exit codes) Lennart -- Lennart Poettering - Red Hat, Inc.
Another suggested alternative was to start the Java process with the '-Xrs' flag, but this may also have some un-intended side-effects.
Since both of these proposed work-arounds may inadvertently suppress error messages that could be reporting important errors, I would like to propose that we figure out a way to implement a trap-ignore-signal handling method to only catch and ignore signal '143'.
Upon thinking about this, I believe that issuing the warning message about the well-known 143 exit status may be the best solution, as if this is to truly be fixed, either JVMs or systemd should handle this exit case.
Metadata Update from @mharmsen: - Issue assigned to mharmsen - Issue set to the milestone: 10.0.1
Dogtag PKI is moving from Pagure issues to GitHub issues. This means that existing or new issues will be reported and tracked through Dogtag PKI's GitHub Issue tracker.
This issue has been cloned to GitHub and is available here: https://github.com/dogtagpki/pki/issues/773
If you want to receive further updates on the issue, please navigate to the GitHub issue and click on Subscribe button.
Subscribe
Thank you for understanding, and we apologize for any inconvenience.