-
-
Notifications
You must be signed in to change notification settings - Fork 47
RE - How to fix error handling? #78
Comments
@k911 I'm experiencing this too btw |
@domgraziano @Rastusik To confirm, you didn't install |
@k911 I have twig bundle installed. Exceptions are handled fine, if they are caught by Symfony, but the described problem occurs to me on php errors |
So your case is probably different than @domgraziano , because I see that @domgraziano don't have Installing
Anyway, I think this issue could stay open because server could at least terminate HTTP connection with 500 error code in such situations. |
@k911 thanks for looking into it. I can confirm that installing twig would terminate the request but only for thrown Exception, not for error (in my example, with twig, running in prod mode, the localhost:9501/error would still hang and response never come back, confirming what @Rastusik said). My view is that I shouldn't be forced to install twig though. As per after symfony 4 I could have only a few components to being able to speed up a minimal API for which I might or might not need twig at all, which was my original case. I do agree that the server itself should be able to terminate the request, and the bundle should probably provide such a mechanism. If you have any idea on where to look, I can have a look myself. I tried to catch a |
@k911 actually I've just tried:
in and this would terminate with a 500, without Twig, downside is that nothing will be logged as we are returning, so it might not be that immediate as a fix |
…imeouts (#79) When any exception/error is not caught by Symfony's exception handler Swoole's worker will exit and response will not terminate properly. The purpose of this pull request is to prevent the situation when the request will timeout due to lack of response because Swoole's worker has exited due to an uncaught exception. If you're looking for a custom exception handing in Symfony, please use this guide: https://symfony.com/doc/current/event_dispatcher.html Fixes #78
* fix(http-client): Make HttpClient serializable ([0ee8918](0ee8918)) * fix(http-server): Add top-level exception handler to prevent server timeouts (#79) ([08c76c4](08c76c4)), closes [#79](#79) [#78](#78) * chore(commitlint): Update configuration options to less restrictive ([bfb6d4c](bfb6d4c)) * chore(composer): Update dependencies ([9c3d7b2](9c3d7b2)) * chore(swoole): Update to v4.4.10 ([089e91d](089e91d)) * chore(swoole): Update to v4.4.8 ([a22e9ff](a22e9ff)) * chore(swoole): Upgrade to v4.4.12 ([30567b4](30567b4)) * ci(circle): Add default release notes when empty (#72) ([57e3c4e](57e3c4e)), closes [#72](#72) * ci(circle): Add shellcheck job (#77) ([97fd9ef](97fd9ef)), closes [#77](#77) * ci(circle): Fix release notes script generator ([490a8bc](490a8bc)) * ci(circle): Fix release version script ([68fd0e9](68fd0e9)) * feat(session): Add in-memory syfmony session storage (#73) ([4ccdca0](4ccdca0)), closes [#73](#73) * refactor(phpstan): Enable "inferPrivatePropertyTypeFromConstructor" parameter ([3436fd9](3436fd9))
Describe the bug
Linked to #20
From any symfony controller if an error or exception is thrown, the symfony request response cycle does not terminate and the browser (or any client eg postman) is hanging waiting for the response which never comes back.
Steps To Reproduce
I'm adding a repository with a symfony installation wrapped in a docker container to reproduce you would have 3 endpoint
here the repo:
trySwoole.zip
Expected behavior
Response finishes with 500 code / server error
Environment (please complete the following information):
Dockerised varsion started from https://www.swoole.co.uk/article/docker.html but substituted with php php:7.3-cli as the bundle requires 7.3 and swoole-4.4.7
Logs
The text was updated successfully, but these errors were encountered: