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

core: Fix NPE race during hedging #10007

Merged
merged 1 commit into from
Apr 11, 2023
Merged

core: Fix NPE race during hedging #10007

merged 1 commit into from
Apr 11, 2023

Commits on Apr 3, 2023

  1. core: Fix NPE race during hedging

    The problem was one hedge was committed before another had drained
    start(). This was not testable because HedgingRunnable checks whether
    scheduledHedgingRef is cancelled, which is racy, but there's no way to
    deterministically trigger either race.
    
    The same problem couldn't be triggered with retries because only one
    attempt will be draining at a time. Retries with cancellation also
    couldn't trigger it, for the surprising reason that the noop stream used
    in cancel() wasn't considered drained.
    
    This commit marks the noop stream as drained with cancel(), which allows
    memory to be garbage collected sooner and exposes the race for tests.
    That then showed the stream as hanging, because inFlightSubStreams
    wasn't being decremented.
    
    Fixes grpc#9185
    ejona86 committed Apr 3, 2023
    Configuration menu
    Copy the full SHA
    9c5307e View commit details
    Browse the repository at this point in the history