Skip to content

[ExceptionHandling] ProcessorExceptionExtensionInterface::onProcessorException not called for Errors #1113

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
macghriogair opened this issue Nov 9, 2020 · 1 comment
Labels

Comments

@macghriogair
Copy link

ProcessorExceptionExtensionInterface::onProcessorException is called only for Exceptions, not for Errors

Expected

The QueueConsumer should catch all PHP \Throwable to allow for explicit error handling and controlled failure.

Actual

Only \Exceptions are catched and passed to any extension implementing ProcessorExceptionExtensionInterface

Context

I have an Extension for pushing poisoneous/failed messages to a dedicated failed jobs queue (the transport in use, beanstalkd, has no out of box support for so called dead letter queues) and realized that in case of PHP \Errors the Extension does not get called and the consume command exits without controlled message handling. This might be a serious problem not in suche way that the consumer exits (we use supervisord) but that the poisonous message gets stuck on top of the queue thus blocking all further message processing.

The problematic code is in \Enqueue\Consumption\QueueConsumer line 198 where it catches only \Exception, not \Throwable

try {
    $result = $processor->process($message, $this->interopContext);
} catch (\Exception $e) {
    $result = $this->onProcessorException($extension, $consumer, $message, $e, $receivedAt);
}
@stale
Copy link

stale bot commented Dec 12, 2020

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

@stale stale bot added the wontfix label Dec 12, 2020
@stale stale bot closed this as completed Dec 20, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant