-
-
Notifications
You must be signed in to change notification settings - Fork 365
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
Error handling #713
Comments
In those cases, Bref should restart PHP-FPM to restart from scratch (https://github.com/brefphp/bref/blob/master/src/Event/Http/FpmHandler.php#L58-L62). It seems it's not happening here, can you confirm? |
The Lambda function is never crashing, Ie, we are never running I think the socket write error is because PHP-FPM's child died. PHP-FPM spins up a new one but we still try to write to the old child. |
Im seeing strange effects... When I use |
I use https://github.com/Nyholm/bref-overwrite-layer and I cannot come to any other conclusion than what I've stated above. Because request_terminate_timeout is not acting as we expected then I suggest to revert it. |
@Nyholm The code that causes the mentioned $info = stream_get_meta_data( $this->resource );
# ...
if ( $info['unread_bytes'] === 0 && $info['blocked'] && $info['eof'] )
{
throw new ReadFailedException( 'Stream got blocked, or terminated.' );
} I also wrote a test to simulate this scenario by explicitly killing a php-fpm pool/worker process with the following signals and then try to access its stream, see https://github.com/hollodotme/fast-cgi-client/blob/v3.1.2/tests/Integration/SignaledWorkersTest.php#L45: [
[
# SIGHUP
'signal' => 1,
],
[
# SIGINT
'signal' => 2,
],
[
# SIGKILL
'signal' => 9,
],
[
# SIGTERM
'signal' => 15,
],
] So yes, I can confirm that most probably the underlying php-fpm process crashed or was killed when this exception pops up. |
My questions are:
Ie, the process is idle for 15s and I cannot write to it anymore.
|
@Nyholm regarding 2. The
Those are the only usages of |
@Nyholm regarding 1. If I interpret this fpm-source-code correctly,
Maybe also the combination of |
Regarding 2I get an error when I write. See my stack trace.
Im running hollodotme/fast-cgi-client v3.1.2 with some added |
Ah, I see. When writing to a broken Socket, the socket is not removed from the collection, indeed. 😞 |
Regarding 1.That is an interesting idea. I've tried When testing with Hm.. |
Hm... or maybe it is the fact that we run php-fpm in nondaemon... I'll try that next. |
I released v3.1.3 which fixes the bug that broken sockets were not removed from the collection - https://github.com/hollodotme/fast-cgi-client/releases/tag/v3.1.3 |
I'll be closing this one because it seems resolved, let's reopen if I'm wrong or if there's any further issue. Thanks all! |
This is a follow up from #707 and is related to #709
After trying out #707 again I found something strange. I've got two routes, one that times out with
sleep(40)
and one normal route. My lambda function has a timeout of 16s and PHP-FPM of 15s.T0: Access normal route,
T1: Get a response
T2: Access route with sleep
T12: (internal server error) Lambda times out with and my application logs are visible.
T20: Access normal route
T21: (internal server error) hollodotme\FastCGI\Exceptions\WriteFailedException Failed to write request to socket [broken pipe]" (hollodotme/fast-cgi-client/src/Sockets/Socket.php on line 385)
So at T12 I get a
hollodotme\\FastCGI\\Exceptions\\ReadFailedException Stream got blocked, or terminated
exception. After that I cannot write to PHP-FPM anymore..@hollodotme do you know if this is correct?
Another thing I find weird is that my "timout" happens after 10s. I would expect it to be 15 s.
The text was updated successfully, but these errors were encountered: