cancel
Showing results for 
Search instead for 
Did you mean: 

Custom Cron is not working as expected

Custom Cron is not working as expected

Hi Team, 

We have custom cron scheduled with every 5 min

Currently we got an issue with cron
"[2022-04-21 21:50:04] main.WARNING: Could not acquire lock for cron job: vd_recurringcron_cronjob_cron [] []"  

We manually kill the locked cron for last one week 

Any one help us to resolve the problem 



2 REPLIES 2

Re: Custom Cron is not working as expected

Hello, 

 

You can check the below-given solution if it works for you,

 

Before doing this, disable crons and enter maintenance mode.

You will have to end up truncating all _cl tables. Then ran UPDATE mview_state SET version_id = '0'; to reset all statuses and versions to their starting position. In your case, they did not increment anymore, and index_all_invalid gave the lock error.

Then truncate cron_schedule,

 

After this, reset/reindex from CLI, clear cache, disable maintenance, and re-enable crons.

In that case: after migration, I had a lot of attributes that had their values saved per store view (not using the default setting anymore). So I think that caused a lot of trouble.

 

Anyway, before you do the above, you must clean out a lot of product and category rubble (attribute_id) where store_id <> 0 in entity varchar, text, int, decimal, mediagallery, datetime, etc.

 

In some cases, this issue is caused due to hanging cron jobs. So the solution was to kill the cron job then everything returned to its normal state.

 

I hope it works for you or points you in the right direction.

---------------------------
Regards,
Rex_M

Re: Custom Cron is not working as expected

@rexaccuweb03d6 

Hey,

You can try following ways:

  • disable cron which is stuck during cron schedule.
  • truncate cron_schedule table.
  • flush cache
  • increase time for the cron if possible and rename the cron
Problem solved? Click Kudos and "Accept as Solution".
200+ Magento 2 Extensions for Enhanced Shopping Experience.