From 5159bdd4207921af2362ca0fab5cc9826cc914f8 Mon Sep 17 00:00:00 2001 From: Dmitriy Derepko Date: Fri, 29 May 2026 15:37:54 +0400 Subject: [PATCH] fix: reproduce infinite loop in ListWorkflowExecutions --- .../ListWorkflowExecutionsHangTestCase.php | 56 +++++++++++++++++++ 1 file changed, 56 insertions(+) create mode 100644 tests/Unit/Client/GRPC/ListWorkflowExecutionsHangTestCase.php diff --git a/tests/Unit/Client/GRPC/ListWorkflowExecutionsHangTestCase.php b/tests/Unit/Client/GRPC/ListWorkflowExecutionsHangTestCase.php new file mode 100644 index 000000000..cdc34a5db --- /dev/null +++ b/tests/Unit/Client/GRPC/ListWorkflowExecutionsHangTestCase.php @@ -0,0 +1,56 @@ +options = $options; + throw new ServiceClientException((object) ['code' => StatusCode::INVALID_ARGUMENT, 'metadata' => []]); + } + }; + + $serviceClient = new ServiceClient(static fn(): WorkflowServiceClient => $workflowService); + $serviceClient = $serviceClient->withContext($serviceClient->getContext()->withDeadline(new \DateTimeImmutable('+5 seconds'))); + $client = WorkflowClient::create($serviceClient); + + try { + \iterator_to_array($client->listWorkflowExecutions('WorkflowType="Repro"')); + self::fail('Expected the non-retryable error to surface.'); + } catch (ServiceClientException) { + } + + self::assertArrayHasKey( + 'timeout', + $workflowService->options, + 'listWorkflowExecutions must pass a deadline so the RPC cannot retry forever.', + ); + self::assertGreaterThan(0, $workflowService->options['timeout']); + } +}