Skip to content
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

Setting up concurrent queries but not retrieving data causes HttpClient timeout #4

Open
simonrjones opened this issue Nov 26, 2021 · 1 comment
Assignees
Labels
bug Something isn't working

Comments

@simonrjones
Copy link
Member

To replicate:

  • Setup QueryManager by adding one query
  • Do not actually retrieve data

If this is run within a test, then Symfony HttpClient pauses for 30 seconds and times out in the destruct process. It looks like concurrent queries actually partly run when added & then cause an error in destruct if data is not retrieved.

This causes an issue in a Symfony app where a Query Manager has some default queries (e.g. primary navigation) but some controllers do not retrieve any data (e.g. endpoint to return static data). This has the effect of a fatal error after 30 seconds of the page response being sent to the browser.

Replicate in w3c-website-frontend via: ./vendor/bin/phpunit tests/Controller/JsonControllerTest.php

Fatal error: Uncaught Symfony\Component\HttpClient\Exception\TimeoutException: Idle timeout reached for "https://cms-dev.w3.org/api/". in /Users/sjones/Sites/w3c/w3c-website-frontend/vendor/symfony/http-client/Chunk/ErrorChunk.php:65
Stack trace:
#0 /Users/sjones/Sites/w3c/w3c-website-frontend/vendor/symfony/http-client/Response/CommonResponseTrait.php(157): Symfony\Component\HttpClient\Chunk\ErrorChunk->isFirst()
#1 /Users/sjones/Sites/w3c/w3c-website-frontend/vendor/symfony/http-client/Response/TransportResponseTrait.php(141): Symfony\Component\HttpClient\Response\CurlResponse::initialize(Object(Symfony\Component\HttpClient\Response\CurlResponse), -0)
#2 /Users/sjones/Sites/w3c/w3c-website-frontend/vendor/symfony/http-client/Response/CurlResponse.php(255): Symfony\Component\HttpClient\Response\CurlResponse->doDestruct()
#3 [internal function]: Symfony\Component\HttpClient\Response\CurlResponse->__destruct()
#4 {main}
  thrown in /Users/sjones/Sites/w3c/w3c-website-frontend/vendor/symfony/http-client/Chunk/ErrorChunk.php on line 65
@simonrjones simonrjones added the bug Something isn't working label Nov 26, 2021
@simonrjones simonrjones self-assigned this Nov 26, 2021
@jean-gui
Copy link

jean-gui commented Dec 3, 2021

Replicate in w3c-website-frontend via: ./vendor/bin/phpunit tests/Controller/JsonControllerTest.php

This test and related controller don't exist anymore, but this can still be easily replicated by creating a controller action that does nothing. And the timeout doesn't only appear when running tests.
See the langNav action and go to https://localhost:8000/lang-nav/ (using symfony embedded server). You should see the error appear in server output.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants