Ubuntu 18.04. 2 GB RAM + 512 MB swap.
When running clamav, it consumes more than 800MB of memory as it loads all the signatures into memory. For this reason, I have configured it to operate everyday at 3 am instead of continuing.
Until now, tomcat and clamav got along very well. At 3 am yesterday evening, the tomcat service was closed when clamav started operating.
(4643256.375812) OOM killed process 8145 (clamscan) total-vm:1149268kB, anon-rss:969476kB, file-rss:4kB (7667218.452649) OOM killed process 8865 (java) total-vm:4568248kB, anon-rss:1067312kB, file-rss:0kB 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.
I know the upgrade is an immediate answer, but until then, my questions are:
Is there a way to run clamav without consuming 800 + mb?
Is there a way to automatically restart Tomcat if something like this happens again?
Did Java really take 4,568,248 KB = 4.5 GB or is something missing?