0

My apps deployed as debians and started using systemd service.The app is getting crashed randomly. I am unable to find the reason for the crash.

I have 4 applications running[built using java, scala], out of which two are getting killed(named as op and common). All are started using systemd services.

Error on syslog is

Jul 22 11:45:44 misqa mosquitto[2930]: Socket error on client 005056b76983-Common, disconnecting

Jul 22 11:45:44 misqa systemd[1]: commonmod.service: Main process exited, code=exited, status=143/n/a

Jul 22 11:45:44 misqa systemd[1]: commonmod.service: Unit entered failed state

Jul 22 11:45:44 misqa systemd[1]: commonmod.service: Failed with result 'exit-code'

Jul 22 11:45:44 misqa systemd[1]: opmod.service: Main process exited, code=exited, status=143/n/a

Jul 22 11:45:44 misqa systemd[1]: opmod.service: Unit entered failed state

Jul 22 11:45:44 misqa systemd[1]: opmod.service: Failed with result 'exit-code'

But I am not getting any error on my application log file for both op and common

When I read more, I understood that the reason for crash is due to SIGTERM command, but unable to find out what is causing it. In any of these applications, I dont have exec commands for killall.

Is there anyway to identify which process is killing my applications.

My systemd service is like this:

[Unit]
Description=common Module
After=common-api
Requires=common-api

[Service]
TimeoutStartSec=0
ExecStart=/usr/bin/common-api

[Install]
WantedBy=multi-user.target
Yadu Krishnan
  • 3,492
  • 5
  • 41
  • 80

1 Answers1

0

Basically Java programs sometimes don't send back the expected exit status when shutting down in response to SIGTERM.

You should be able to suppress this by adding the exit code into the systemd service file as a "success" exit status:

[Service]
SuccessExitStatus=143

This solution was sucessful applied here (serverfault) and here (stasckoverflow) both with java apps.

Esli Silva
  • 521
  • 6
  • 10