Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

TiDJ's avatar
Level 15

Queue Empting and Supervisor fail

Hello,

I upgraded my project from Laravel 10 to Laravel 11, and since then I've been having issues with my Redis queue.

The data (pending tasks, completed tasks, etc.) gets cleared out periodically, every few seconds to a few minutes. Sometimes, the supervisor also restarts.

I don't understand where this is coming from, as I only changed the Laravel version.

Has anyone else encountered this issue?

I also have some strange logs, which went from: 14218:M 11 Sep 2024 09:31:49.050 * 10000 changes in 60 seconds. Saving... 14218:M 11 Sep 2024 09:31:49.062 * Background saving started by pid 19262 19262:C 11 Sep 2024 09:31:51.055 * DB saved on disk 19262:C 11 Sep 2024 09:31:51.063 * Fork CoW for RDB: current 7 MB, peak 7 MB, average 4 MB 14218:M 11 Sep 2024 09:31:51.084 * Background saving terminated with success To :

So, from around 5-7 MB to 0-1 MB. 14218:M 11 Sep 2024 09:33:53.051 * 10000 changes in 60 seconds. Saving... 14218:M 11 Sep 2024 09:33:53.056 * Background saving started by pid 20314 20314:C 11 Sep 2024 09:33:53.059 * DB saved on disk 20314:C 11 Sep 2024 09:33:53.060 * Fork CoW for RDB: current 1 MB, peak 1 MB, average 0 MB 14218:M 11 Sep 2024 09:33:53.157 * Background saving terminated with success Thanks and have a great day!

0 likes
1 reply
LaryAI's avatar
Level 58

It sounds like you're experiencing issues with your Redis queue and Supervisor after upgrading from Laravel 10 to Laravel 11. Here are a few steps you can take to diagnose and potentially resolve the issue:

  1. Check Supervisor Configuration: Ensure that your Supervisor configuration is correct and hasn't been altered during the upgrade. Specifically, check the supervisord.conf file and the configuration files for your Laravel queue workers.

    [program:laravel-worker]
    process_name=%(program_name)s_%(process_num)02d
    command=php /path/to/your/project/artisan queue:work redis --sleep=3 --tries=3 --timeout=90
    autostart=true
    autorestart=true
    user=youruser
    numprocs=8
    redirect_stderr=true
    stdout_logfile=/path/to/your/project/worker.log
    
  2. Check Redis Configuration: Verify your Redis configuration, especially the persistence settings. The logs you provided indicate frequent background saving, which might be related to the issue.

    # redis.conf
    save 900 1
    save 300 10
    save 60 10000
    

    Ensure that the save directives are set appropriately for your use case. You might also want to check the maxmemory and maxmemory-policy settings to ensure Redis isn't evicting keys unexpectedly.

  3. Check Laravel Queue Configuration: Ensure that your config/queue.php configuration file is set up correctly for Redis. Pay attention to the retry_after and block_for settings.

    'redis' => [
        'driver' => 'redis',
        'connection' => 'default',
        'queue' => env('REDIS_QUEUE', 'default'),
        'retry_after' => 90,
        'block_for' => null,
    ],
    
  4. Check for Laravel 11 Changes: Review the Laravel 11 upgrade guide and changelog to see if there are any changes that might affect your queue or Redis configuration. There might be breaking changes or new configurations that need to be adjusted.

  5. Monitor Logs: Keep an eye on your Laravel logs (storage/logs/laravel.log) and Supervisor logs to see if there are any errors or warnings that could provide more insight into the issue.

  6. Redis Memory Usage: Monitor Redis memory usage to ensure it isn't hitting any limits. You can use the INFO command in the Redis CLI to get detailed information about memory usage.

    redis-cli INFO memory
    
  7. Upgrade Redis: Ensure that your Redis server is up to date. Sometimes, upgrading Redis can resolve unexpected issues.

  8. Check for Redis Key Expiry: Ensure that your Redis keys are not expiring unexpectedly. You can use the TTL command to check the time-to-live of keys.

    redis-cli TTL your-key
    

By following these steps, you should be able to identify and resolve the issue with your Redis queue and Supervisor after upgrading to Laravel 11. If the problem persists, consider reaching out to the Laravel community or checking the Laravel GitHub repository for any related issues.

Please or to participate in this conversation.