michelsalib / BCCResqueBundle

The BCC resque bundle provides integration of php-resque to Symfony2. It is inspired from resque, a Redis-backed Ruby library for creating background jobs, placing them on multiple queues, and processing them later.
122 stars 91 forks source link

Supervisor processes are throwing exceptions #144

Open DavidGarciaCat opened 7 years ago

DavidGarciaCat commented 7 years ago

Hello,

I would like to know if anyone got the same error I have, in case we can find a solution.

When I am running my workers via Symfony Command everything is working as expected, however it doesn't work if I run them using Supervisor.

I have checked that Supervisor is stopping as well as starting my workers (if I check the active processes via ps or top or htop shell commands then I can see that there are 4 resque binaries (one for each queue I am managing) and 1 redis-scheduler binary (just in case I need to schedule something).

However when I test it I can see this error on Resque logs:

==> resque.log <==
[info] [00:12:49 2017-04-13] Found job on default
[notice] [00:12:49 2017-04-13] Starting work on (Job{default} | ID: 0398d62b19f9f34a0841ab134ed038fa | AcmeBundle\Jobs\EventJob | [{"param":"value","kernel.root_dir":"\/path\/to\/my\/current\/released\/project\/app","kernel.debug":true,"kernel.environment":"dev"}])
[info] [00:12:49 2017-04-13] Forked 3208 at 2017-04-13 00:12:49
[info] [00:12:49 2017-04-13] Checking low for jobs
[info] [00:12:49 2017-04-13] Sleeping for 5
[info] [00:12:49 2017-04-13] Processing default since 2017-04-13 00:12:49
[info] [00:12:49 2017-04-13] Checking medium for jobs
[info] [00:12:49 2017-04-13] Sleeping for 5
[info] [00:12:49 2017-04-13] Checking high for jobs
[info] [00:12:49 2017-04-13] Sleeping for 5
[critical] [00:12:49 2017-04-13] (Job{default} | ID: 0398d62b19f9f34a0841ab134ed038fa | AcmeBundle\Jobs\EventJob | [{"param":"value","kernel.root_dir":"\/path\/to\/my\/current\/released\/project\/app","kernel.debug":true,"kernel.environment":"dev"}]) has failed Doctrine\Common\Annotations\AnnotationException: [Semantical Error] The annotation "@Doctrine\ORM\Mapping\Table" in class AcmeBundle\Entity\SmsMessage does not exist, or could not be auto-loaded. in /path/to/my/current/released/project/vendor/doctrine/annotations/lib/Doctrine/Common/Annotations/AnnotationException.php:54
Stack trace:
...

Of course, when I browse the website, I can get the data from that Entity with no problem (list them as well as update them) - the one that in theory has a problem with the @Doctrine\ORM\Mapping\Table annotation - so I am not sure what I am doing wrong

My supervisor config file is based on the README.md example here - I am using the same content, just updating the paths to my project folder - Adding it here in case I did something wrong, but due I can start/stop the workers I assume everything is OK

[program:myapp_bccresque_default]
command=/usr/bin/php /path/to/my/current/released/project/vendor/bcc/resque-bundle/BCC/ResqueBundle/bin/resque
stdout_logfile=/path/to/my/current/released/project/app/logs/resque.log
stderr_logfile=/path/to/my/current/released/project/app/logs/resque-error.log
user=osuser
environment=APP_INCLUDE='/path/to/my/current/released/project/vendor/autoload.php',VERBOSE='1',QUEUE='default'
stopsignal=QUIT

[program:myapp_bccresque_low]
command=/usr/bin/php /path/to/my/current/released/project/vendor/bcc/resque-bundle/BCC/ResqueBundle/bin/resque
stdout_logfile=/path/to/my/current/released/project/app/logs/resque.log
stderr_logfile=/path/to/my/current/released/project/app/logs/resque-error.log
user=osuser
environment=APP_INCLUDE='/path/to/my/current/released/project/vendor/autoload.php',VERBOSE='1',QUEUE='low'
stopsignal=QUIT

[program:myapp_bccresque_medium]
command=/usr/bin/php /path/to/my/current/released/project/vendor/bcc/resque-bundle/BCC/ResqueBundle/bin/resque
stdout_logfile=/path/to/my/current/released/project/app/logs/resque.log
stderr_logfile=/path/to/my/current/released/project/app/logs/resque-error.log
user=osuser
environment=APP_INCLUDE='/path/to/my/current/released/project/vendor/autoload.php',VERBOSE='1',QUEUE='medium'
stopsignal=QUIT

[program:myapp_bccresque_high]
command=/usr/bin/php /path/to/my/current/released/project/vendor/bcc/resque-bundle/BCC/ResqueBundle/bin/resque
stdout_logfile=/path/to/my/current/released/project/app/logs/resque.log
stderr_logfile=/path/to/my/current/released/project/app/logs/resque-error.log
user=osuser
environment=APP_INCLUDE='/path/to/my/current/released/project/vendor/autoload.php',VERBOSE='1',QUEUE='high'
stopsignal=QUIT

[program:myapp_bccresque_scheduled_worker]
command=/usr/bin/php /path/to/my/current/released/project/vendor/bcc/resque-bundle/BCC/ResqueBundle/bin/resque-scheduler
stdout_logfile=/path/to/my/current/released/project/app/logs/resque.log
stderr_logfile=/path/to/my/current/released/project/app/logs/resque-error.log
user=osuser
environment=APP_INCLUDE='/path/to/my/current/released/project/vendor/autoload.php',VERBOSE='1',RESQUE_PHP='/path/to/my/current/released/project/vendor/chrisboulton/php-resque/lib/Resque.php'
stopsignal=QUIT

[group:myapp]
programs=myapp_bccresque_high,myapp_bccresque_medium,myapp_bccresque_low,myapp_bccresque_default,myapp_bccresque_scheduled_worker

Any help I can get will be much appreciated.

Thanks,