Skip to content

Conversation

@glbrntt
Copy link
Collaborator

@glbrntt glbrntt commented Jan 29, 2024

Motivation:

testRetriesEventuallySucceed fails infrequently. When attempting a retry, the executor checks whether it's safe for the broadcast sequence to be replayed, it does so after removing all subscribers. However, there is a timing window between invalidating subscribers and checking whether it's safe in which a subscribtion can be registered. For retries, this can happen if the server responds before the client has subscribed. In practice this is very unlikely to happen because of network latency.

Modifications:

Have the server in the test consume the inbound stream before failing, this ensures the subscribtion is created by the time the client realises the call has failed.

Result:

Test passes more reliably

Motivation:

`testRetriesEventuallySucceed` fails infrequently. When attempting a
retry, the executor checks whether it's safe for the broadcast sequence
to be replayed, it does so after removing all subscribers. However,
there is a timing window between invalidating subscribers and checking
whether it's safe in which a subscribtion can be registered. For
retries, this can happen if the server responds before the client has
subscribed. In practice this is very unlikely to happen because of
network latency.

Modifications:

Have the server in the test consume the inbound stream before failing,
this ensures the subscribtion is created by the time the client realises
the call has failed.

Result:

Test passes more reliably
@glbrntt glbrntt requested a review from gjcairo January 29, 2024 17:21
@glbrntt glbrntt added the version/v2 Relates to v2 label Jan 29, 2024
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.

Nice catch

@glbrntt glbrntt merged commit f384235 into grpc:main Jan 29, 2024
@glbrntt glbrntt deleted the retries-eventually-succeed branch January 29, 2024 17:28
glbrntt added a commit to glbrntt/grpc-swift that referenced this pull request Feb 5, 2024
Motivation:

`testRetriesEventuallySucceed` fails infrequently. When attempting a
retry, the executor checks whether it's safe for the broadcast sequence
to be replayed, it does so after removing all subscribers. However,
there is a timing window between invalidating subscribers and checking
whether it's safe in which a subscribtion can be registered. For
retries, this can happen if the server responds before the client has
subscribed. In practice this is very unlikely to happen because of
network latency.

Modifications:

Have the server in the test consume the inbound stream before failing,
this ensures the subscribtion is created by the time the client realises
the call has failed.

Result:

Test passes more reliably
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

version/v2 Relates to v2

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants