imTigger / laravel-job-status

Add ability to track Job progress, status and result dispatched to Queue.
MIT License
407 stars 60 forks source link

Beanstalk "Server reported NOT_FOUND" with exceptions #67

Open pdf-systems-inc opened 3 years ago

pdf-systems-inc commented 3 years ago

I might be doing something wrong here, but I'm running into an issue where, if the Laravel queue is set to use Beanstalk, job exceptions are not handled correctly.

The crux of the issue appears to be that once the job fails, it disappears from Beanstalk. So when the DefaultEventManager class tries to call $event->job->attempts() (which gets forwarded to the queue connection), it fails.

Full stacktrace

[2021-01-27 17:30:14] local.ERROR: Server reported NOT_FOUND {"exception":"[object] (Pheanstalk\\Exception\\ServerException(code: 0): Server reported NOT_FOUND at vendor/pda/pheanstalk/src/YamlResponseParser.php:39)
[stacktrace]
#0 vendor/pda/pheanstalk/src/Connection.php(114): Pheanstalk\\YamlResponseParser->parseResponse()
#1 vendor/pda/pheanstalk/src/Pheanstalk.php(369): Pheanstalk\\Connection->dispatchCommand()
#2 vendor/pda/pheanstalk/src/Pheanstalk.php(286): Pheanstalk\\Pheanstalk->dispatch()
#3 vendor/laravel/framework/src/Illuminate/Queue/Jobs/BeanstalkdJob.php(91): Pheanstalk\\Pheanstalk->statsJob()
#4 vendor/imtigger/laravel-job-status/src/EventManagers/DefaultEventManager.php(42): Illuminate\\Queue\\Jobs\\BeanstalkdJob->attempts()
#5 vendor/imtigger/laravel-job-status/src/LaravelJobStatusServiceProvider.php(48): Imtigger\\LaravelJobStatus\\EventManagers\\DefaultEventManager->exceptionOccurred()
#6 vendor/laravel/framework/src/Illuminate/Events/Dispatcher.php(347): Imtigger\\LaravelJobStatus\\LaravelJobStatusServiceProvider->Imtigger\\LaravelJobStatus\\{closure}()
#7 vendor/laravel/framework/src/Illuminate/Events/Dispatcher.php(196): Illuminate\\Events\\Dispatcher->Illuminate\\Events\\{closure}()
#8 vendor/laravel/framework/src/Illuminate/Queue/Worker.php(510): Illuminate\\Events\\Dispatcher->dispatch()
#9 vendor/laravel/framework/src/Illuminate/Queue/Worker.php(390): Illuminate\\Queue\\Worker->raiseExceptionOccurredJobEvent()
#10 vendor/laravel/framework/src/Illuminate/Queue/Worker.php(358): Illuminate\\Queue\\Worker->handleJobException()
#11 vendor/laravel/framework/src/Illuminate/Queue/Worker.php(300): Illuminate\\Queue\\Worker->process()
#12 vendor/laravel/framework/src/Illuminate/Queue/Worker.php(134): Illuminate\\Queue\\Worker->runJob()
#13 vendor/laravel/framework/src/Illuminate/Queue/Console/WorkCommand.php(112): Illuminate\\Queue\\Worker->daemon()
#14 vendor/laravel/framework/src/Illuminate/Queue/Console/WorkCommand.php(96): Illuminate\\Queue\\Console\\WorkCommand->runWorker()
#15 [internal function]: Illuminate\\Queue\\Console\\WorkCommand->handle()
#16 vendor/laravel/framework/src/Illuminate/Container/BoundMethod.php(32): call_user_func_array()
#17 vendor/laravel/framework/src/Illuminate/Container/Util.php(36): Illuminate\\Container\\BoundMethod::Illuminate\\Container\\{closure}()
#18 vendor/laravel/framework/src/Illuminate/Container/BoundMethod.php(90): Illuminate\\Container\\Util::unwrapIfClosure()
#19 vendor/laravel/framework/src/Illuminate/Container/BoundMethod.php(34): Illuminate\\Container\\BoundMethod::callBoundMethod()
#20 vendor/laravel/framework/src/Illuminate/Container/Container.php(590): Illuminate\\Container\\BoundMethod::call()
#21 vendor/laravel/framework/src/Illuminate/Console/Command.php(202): Illuminate\\Container\\Container->call()
#22 vendor/symfony/console/Command/Command.php(255): Illuminate\\Console\\Command->execute()
#23 vendor/laravel/framework/src/Illuminate/Console/Command.php(189): Symfony\\Component\\Console\\Command\\Command->run()
#24 vendor/symfony/console/Application.php(1011): Illuminate\\Console\\Command->run()
#25 vendor/symfony/console/Application.php(272): Symfony\\Component\\Console\\Application->doRunCommand()
#26 vendor/symfony/console/Application.php(148): Symfony\\Component\\Console\\Application->doRun()
#27 vendor/laravel/framework/src/Illuminate/Console/Application.php(93): Symfony\\Component\\Console\\Application->run()
#28 vendor/laravel/framework/src/Illuminate/Foundation/Console/Kernel.php(131): Illuminate\\Console\\Application->run()
#29 artisan(37): Illuminate\\Foundation\\Console\\Kernel->handle()
#30 {main}
"}