2

Every day, at just after 0625, my Java web server application crashes. In the system log, I get something resembling the following:

Jan 20 06:25:09 qswp-portal kernel: [724576.041037] Out of memory: Kill process 21435 (java) score 199 or sacrifice child
Jan 20 06:25:09 qswp-portal kernel: [724576.043434] Killed process 21435 (java) total-vm:2266296kB, anon-rss:257212kB, file-rss:6232kB

The application is running on a very small box, just 512MB of RAM (with 1GB swap), and ideally I'd like to keep it that way.

After a bit of searching around, I discovered that the daily cron jobs are scheduled to run at 0625, and this is presumably the cause (i.e. too much going on at once for the box to handle).

Is there anything I can do to prevent this happening - staggering the daily cron jobs perhaps? Is there a particular daily cron job that is likely to be causing this issue?

This is a relatively recent problem, and seems to have only started happening after doing an update (with apt-get update). Unfortunately, I've only just realised this so I'm not sure exactly which update is likely to be the problem (assuming it's not just a coincidence).

Edit: As requested, here is the output of free -h under a normal load.

              total        used        free      shared  buff/cache   available
Mem:           488M        335M         10M        2.9M        142M        122M
Swap:          1.0G         21M        1.0G
  • Consider adding the output of the command free to your question to show the memory usage during "normal" load. – gsxruk Jan 20 '17 at 13:50
  • "After a bit of searching around, I discovered that the daily cron jobs are scheduled to run at 0625, and this is presumably the cause (i.e. too much going on at once for the box to handle)." Restart the java app after the cron job finished? – Rinzwind Jan 20 '17 at 14:09
  • That's what I've done as a stop gap, although it doesn't feel like the right solution long term. I would hope that there is a way to correctly configure Ubuntu so that it doesn't crash my app once a day. – James Baker Jan 20 '17 at 14:12
  • I'd consider installing a resource monitor such as sysstat (even temporarily) and then take a look at the memory usage over 24 hours. This should help identify what is causing the issue. Once you know this, you can look into the options to fix it. – gsxruk Jan 20 '17 at 14:41
0

Your system is running out of memory. Either add more memory or work out which processes that uses up memory, f.ex. your java process, and reduce the amount of memory used.

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.