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
Ensure That Metrics Only Decrements Active Requests Once #2916
Ensure That Metrics Only Decrements Active Requests Once #2916
Conversation
This may not be a bug. I'm actually not 100% sure anymore. Leaving open until I can think on it some more. |
After some additional testing, I do still believe there is an edge case here and I do still think the changes I've proposed will fix it. Here is what I know,
Here is what I suspect. So, my brain is exhausted. I'll update the commit/PR notes tomorrow with some better, and hopefully actually correct, examples if not tests cases. |
Prior to this commit there was an edge case where the `ops.decreaseActiveRequests` would get run more than once if an error or cancellation occurred _after_ the `onFinalize` method was run in `onResponse`. This change adds a `Ref` which is initialized at the start of request handling and set to `true` once the `ops.decreaseActiveRequests` is run. All attempts to set `ops.decreaseActiveRequests` are guarded by this boolean value.
18e6d37
to
91944e9
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Bit of a hammer, does add a little weight for each request, but I think its worth it to outlaw this condition.
Oops. This is a bugfix. I should have backported this one. |
Prior to this commit there was an edge case where the `ops.decreaseActiveRequests` would get run more than once if an error or cancellation occurred _after_ the `onFinalize` method was run in `onResponse`. This change adds a `Ref` which is initialized at the start of request handling and set to `true` once the `ops.decreaseActiveRequests` is run. All attempts to set `ops.decreaseActiveRequests` are guarded by this boolean value.
Prior to this commit there was an edge case where the `ops.decreaseActiveRequests` would get run more than once if an error or cancellation occurred _after_ the `onFinalize` method was run in `onResponse`. This change adds a `Ref` which is initialized at the start of request handling and set to `true` once the `ops.decreaseActiveRequests` is run. All attempts to set `ops.decreaseActiveRequests` are guarded by this boolean value.
Prior to this commit there was an edge case where the
ops.decreaseActiveRequests
would get run more than once if an error or cancellation occurred after theonFinalize
method was run inonResponse
.This change adds a
Ref
which is initialized at the start of request handling and set totrue
once theops.decreaseActiveRequests
is run. All attempts to setops.decreaseActiveRequests
are guarded by this boolean value.