Thursday, March 16, 2017

Laravel jobs leaves an idle postgresql process on DEALLOCATE

Every time a Delayed Job is has run on my server I can see a new idle process in postgreSQL. Running select * from pg_stat_activity; I can see:

DEALLOCATE pdo_stmt_00000018

I tried to understand, and one more line (and one more process in htop) appears each time a delayed queued job had just ran.

The last line of my Job is:

$this->log->info("Invitation {$this->invitation->uuid} sent");

And I can see this in my logs, so everything is alright BUT it does not clean up after. I have a idle process every time with "DEALLOCATE pdo_stmt_00000xxx".

What can I do to avoid this problem? What is causing this?

Here is my supervisor config:

[program:laravel-queue-worker]
process_name=%(program_name)s_%(process_num)02d
command=php /path/to/my/site/artisan queue:work --queue=invitation,default --sleep=3 --tries=3
autostart=true
autorestart=true
user=www-data
numprocs=2
redirect_stderr=true
stdout_logfile=/path/to/my/logs/worker.log

Side note: the idle processes disappear when I run php artisan queue:restart



via rap-2-h

Advertisement