1

When I start a java program by shell, everything is working well. However if I start the same program with the same command and same user by CRON, I get a java.lang.OutOfMemoryError just after a few seconds.

Additionally CRON isn't able to do anything as long as I don't kill the blocked java program. No matter which cronjob should be started, it always ends up with "(CRON) error (can't fork)" in syslog. After killing the java program all new cronjobs are working fine again.

The java program creates many threads (1500 at startup, more afterwards) and - when started by crontab - it always begins to hang just after 475 threads have been created. So maybe it's more something like "OutOfThreads" even OutOfMemory is logged.

For testing purpose I reduced the number of initial threads to 450 and with this setting everything works fine for some minutes (until more threads should be created). However I really need those 1500+ threads and I have no clue why this isn't possible when the java program has been started by crontab. As mentioned, everything works perfectly fine as long as I start the program by shell and not by crontab.

The problem only occurs with Ubuntu 16.04, all older versions worked very well. Is this a bug or a new security feature? I didn't find any information about this issue, so I hope anyone may help.

DOB
  • 11
  • 1

0 Answers0