magento / magento-cloud-docker

All Submissions you make to Magento Inc. (“Magento") through GitHub are subject to the following terms and conditions: (1) You grant Magento a perpetual, worldwide, non-exclusive, no charge, royalty free, irrevocable license under your applicable copyrights and patents to reproduce, prepare derivative works of, display, publically perform, sublicense and distribute any feedback, ideas, code, or other information (“Submission") you submit through GitHub. (2) Your Submission is an original work of authorship and you are the owner or are legally entitled to grant the license stated above. (3) You agree to the Contributor License Agreement found here: https://github.com/magento/magento2/blob/master/CONTRIBUTOR_LICENSE_AGREEMENT.html
Open Software License 3.0
256 stars 192 forks source link

Cron container runs out of memory #347

Open MagicLegend opened 2 years ago

MagicLegend commented 2 years ago

Preconditions

  1. Use --with-cron to generate configs
  2. I'm gonna assume a default Magento won't have this issue, but our installation has about 30 packages in the composer.json, so not a big store imo.

Steps to reproduce

  1. Start the containers
  2. Start the cron (make sure it's enabled in env.php - otherwise you'll be searching like me why it's not working since it's not mentioned in the docs...)
  3. Observe the log file

Expected result

  1. Happy cron jobs

Actual result

  1. Sad cron jobs

image

What can be investigated is why the cron job thinks it only has 2MB of memory, when PHP was configured for 2GB.

Solution

  1. Allocate more memory to the cron by changing the CRONTAB environment to:
    CRONTAB: '* * * * * root cd /app && /usr/local/bin/php -d memory_limit=-1 bin/magento cron:run >> /app/var/log/cron.log'