Skip to content

FastCgiCommunicationFailed on every second request #842

@NeilJ247

Description

@NeilJ247

Description:

I am seeing a 502 gateway error on every second request made to my api. In cloudwatch logs I can see the following:

START RequestId: 3711f7ba-56d6-41d6-9e70-decaa7f0fcdf Version: $LATEST
--
Error communicating with PHP-FPM to read the HTTP response. A root cause of this can be that the Lambda (or PHP) timed out, for example when trying to connect to a remote API or database, if this happens continuously check for those! Bref will restart PHP-FPM now. Original exception message: hollodotme\FastCGI\Exceptions\WriteFailedException Failed to write request to socket [broken pipe]
[18-Jan-2021 16:54:24] NOTICE: Terminating ...
[18-Jan-2021 16:54:24] NOTICE: exiting, bye-bye!
2021-01-18 16:54:24.566 +0000 (14 14) info: attempt daemon connection via 'newrelic-daemon.REDACTED:31339'
2021-01-18 16:54:24.568 +0000 (14 14) info: Daemon connection settings specify a host different from the local host. Daemon will not be started by the Agent.
2021-01-18 16:54:24.568 +0000 (14 14) info: New Relic 9.15.0.293 ("vanilla" - "bab8316e39f6") [daemon='newrelic-daemon.int.bdry.com:31339'  php='7.4.14' zts=no sapi='fpm-fcgi'  pid=14 ppid=7 uid=993 euid=993 gid=990 egid=990 backtrace=yes startup=init os='Linux' rel='4.14.203-112.332.amzn2.x86_64' mach='x86_64' ver='#1 SMP Wed Nov 4 20' node='169.254.153.173']
[18-Jan-2021 16:54:24] NOTICE: fpm is running, pid 14
[18-Jan-2021 16:54:24] NOTICE: ready to handle connections
3711f7ba-56d6-41d6-9e70-decaa7f0fcdf	Invoke Error	{     "errorType": "Bref\\Event\\Http\\FastCgi\\FastCgiCommunicationFailed",     "errorMessage": "",     "stack": [         "#0 /var/task/vendor/bref/bref/src/Event/Http/HttpHandler.php(25): Bref\\Event\\Http\\FpmHandler->handleRequest()",         "#1 /var/task/vendor/bref/bref/src/Runtime/Invoker.php(29): Bref\\Event\\Http\\HttpHandler->handle()",         "#2 /var/task/vendor/bref/bref/src/Runtime/LambdaRuntime.php(102): Bref\\Runtime\\Invoker->invoke()",         "#3 /opt/bootstrap(43): Bref\\Runtime\\LambdaRuntime->processNextEvent()",         "#4 {main}"     ] }
END RequestId: 3711f7ba-56d6-41d6-9e70-decaa7f0fcdf
REPORT RequestId: 3711f7ba-56d6-41d6-9e70-decaa7f0fcdf	Duration: 37.85 ms	Billed Duration: 38 ms	Memory Size: 1024 MB	Max Memory Used: 83 MB

Currently the endpoint simply returns a 200. There are no database connections. The only connection I can think of is to an internal fargate service running the new relic daemon (this support was just added recently to bref extensions).

How to reproduce:

Bref: 1.1.3
Extensions: bref:extra.newrelic-php-74 - 0.9.5
Application Framework: Slim 4
Runtime: provided.al2

I am also using a VPC with my Lambda function. It has 2 public and and private subnets with the expected NAT gateway.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions