Open CViniciusSDias opened 5 months ago
SWOOLE_HOOK_ALL is the parameter for coroutine, I think the runtime/swoole is not ready for coroutine environment.
By the way, symfony framework is not ready now for coroutine. You can imagine there are many requests are handling in one process, logic codes are switch frequently depends on current context, but symfony's DI cant provider the correct service object depends on context, it will bring some dirty variable and break the logic code.
Unless you have a way to ensure the DI work correct on the swtichable context, runtime/swoole will not working well when open coroutine
@ywisax services normallx dont Switch between requests and symfony and the runtime correcty reset services states via reset interface.
As I think swoole works similar like roadrunner or frankenphp worker mode there should for symfony core be no problem. Sure some bundles my forgot to handle this and can fail with swoole but this should not be a problem with symfony bare skeleton. Or do you have an example which service need to be fixed in the symfony core which is not possible to handle multiple requests?
You can remove
$server->set([
'hook_flags' => SWOOLE_HOOK_ALL
]);
and try again, to confirm if there is related to coroutine.
I stated this in a previous message:
Simply changing the hook flags to something like SWOOLE_HOOK_ALL & ~SWOOLE_HOOK_FILE & ~SWOOLE_HOOK_STDIO makes the error go away, so I assume it's a problem that happens when logs are added.
So the problem seems to be with either SWOOLE_HOOK_FILE
or SWOOLE_HOOK_STDIO
(or both).
When recieving a big number of requests (via stress test, for example) while having
hook_flags
set toSWOOLE_HOOK_ALL
, the Runtime triggers the following Swoole error:If I try to use the hook_flag in a bare Swoole server, without Symfony runtime, I get no error. Example:
This does not trigger any error on the same stress test.
Steps to reproduce:
return $this->json('Ok');
is enough) to/example
;docker run --rm -it williamyeh/wrk -c 100 -d 1 -t8 http://host.docker.internal:8000/example
;Simply changing the hook flags to something like
SWOOLE_HOOK_ALL & ~SWOOLE_HOOK_FILE & ~SWOOLE_HOOK_STDIO
makes the error go away, so I assume it's a problem that happens when logs are added.I also opened an issue here: https://github.com/swoole/swoole-src/issues/5294