简体   繁体   中英

Php-worker keeps growing in memory when running supervisor queue's

When running supervisor queue's the memory of the php-worker container keeps rising. (As seen in docker stats) Imgur

This number does not go down when the jobs are done. When the queue keeps processing jobs for a while the memory reaches 100% and crashes.

[program:updater]
process_name=%(program_name)s_%(process_num)02d
command=php /var/www/laravel/artisan queue:work --daemon --sleep=3 --tries=3 --timeout=1800 --queue=updater
autostart=true
autorestart=unexpected
numprocs=20
user=laradock
stdout_logfile=/var/www/laravel/storage/logs/updater.log

Is there something I'm missing about clearing the memory after jobs?

EDIT 1: Logs:

[2019-08-07 16:26:36][4320] Processed:  App\Jobs\UpdateClient
[2019-08-07 16:26:36][4385] Processing:
App\Listeners\Statuses\NewClientCreatedStatuses
[2019-08-07 16:26:36][4385] Processed:  App\Listeners\Statuses\NewClientCreatedStatuses
[2019-08-07 16:26:36][4386] Processing: App\Jobs\UpdateClient
[2019-08-07 16:26:37][4281] Processed:  App\Jobs\UpdateClient
[2019-08-07 16:26:38][4314] Processed:  App\Jobs\UpdateClient
[2019-08-07 16:26:38][4388] Processing: App\Listeners\Statuses\NewClientCreatedStatuses
[2019-08-07 16:26:38][4388] Processed:  App\Listeners\Statuses\NewClientCreatedStatuses
[2019-08-07 16:26:38][4389] Processing: App\Jobs\UpdateClient
[2019-08-07 16:26:40][4391] Processing: App\Listeners\Statuses\NewClientCreatedStatuses
[2019-08-07 16:26:40][4391] Processed:  App\Listeners\Statuses\NewClientCreatedStatuses
[2019-08-07 16:26:41][4368] Processed:  App\Jobs\UpdateClient
[2019-08-07 16:26:41][4392] Processing: App\Jobs\UpdateClient
[2019-08-07 16:26:45][4371] Processed:  App\Jobs\UpdateClient
[2019-08-07 16:26:45][4394] Processing: App\Listeners\Statuses\NewClientCreatedStatuses
[2019-08-07 16:26:45][4394] Processed:  App\Listeners\Statuses\NewClientCreatedStatuses
[2019-08-07 16:26:45][4395] Processing: App\Jobs\UpdateClient

I think the --daemon flag is the cause of your issues. This will make the process run in the background. My guess is that supervisor isn't able to kill the process anymore resulting in more and more processes being run. The default laravel configuration doesn't use this flag either.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM