Closed ValiDrv closed 5 months ago
I am trying to reproduce the issue by stress-testing the code for a long time with wrk
.
For the 504 http code errors, wrk
will not work, since it counts responses and not the response code. So if one takes 2 min it still counts it as GOOD.
Use ab
, and you see the non 200 response codes.
(basically I could replicate it about 20 times more often with ab
compared to wrk
)
Also, it seems unrelated to the number of requests/load past a certain amount. As in, I got 12 failures in 1000 requests, and 16 in 10k requests.
For the Maximum call stack ... reached. Infinite recursion
it seems more related to how/when the server is restarted. Sometimes I don't get it for days/weeks, other times I get it on every request. (so we just deploy a few times until it doesn't happen)
And once running, it just "randomly" happens for a few minutes, and then stops by itself.
@ValiDrv We have released Swoole v5.1.3. You can try Swoole v5.1.3 to see if this issue still exists.
We moved away from using dispatch_func
in production, but will keep an eye on it.
Short version
swoole:5.1.2
andphp8.3
gives randomlyMaximum call stack ... reached. Infinite recursion
warnings and sometimes even hangs when usingdispatch_func
.onRequest
after a restart, or randomly a few days after the server has been running.It might be hard to replicate, sometimes I get it 50 times per day, sometimes once in 4 hours... but I included a stripped down version of the code that I could replicate the issue with.
Note: It's not a hardware capacity issue, since Swoole can serve 70k RPS on our hardware and this issue happens with 20rps, 5k rps or 50k rps. Servers are Ubuntu 22.04.3 LTS, and can handle more than 1mill connections, multiple IPs, ip_local_port_range, ulimit, somaxconn, etc.
The only difference is PHP 8.3 vs PHP 8.2 and the Swoole version.
Long version
Please answer these questions before submitting your issue.
There are some really strange/weird and intermittent issues with Swoole 5.1.2 and PHP 8.3 when using
dispatch_func
, as explained after the code.cat docker-compose.yml
cat server.php
cat makefile
Most the time the server works great, no errors, fast response and so on.
BUT, every now and then, usually fixed by or after a server restart, we get this error for some request.
The weird some requests part:
Usually, AFTER this happens, we start to get 504 timeouts (2min) in our proxy logs, and just before, but not always accompanied by
Maximum call stack size
errors, latency starts to go up and up.What version of Swoole are you using (show your
php --ri swoole
)?What is your machine environment used (show your
uname -a
&php -v
&gcc -v
) ?