CRON error (no such table: cache_locks) but app works?

Hello, I’ve been struggling with cron since I tried implementing it. I followed the docs and added the “cron -f” line to fly.toml.

However, when I SSH into the machines with fly ssh console -s I get the following:
“app” machine:

/var/www/html# php artisan schedule:list

  0 9 * * *  Closure at: routes/console.php:13 ... Next Due: 18 hours from now

“cron” machine:

var/www/html# php artisan schedule:list
{"message":"SQLSTATE[HY000]: General error: 1 no such table: cache_locks (Connection: sqlite, SQL: update \"cache_locks\" set \"owner\" = qG8p8rBKf3f3v9, \"expiration\" = 1723731362 where \"key\" = laravel_cache_framework/schedule-da39a3ee5ed3255bfef95601890afd80709 and (\"owner\" = qG8UMprBKf3f3v9 or \"expiration\" <= 1723644962))","context":{"exception":{"class":"Illuminate\\Database\\QueryException","message":"SQLSTATE[HY000]: General error: 1 no such table: cache_locks (Connection: sqlite, SQL: update \"cache_locks\" set \"owner\" = qG8UMp8rBKf3f3v9, \"expiration\" = 1723731362 where \"key\" = laravel_cache_framework/schedule-da39a3eef95601890afd80709 and (\"owner\" = qG8UMp8rBKf39 or \"expiration\" <= 1723644962))","code":0,"file":"/var/www/html/vendor/laravel/framework/src/Illuminate/Database/Connection.php:813","previous":{"class":"PDOException","message":"SQLSTATE[HY000]: General error: 1 no such table: cache_locks","code":0,"file":"/var/www/html/vendor/laravel/framework/src/Illuminate/Database/Connection.php:592"}}},"level":400,"level_name":"ERROR","channel":"production","datetime":"2024-08-14T14:16:02.469295+00:00","extra":{}}

In Connection.php line 813:
                                                                               
  SQLSTATE[HY000]: General error: 1 no such table: cache_locks (Connection: s  
  qlite, SQL: update "cache_locks" set "owner" = qG8UBKf3, "expiratio  
  n" = 1723731362 where "key" = laravel_cache_framework/schedule-da39a3ee5e6b  
  4b0d3255bfef95601899 and ("owner" = qG8UMp8rBKf3 or "expiration  
  " <= 1723644962))                                                            
                                                                               

In Connection.php line 592:
                                                                
  SQLSTATE[HY000]: General error: 1 no such table: cache_locks  

I can’t find any other issues, so I’m guessing the reason why my scheduled tasks aren’t working is due to this.

Any advice?

Can you SSH into your ‘cron’ instance and run ps aux | grep cron and see if you get a result for ‘cron -f’ ?

when you run cron -f command it essentially looks for a directory like etc/cron.d/ and loads cron jobs defined in this location.

Uploading your Dockerfile would help in understanding if there’s any issue.
You might find solutions in this post to be useful-Laravel Scheduler Cron Not Working

These are good finds! The specific DBMS itself is also relevant, I think:

With multiple machines, this is more likely to be a misconfiguration than intentional…

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.