Open driskell opened 2 months ago
Thanks for the report! Any idea what makes you think this is related to libxml specifically? I don't see how xml could play a role in the FPM connection.
Could it be a regression in the new PHP version?
@mnapoli It could be. I only mention libxml because of https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=280775.
Usually php-fpm would disable SIGPIPE, but I've found sources showing there's been things in past where libraries re-enable it (such as curl, or OpenSSL) and then php-fpm signal handler gets confused and kills things. So it could be something is re-enabling the signal and I think libxml was related before based on the above bugzilla.
Could be worth me trying building PHP 8.3.10 separately against older libxml and I could test but not sure where to start right now. We've stuck to 2.3.1 on 8.3.9 for now until I can work out time to play around with it.
Interesting! Adding @GrahamCampbell to this
Odd, though I don't think this is libxml related, because Bref's 8.3.9 is using 2.12.x, and that linked issue says that 2.11.x is good, but 2.12.x is not.
We could try downgrading to 2.12.x, but we may need to re-evaluate in the future if a security issue is discovered in 2.12.x in the future, and not patched.
Actually, no. That issue is specifically about PHP 8.1, and libxml 2.13 does not work on that version. We only use 2.13 on PHP 8.2+.
So it could be the PHP version. We could try waiting for https://github.com/brefphp/aws-lambda-layers/pull/199 and see if it fixes it?
I can try and test with https://github.com/brefphp/aws-lambda-layers/pull/199 once it is released.
@driskell can you test with https://github.com/brefphp/bref/releases/tag/2.3.5 ?
Maybe it could help you. I had the same issue with https://github.com/reactphp/http and AWS Lambda
RequestId: 5ad1b639-980b-4f3c-baf6-7ac7d40971ee Error: Runtime exited with error: exit status 141
Runtime.ExitError
Worked perfectly locally with my docker container but crashing on the AWS infra (Lambda as a Docker Image)
I manage to fix it with:
// Try to handle SIGPIPE and other potential signals gracefully
\pcntl_async_signals(true);
\pcntl_signal(SIGPIPE, function() {
echo 'Caught SIGPIPE, closing socket.' . PHP_EOL; // Remove this line in prod
});
With \pcntl_async_signals(true);, you enable asynchronous signal handling for your program, allowing it to catch and handle signals. With the \pcntl_signal(SIGPIPE, ...), you specify a handler function for SIGPIPE.
I don't know what you think. And I don't know the impact. But since pcntl
extension is by default in bref layer, maybe we could add it directly into bref.
@mnapoli Interesting no issues with that one. All working.
@mnapoli I stand correct - I am still seeing some issues with SIGPIPE. It just more sporadic now and I don't know if that is related to the 2.3.5 or if not. I've had to rollback to 2.3.1 and it works again smoothly.
Description:
See: https://github.com/brefphp/aws-lambda-layers/pull/192
We're seeing lots of random failures in 2.3.4 and 2.3.3 where the child dies of SIGPIPE at the start of a request - meaning something dropped a SIGPIPE prior to the request.
Followed immediately by (two examples, showing it happens different timings):
Then finally:
Similar to https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=280775 - which seems to refer to libxml
How to reproduce:
Install 2.3.4 or 2.3.3 Bref, use
php-fpm
as the runtime and send lots of requests.I'm not entirely sure if this will reproduce it as I haven't tried but it definitely all goes away when downgrading back to 2.3.1.