bref icon indicating copy to clipboard operation
bref copied to clipboard

On php-fpm layer in production, after a certain limit, logging on stderr hang the process

Open allan-simon opened this issue 2 years ago • 8 comments

Description:

I'm not sure if it's a bref bug or a AWS one but writting too much log on stderr hang after an arbitrary limit

something like "you write 152 logs, it's fine" " you try to write the 153th, it timeout"

How to reproduce:

I created this route to reproduce the issue

    #[Route(
        path: '/test-reproduce-bref-issue',
        name: 'ping',
        methods: ['GET', 'HEAD']
    )]
    public function brefIssueReproducer(LoggerInterface $logger, Request $request): JsonResponse
    {
        for ($i = 0; $i < $request->query->getInt('nbrLog'); $i++) {
            $logger->info("you_can_ignore_i_m_just_here_to_try_to_reproduce_a_bug");
        }
        return $this->json([]);
    }

That you can test live here

https://app-testenv.rosaly.info/test-reproduce-bref-issue?nbrLog=153 -> does not hang , quite fast 99ms https://app-testenv.rosaly.info/test-reproduce-bref-issue?nbrLog=154 -> hang , timeout (we have 15 seconds timeout)

allan-simon avatar Jan 02 '23 15:01 allan-simon

Hi,

I just wanted to say I encountered the same issue. It can also be reproduced by writing a huge log (like 150k characters).

StephaneLeveugle avatar Jan 02 '23 16:01 StephaneLeveugle

🤔 interesting, this comes to mind:

https://github.com/brefphp/bref/blob/eea8884dc20510bed70d618bc0b67c9be2727bd0/runtime/layers/fpm/php-fpm.conf#L9-L10

Log limit for the logged lines which allows to log messages longer than 1024 characters without wrapping. Default value: 1024. Available as of PHP 7.3.0.

Your sentence contains 54 characters. 154*54 is 8316, which is weirdly close to that number 🤔

But maybe this is a red herring…

mnapoli avatar Jan 02 '23 16:01 mnapoli

to be honest I second @StephaneLeveugle , that number was different with the initial log I had in production.

but yes may be not that directly linked to this property, because our log are json-formatted, so they take actually much more place on stderr

allan-simon avatar Jan 02 '23 16:01 allan-simon

Also I can't reproduce it with the image bref/php-81-fpm-dev

allan-simon avatar Jan 02 '23 17:01 allan-simon

I've just found this issue https://github.com/php/php-src/issues/9010

so I will propose as here https://github.com/php/php-src/issues/9010#issuecomment-1184680406 a PR to set the limit to the limit of AWS cloudwatch

allan-simon avatar Jun 12 '24 08:06 allan-simon

@mnapoli so the log_limit may have been a red herring, my next hypothesis is a bug in Symfony/process

i.e some buffer being full causing the process to hang

see https://github.com/symfony/symfony/issues/5704#issuecomment-18715686 (it's a very old one but it was claused but not fixed )

and it links to https://stackoverflow.com/questions/9785179/calling-subprocess-call-hangs-when-i-set-the-stdout that explains something interesting

Do not use stdout=PIPE or stderr=PIPE with this function. As the pipes are not being read in the current process, the child process may block if it generates enough output to a pipe to fill up the OS pipe buffer.

allan-simon avatar Jun 13 '24 12:06 allan-simon

oh interesting!

mnapoli avatar Jun 13 '24 19:06 mnapoli

Noticing the same bug, if I write logs to a file it works fine, if I write to stderr it intermittently freezes up in local development. Seems very similar to #1714.

Tests:

docker-compose.yml

app:
    platform: linux/amd64
    image: bref/php-83-fpm-dev
    volumes:
      - .:/var/task:ro
    environment:
      DOCUMENT_ROOT: public
      HANDLER: public/index.php

public/index.php

Does not work (Freezes with eventual timeout)

<?php
$bytes = 512*128;
fwrite(fopen('php://stderr', 'w'), str_repeat('x', $bytes));

echo 'Hello, world!';

Works every time, never freezes

<?php
$bytes = 512*12;
fwrite(fopen('php://stderr', 'w'), str_repeat('x', $bytes));

echo 'Hello, world!';

Works once, freezes following request

<?php

$bytes = 512*32;
fwrite(fopen('php://stderr', 'w'), str_repeat('x', $bytes));

echo 'Hello, world!';

Some very interesting logs from the above command (it outputs 4096 bytes and then ends correctly with no timeout, second attempt freezes but then after timeout brings the remainder of the buffer from previous request, plus the new logs.

24 Jun 2024 09:18:34,955 [INFO] (rapid) exec '/var/runtime/bootstrap' (cwd=/var/task, handler=)
⚡️ Server is running at http://localhost:8000
START RequestId: cc3f6514-27e6-443f-b60c-9c3717c84c79 Version: $LATEST
24 Jun 2024 09:18:39,762 [INFO] (rapid) INIT START(type: on-demand, phase: init)
24 Jun 2024 09:18:39,763 [INFO] (rapid) The extension's directory "/opt/extensions" does not exist, assuming no extensions to be loaded.
24 Jun 2024 09:18:39,764 [INFO] (rapid) Starting runtime without AWS_SESSION_TOKEN , Expected?: false
24 Jun 2024 09:18:40,121 [INFO] (rapid) INIT RTDONE(status: success)
24 Jun 2024 09:18:40,121 [INFO] (rapid) INIT REPORT(durationMs: 359.856000)
24 Jun 2024 09:18:40,122 [INFO] (rapid) INVOKE START(requestId: 05380e5c-6825-4933-8099-ec568238e757)
[24-Jun-2024 09:18:40] NOTICE: fpm is running, pid 35
[24-Jun-2024 09:18:40] NOTICE: ready to handle connections
24 Jun 2024 09:18:40,171 [INFO] (rapid) INVOKE RTDONE(status: success, produced bytes: 0, duration: 49.317000ms)
xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx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xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxEND RequestId: 05380e5c-6825-4933-8099-ec568238e757
REPORT RequestId: 05380e5c-6825-4933-8099-ec568238e757  Init Duration: 0.42 ms  Duration: 411.62 ms     Billed Duration: 412 ms Memory Size: 3008 MB    Max Memory Used: 3008 MB
START RequestId: 043293ec-4450-4796-86a6-1f791411188d Version: $LATEST
24 Jun 2024 09:18:41,108 [INFO] (rapid) INVOKE START(requestId: 3cf90b50-42c3-4790-8bef-ae15e326062d)
3cf90b50-42c3-4790-8bef-ae15e326062d The PHP script timed out. Bref will now restart PHP-FPM to start from a clean slate and flush the PHP logs.
Timeouts can happen for example when trying to connect to a remote API or database, if this happens continuously check for those.
If you are using a RDS database, read this: https://bref.sh/docs/environment/database.html#accessing-the-internet
xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx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xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
[24-Jun-2024 09:23:40] NOTICE: Terminating ...
xx
[24-Jun-2024 09:23:40] NOTICE: exiting, bye-bye!
3cf90b50-42c3-4790-8bef-ae15e326062d    Invoke Error    {"errorType":"Bref\\FpmRuntime\\FastCgi\\Timeout","errorMessage":"The request 3cf90b50-42c3-4790-8bef-ae15e326062d timed out after 298991 ms. Note: that duration may be lower than the Lambda timeout, don't be surprised, that is intentional. Indeed, Bref stops the PHP-FPM request *before* a hard Lambda timeout, because a hard timeout prevents all logs to be written to CloudWatch.","stack":["#0 \/var\/task\/vendor\/bref\/bref\/src\/Event\/Http\/HttpHandler.php(25): Bref\\FpmRuntime\\FpmHandler->handleRequest(Object(Bref\\Event\\Http\\HttpRequestEvent), Object(Bref\\Context\\Context))","#1 \/var\/task\/vendor\/bref\/bref\/src\/Runtime\/Invoker.php(24): Bref\\Event\\Http\\HttpHandler->handle(Array, Object(Bref\\Context\\Context))","#2 \/var\/task\/vendor\/bref\/bref\/src\/Runtime\/LambdaRuntime.php(94): Bref\\Runtime\\Invoker->invoke(Object(Bref\\FpmRuntime\\FpmHandler), Array, Object(Bref\\Context\\Context))","#3 \/var\/task\/vendor\/bref\/bref\/src\/FpmRuntime\/Main.php(46): Bref\\Runtime\\LambdaRuntime->processNextEvent(Object(Bref\\FpmRuntime\\FpmHandler))","#4 \/opt\/bref\/bootstrap.php(17): Bref\\FpmRuntime\\Main::run()","#5 {main}"]}
24 Jun 2024 09:23:40,401 [INFO] (rapid) INVOKE RTDONE(status: success, produced bytes: 0, duration: 299293.538000ms)
END RequestId: 3cf90b50-42c3-4790-8bef-ae15e326062d
REPORT RequestId: 3cf90b50-42c3-4790-8bef-ae15e326062d  Duration: 299294.25 ms  Billed Duration: 299295 ms      Memory Size: 3008 MB    Max Memory Used: 3008 MB

alexw23 avatar Jun 24 '24 08:06 alexw23

I looked at the code and I think issue is that the PHP-FPM is started using Symfony Process which doesn’t support forwarding descriptors - so indeed what happens is a pipe is opened between PHP running the runtime and PHP-FPM.

The only time that Symfony Process will read the pipes is when waiting or as part of checking the status. However once Bref sends a request to PHP-FPM over the socket it then blocks waiting for the FPM response for the request because the FastCgi socket processing is also blocking. So if the pipe fills up you could have PHP-FPM blocking on writing to STDERR waiting for it to be read from and PHP blocking on reading from the socket waiting for it to be written to, and so deadlock.

Probably best is for proc_open to be used directly to forward the STDOUT and STDERR descriptor directly. In a way it’s probably just as easy as most of Symfony Process is unneeded here and none of the Windows compat? Worth a test I think.

driskell avatar Aug 11 '24 20:08 driskell

@driskell I forgot to repport, but I arrived at the same conclusion as you on your 2 first paragraph, I'm not knowledgeable enough for the 3rd one, I don't know how much symfony process abstract that is actually needed here

allan-simon avatar Aug 11 '24 22:08 allan-simon

Thanks a lot @driskell, that is extremely helpful! I will try to work on that topic asap!

mnapoli avatar Aug 12 '24 08:08 mnapoli

Great news, thanks to @driskell I was able to work on a fix. I was also able to reproduce the bug and test it went away (both locally and in Lambda) thanks to your snippets @allan-simon and @alexw23.

Fix here: https://github.com/brefphp/bref/pull/1852

Is anyone able to test that branch to confirm this improves things? 🙏

mnapoli avatar Aug 14 '24 14:08 mnapoli

This is great news @mnapoli. Haven't had a chance to test yet but from my own debugging it looks like this will work.

alexw23 avatar Aug 16 '24 21:08 alexw23