0

My server for Magento2 is running out of memory, and when I look at the processes, I see a log of cron jobs running, some of them have been running for more than 20 minutes. I killed all cron job processes, but after a minute, they all come back again. When I look at crontab -e, I see the following command that is running every minute, is this normal in Magento2 to have this cron job running every minute? And what can it be that the job doesn't finish?

*      *       *       *       *       /usr/bin/php /public/bin/magento cron:run | grep -v "Ran jobs by schedule" >> /public/var/log/magento.cron.log

This is what I found in magento.cron.log

Warning: proc_open(): fork failed - Cannot allocate memory in /public/vendor/symfony/console/Application.php on line 959#0 [internal function]:$
#1 /public/vendor/symfony/console/Application.php(959): proc_open('stty -a | grep ...', Array, NULL, NULL, NULL, Array)
#2 /public/vendor/symfony/console/Application.php(761): Symfony\Component\Console\Application->getSttyColumns()
#3 /public/vendor/symfony/console/Application.php(722): Symfony\Component\Console\Application->getTerminalDimensions()
#4 /public/vendor/symfony/console/Application.php(656): Symfony\Component\Console\Application->getTerminalWidth()
#5 /public/vendor/symfony/console/Application.php(127): Symfony\Component\Console\Application->renderException(Object(Exception), Object(Symfon$
#6 /public/bin/magento(23): Symfony\Component\Console\Application->run()
#7 {main}
1

I found it out. It is due to some old cron jobs that is never finished.

So I cleared the table cron_shcedule, then cronjob is working as normal again.

0

You can remove some ENTRIES from cron_shcedule table.

delete from cron_schedule where status = 'error'; delete from cron_schedule where status = 'missed'; delete from cron_schedule where status = 'success';

Thanks! Nithin Ninan

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.