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

Reset go away state #49

Merged
merged 2 commits into from
Dec 18, 2024
Merged

Reset go away state #49

merged 2 commits into from
Dec 18, 2024

Conversation

glbrntt
Copy link
Collaborator

@glbrntt glbrntt commented Dec 18, 2024

Motivation:

The pick first load balancer keeps track of whether the current subchannel is going away. This is done so that if there isn't yet a subchannel to roll over too it won't be offered up when the GRPCChannel asks for a subchannel. However, this state wasn't reset in enough places within the state machine.

Modifications:

  • Reset the is-going-away state when updating the current subchannel and when the current subchannel becomes idle

Result:

Resolves #40

Motivation:

The pick first load balancer keeps track of whether the current
subchannel is going away. This is done so that if there isn't yet a
subchannel to roll over too it won't be offered up when the GRPCChannel
asks for a subchannel. However, this state wasn't reset in enough places
within the state machine.

Modifications:

- Reset the is-going-away state when updating the current subchannel and
  when the current subchannel becomes idle

Result:

Resolves grpc#40
@glbrntt glbrntt added the 🔨 semver/patch No public API change. label Dec 18, 2024
@glbrntt glbrntt requested a review from gjcairo December 18, 2024 15:50
@@ -307,6 +308,7 @@ final class PickFirstLoadBalancerTests: XCTestCase {
// Must only be connected to server 2 now.
XCTAssertEqual(context.servers[0].server.clients.count, 0)
XCTAssertEqual(context.servers[1].server.clients.count, 1)
XCTAssertNotNil(context.loadBalancer.pickSubchannel())
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Without the fix this returns nil even though a connection is ready and available to use.

Copy link
Collaborator

@gjcairo gjcairo left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good one, thanks George!

@glbrntt glbrntt merged commit 289c0bc into grpc:main Dec 18, 2024
22 of 28 checks passed
@glbrntt glbrntt deleted the reset-going-away-state branch December 18, 2024 16:11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
🔨 semver/patch No public API change.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

”Channel isn't ready.” after client being ideal for a while
2 participants