5

tomcat 9 with ubuntu 18.04. tomcat service status:

● tomcat.service - Tomcat 9 servlet container
   Loaded: loaded (/etc/systemd/system/tomcat.service; enabled; vendor preset: enabled)
   Active: failed (Result: signal) since Thu 2020-03-26 03:00:31 UTC; 3h 33min ago
  Process: 8815 ExecStop=/opt/tomcat/latest/bin/shutdown.sh (code=exited, status=0/SUCCESS)
  Process: 8858 ExecStart=/opt/tomcat/latest/bin/startup.sh (code=exited, status=0/SUCCESS)
 Main PID: 8865 (code=killed, signal=KILL)

catalina.out says nothing. syslog says

Mar 26 03:00:31 user systemd[1]: tomcat.service: Main process exited, code=killed, status=9/KILL
Mar 26 03:00:31 user systemd[1]: tomcat.service: Failed with result 'signal'.
Mar 26 03:17:08 user systemd[1]: Reloading The Apache HTTP Server.
Mar 26 03:17:08 user systemd[1]: Reloaded The Apache HTTP Server.

The service was dead but manually restarting the service succeeded.

What can I check in order to know what killed tomcat?

What can I do to restart tomcat in case something like that happens in the future?

Thanks

Amos
  • 257
  • 3
  • 4
  • 10

1 Answers1

11

Unless a cruel sysadmin gave it kill -9, I would suspect that Linux kernel's OOM (Out of memory killer) did kill the process. Check if dmesg hints towards that direction. If so, inspect if your server has enough RAM for the tomcat to run comfortably and/or if you could tune the tomcat memory settings.

Janne Pikkarainen
  • 31,852
  • 4
  • 58
  • 81
  • Thanks. where can I check this "Check if dmesg hints towards that direction"? Yesterday there was enough ram but now I remembered that clamav is running at 3 so this may have caused this. How can I restart tomcat in case such thing happens? – Amos Mar 26 '20 at 12:01
  • Dmsg is in /var/log/ how to automatically restart is part of sysctl. Although you should not automatically restart until you understand the problem. – Rowan Hawkins Mar 26 '20 at 18:01
  • You can also check kern.log using: tail -100 /var/log/kern.log Look out for lines similar to: "Out of memory: Killed process 519 (java) total-vm:2534060kB, anon-rss:579552kB, file-rss:0kB, shmem-rss:0kB, UID:997 pgtables:1660kB oom_score_adj:0" – Seun Matt Apr 11 '21 at 20:18