Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

[馃悰 BUG]: GRPC Server #32

Open
1 task done
farums opened this issue Apr 11, 2024 · 1 comment 路 May be fixed by roadrunner-php/grpc#30
Open
1 task done

[馃悰 BUG]: GRPC Server #32

farums opened this issue Apr 11, 2024 · 1 comment 路 May be fixed by roadrunner-php/grpc#30
Assignees
Labels
bug Something isn't working

Comments

@farums
Copy link

farums commented Apr 11, 2024

No duplicates 馃ゲ.

  • I have searched for a similar issue in our bug tracker and didn't find any solutions.

What happened?

When using the method Spiral\RoadRunner\GRPC::serve, undesirable behavior related to the persistence of the \Throwable $e variable between iterations of the while loop was discovered. Upon subsequent invocations of the code, the $e variable is preserved, which can lead to unpredictable error handling and execution of code in the finally block, which does not correspond to the expected behavior.

Version (package version)

3.20

How to reproduce the issue?

To reproduce the issue, follow these steps:

  1. Use the method Spiral\RoadRunner\GRPC::serve to start the GRPC server.
  2. In the while loop body that handles requests, trigger an exception (for example, using throw new \Exception('Test Exception');).
  3. Handle the exception in the catch (\Throwable $e) block and perform any actions according to your logic.
  4. Repeatedly invoke the code that initiates the processing of requests to the GRPC server, for example, by sending a new request to the server.
  5. Note that the \Throwable $e variable is preserved between iterations of the while loop, and the code in the finally block may handle previous errors, which can lead to undesirable behavior.

Relevant log output

Solution:

finally {
    if ($finalize !== null) {
        isset($e) ? $finalize($e) : $finalize();
    }
    unset($e); // Reset the $e variable
}
@rustatian
Copy link
Contributor

Hey @farums 馃憢
All issues should be in English only. Please edit the issue.

@rustatian rustatian added the bug Something isn't working label Jun 25, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants