2

Unable to send any kind emails (order, invoice, tracking). I get confirmation that it was sent, but nothing received. Same with "Contact us" from frontend.

cron.log:

main.WARNING: Could not acquire lock for cron job: sales_send_order_emails

main.WARNING: Could not acquire lock for cron job: sales_send_order_shipment_emails

main.WARNING: Could not acquire lock for cron job: sales_send_order_invoice_emails

main.WARNING: Could not acquire lock for cron job: outdated_authentication_failures_cleanup

main.WARNING: Could not acquire lock for cron job: bulk_cleanup

Permissions are correct (i think): enter image description here enter image description here

Magento 2.3.5-p2, PHP 7.2

Problem persisted after upgrade to Magento 2.4 and PHP 7.3 and 7.4

Couldn't find much online about "Could not acquire lock for cron job".

Any help will do.

1
  • Have you checked M2 core source code for this sentence: "Could not acquire lock for cron job"? Have you tried to run cron manually with magerun using a step by step with Xdebug? Commented Aug 17, 2020 at 3:30

2 Answers 2

3

I guess Magento cron job is stuck in "running" status. Need to kill the stuck cron job then it will continue as scheduled.

  1. Log in to your account using SSH.
  2. Run the following command to locate hanging cron jobs: $ ps ufx | grep cron
  3. To stop the cron from running, kill the command by referencing the PID. Run the following command to terminate the command: $ kill -9 PID

For more detail, please refer to these links: Link-1 Link-2

2
  • No hanging cron jobs. Did this before posting question.
    – Aliokas
    Commented Aug 16, 2020 at 18:12
  • This is the most likely scenario if you are facing this issue. Killing the stuck process solve these case. This free module made by Mageplaza is also helpful: mageplaza.com/magento-2-cron-schedule Commented May 7, 2022 at 14:59
0

Apparently it was fault with permissions in

/var/spool/mqueue

and

/var/spool/mqueue-client

Changing permissions got rid of these errors.

enter image description here

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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