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’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

withClient API can hit precondition #2214

Closed
FranzBusch opened this issue Mar 27, 2025 · 2 comments · Fixed by #2215
Closed

withClient API can hit precondition #2214

FranzBusch opened this issue Mar 27, 2025 · 2 comments · Fixed by #2215
Labels
kind/bug Feature doesn't work as expected. version/v2 Relates to v2

Comments

@FranzBusch
Copy link
Collaborator

Describe the bug

If the withGRPCClient API is called with an empty handleClient closure then it is possible to hit the The client has stopped and can only be started once. precondition in its internal state machine. The reason for this is that beginGracefulShutdown() is called before runConnections().

To reproduce

Write a test that does this

try await GRPCClient.withGRPCClient(....) {}

Expected behaviour

We should handle this gracefully

@glbrntt glbrntt added kind/bug Feature doesn't work as expected. version/v2 Relates to v2 labels Mar 27, 2025
@glbrntt
Copy link
Collaborator

glbrntt commented Mar 27, 2025

Oh –- it's not a precondition, just an error. Nevertheless this should be fixed.

@glbrntt
Copy link
Collaborator

glbrntt commented Mar 27, 2025

This can't (easily) be fixed in a sensible way: if the body of withGRPCClient returns quickly and never uses the client then there's an inherent race here. Given this is a weird edge case I think the right move is to just improve the diagnostic.

@glbrntt glbrntt linked a pull request Mar 27, 2025 that will close this issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kind/bug Feature doesn't work as expected. version/v2 Relates to v2
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants