From e4718b30357bbf820b61f7bb6e3184c735eb7bae Mon Sep 17 00:00:00 2001 From: Stanislau Komar Date: Sat, 11 Nov 2023 03:58:02 +0400 Subject: [PATCH 1/2] v1.6.1.1 fix bug with gc_collect_cycles --- src/Listener/ApplicationRoadrunnerStartedListener.php | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/src/Listener/ApplicationRoadrunnerStartedListener.php b/src/Listener/ApplicationRoadrunnerStartedListener.php index 97ab34e..447d96b 100644 --- a/src/Listener/ApplicationRoadrunnerStartedListener.php +++ b/src/Listener/ApplicationRoadrunnerStartedListener.php @@ -61,11 +61,14 @@ public function on(EventInterface $event): void $worker->respond($httpMessageFactory->createResponse($appResponse)); } catch (\Throwable $e) { $worker->getWorker()->error((string) $e); - } finally { - if (++$i === $gcCollectStep) { - gc_collect_cycles(); - } } + + if (++$i < $gcCollectStep) { + continue; + } + + gc_collect_cycles(); + $i = 0; } } From d373b072d6eddf4a110b7ff340287c90811e1034 Mon Sep 17 00:00:00 2001 From: Stanislau Komar Date: Sat, 11 Nov 2023 04:06:40 +0400 Subject: [PATCH 2/2] v1.6.1.1 Stream request supports --- src/Listener/ApplicationRoadrunnerStartedListener.php | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/Listener/ApplicationRoadrunnerStartedListener.php b/src/Listener/ApplicationRoadrunnerStartedListener.php index 447d96b..e0f5212 100644 --- a/src/Listener/ApplicationRoadrunnerStartedListener.php +++ b/src/Listener/ApplicationRoadrunnerStartedListener.php @@ -56,7 +56,11 @@ public function on(EventInterface $event): void $gcCollectStep = $this->httpRoadrunnerFacade->getGcCollectCyclesCount(); while ($request = $worker->waitRequest()) { try { - $appRequest = $httpFoundationFactory->createRequest($request); + $isStreamed = \in_array(mb_strtolower($request->getMethod()), [ + 'post', 'put', 'patch', + ]); + + $appRequest = $httpFoundationFactory->createRequest($request, $isStreamed); $appResponse = $this->httpFacade->execute($appRequest, false); $worker->respond($httpMessageFactory->createResponse($appResponse)); } catch (\Throwable $e) {