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
[Messenger][SQS] Uncaught SQS Exception when worker stopped. #50342
Comments
Note that |
Same issue here: // The worker will automatically exit once it has processed 9 messages, been running for 15s or received a stop signal
// via the messenger:stop-workers command.
// Quit the worker with CONTROL-C.
// Re-run the command with a -vv option to see logs about consumed messages.
PHP Fatal error: Uncaught LogicException: Instance of "Symfony\Component\HttpClient\Response\CurlResponse" is already consumed and cannot be managed by "Symfony\Component\HttpClient\Response\AsyncResponse". A decorated client should not call any of the response's methods in its "request()" method. in /var/www/html/vendor/symfony/http-client/Response/AsyncResponse.php:284
Stack trace:
#0 /var/www/html/vendor/symfony/http-client/Response/AsyncResponse.php(66): Symfony\Component\HttpClient\Response\AsyncResponse::stream(Array, -0.0)
#1 /var/www/html/vendor/symfony/http-client/Response/CommonResponseTrait.php(142): Symfony\Component\HttpClient\Response\AsyncResponse::Symfony\Component\HttpClient\Response\{closure}(Object(Symfony\Component\HttpClient\Response\AsyncResponse), -0.0)
#2 /var/www/html/vendor/symfony/http-client/Response/AsyncResponse.php(96): Symfony\Component\HttpClient\Response\AsyncResponse::initialize(Object(Symfony\Component\HttpClient\Response\AsyncResponse))
#3 /var/www/html/vendor/async-aws/core/src/Response.php(141): Symfony\Component\HttpClient\Response\AsyncResponse->getStatusCode()
#4 /var/www/html/vendor/async-aws/core/src/Response.php(118): AsyncAws\Core\Response->resolve()
#5 [internal function]: AsyncAws\Core\Response->__destruct()
#6 {main}
thrown in /var/www/html/vendor/symfony/http-client/Response/AsyncResponse.php on line 284
Fatal error: Uncaught LogicException: Instance of "Symfony\Component\HttpClient\Response\CurlResponse" is already consumed and cannot be managed by "Symfony\Component\HttpClient\Response\AsyncResponse". A decorated client should not call any of the response's methods in its "request()" method. in /var/www/html/vendor/symfony/http-client/Response/AsyncResponse.php:284
Stack trace:
#0 /var/www/html/vendor/symfony/http-client/Response/AsyncResponse.php(66): Symfony\Component\HttpClient\Response\AsyncResponse::stream(Array, -0.0)
#1 /var/www/html/vendor/symfony/http-client/Response/CommonResponseTrait.php(142): Symfony\Component\HttpClient\Response\AsyncResponse::Symfony\Component\HttpClient\Response\{closure}(Object(Symfony\Component\HttpClient\Response\AsyncResponse), -0.0)
#2 /var/www/html/vendor/symfony/http-client/Response/AsyncResponse.php(96): Symfony\Component\HttpClient\Response\AsyncResponse::initialize(Object(Symfony\Component\HttpClient\Response\AsyncResponse))
#3 /var/www/html/vendor/async-aws/core/src/Response.php(141): Symfony\Component\HttpClient\Response\AsyncResponse->getStatusCode()
#4 /var/www/html/vendor/async-aws/core/src/Response.php(118): AsyncAws\Core\Response->resolve()
#5 [internal function]: AsyncAws\Core\Response->__destruct()
#6 {main}
thrown in /var/www/html/vendor/symfony/http-client/Response/AsyncResponse.php on line 284 Using |
Hi, I am getting the same issues, has anyone found any solution for this? Thanks |
In my case only happens when using localstack, works perfect while using the real SQS service. |
I switched from a FIFO queue to a Standard queue. FIFO were not required for our use case; as far as I remember, Symfony Messenger does not suit well with AWS SQS FIFO restriction. |
Thanks for the replies! I am using Standard Queue in prod and still getting the issue. It is hard to debug because it does not happen every time... |
We have the same issue. Using standard queues. |
Hello all. I found this issue and I know how to reproduce it on local:
This is 100% reproducible on my local! I can give more info about
everything working well. So issue is when queue is empty and worker tries to stop on timeout it tries fetch events from queue and fail with an error. This is a very unpleasant error because messages end up being resent to the queue because of this Please let me know if you need any details here. @nicolas-grekas can you please help with this? |
This is actually an issue with this release of Symfony HTTP Client: https://github.com/symfony/http-client/releases/tag/v5.4.35 We have downgraded to 5.4.34 and the issue is gone. [EDIT] |
OK so I think I found the solution. I tried downgrading all the libraries, but nothing worked. I decided to downgrade php from 8.3.3 to 8.2.16 and upgrade all the libraries that result in throwing this exception to the latest versions. The issue is gone. There is probably some bug or unhandled BC break in php8.3.3 that needs to be addressed. |
@mtanasiewicz I'm running on PHP 8.1.23 |
Is someone using Symfony 6 or 7 ? |
The error async-aws/sqs@cef9f10#diff-d2ab9925cad7eac58e0ff4cc0d251a937ecf49e4b6bf57f8b95aab76648a9d34L15 It seems there have been changes related to AWS JSON-1.0 Protocol, and JSON Protocol seems to be prioritized over XML. Instead, around the same time, the error StackTrace after the upgradeException
Previous Exception
Environment
|
The exceptions As example: for values
For values
I assume it is related to Symfony HttpClient and |
Symfony version(s) affected
5.4.23
Description
It's not a problem that happens every time, the frequency is about 1 in 3.
SupervisorD is running and monitoring :
bin/console messenger:consume mailer --no-tracking --time-limit=3600
.Every ~3600 sec, messenger worker will be stopped to be restarted automatically by supervisord.
When worker is stopping, SQS throw an uncaught exception (see additional context).
How to reproduce
I don't know how to reproduce.
This configuration has been in production for several months, and the problem appeared less than 2 months ago.
I spent many hours understanding the situation. So far, I only have thoughts.
Note that the problem is occurring only when the worker is stopping after "time-limit".
Possible Solution
poll_timeout < wait_time
As a reminder, default SQS Messenger configuration:
From AWS SQS Documentation.
AmazonSqs\Transport\Connection__destruct() is calling already destructed useful objects.
aws-async is a library that is not easy to debug..
Long polling is not working
Additional Context
messenger.yaml
Two kind of exceptions:
ReceiveMessageResult.php on line 33
AsyncResponse.php on line 287
supervisord output
CLI :
bin/console messenger:consume mailer --no-tracking --time-limit=3600 -vv
The text was updated successfully, but these errors were encountered: