-
Notifications
You must be signed in to change notification settings - Fork 3.9k
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
Fix flaky retry tests #10887
Fix flaky retry tests #10887
Conversation
@@ -103,8 +105,11 @@ public class RetryTest { | |||
@Rule | |||
public final GrpcCleanupRule cleanupRule = new GrpcCleanupRule(); | |||
private final FakeClock fakeClock = new FakeClock(); | |||
@Mock | |||
private ClientCall.Listener<Integer> mockCallListener; | |||
private TestListener realMockCallListener = new TestListener(); |
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.
I wouldn't use the word "mock" since it's not a mock object. Just testCallListener
would do I think, or people ofthen use the term "fake" with these kinds of classes.
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.
changed to testCallListener
@Before | ||
public void setUp() throws Exception { | ||
} |
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.
This can be removed, right?
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.
removed.
if (getTransportTracer() != null) { | ||
getTransportTracer().reportStreamClosed(status.isOk()); | ||
} | ||
listener().closed(status, rpcProgress, trailers); |
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.
You switched the order of the the listener and transportTracer.
The original tests is about verifying census stats(in statsTraceCtx), how does that related to transportTracer?
The test is checking the stats which get set in the tracer. It is waiting
for the closed to be called to make the check, but when the closed method
is called before the tracer report is generated there is a window where the
report isn't available, which is what caused the failures.
…On Fri, Feb 2, 2024 at 2:13 PM yifeizhuang ***@***.***> wrote:
***@***.**** commented on this pull request.
------------------------------
In core/src/main/java/io/grpc/internal/AbstractClientStream.java
<#10887 (comment)>:
> if (getTransportTracer() != null) {
getTransportTracer().reportStreamClosed(status.isOk());
}
+ listener().closed(status, rpcProgress, trailers);
You switched the order of the the listener and transportTracer.
The original tests is about verifying census stats(in statsTraceCtx), how
does that related to transportTracer?
—
Reply to this email directly, view it on GitHub
<#10887 (review)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AZQMCXWMGCWF454XV52NYNTYRVQH3AVCNFSM6AAAAABCVTLZR2VHI2DSMVQWIX3LMV43YUDVNRWFEZLROVSXG5CSMV3GSZLXHMYTQNRQGQ4DMMRYGE>
.
You are receiving this because you authored the thread.Message ID:
***@***.***>
|
hmm, I had a theory about why the call closed method is called before those reports I put on the issue. |
Your delay masked the window.
…On Fri, Feb 2, 2024 at 3:08 PM yifeizhuang ***@***.***> wrote:
when the closed method is called before the tracer report is generated
there is a window where the report isn't available, which is what caused
the failures.
hmm, I had a theory about why the call closed method is called before
those reports I put on the issue.
—
Reply to this email directly, view it on GitHub
<#10887 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AZQMCXRF3M27PCQYBO5R43TYRVWYVAVCNFSM6AAAAABCVTLZR2VHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMYTSMRUHA4DIMRWGI>
.
You are receiving this because you authored the thread.Message ID:
***@***.***>
|
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.
I don't have enough understanding of the original problem to know if @YifeiZhuang's concern here is warranted, but if she is ok with the change it LGTM.
I agree that the test setup caused the flakiness, not a real problem. One thing to keep in mind: when canceling the retryable stream returns and close and master listener, all the substreams should have been closed already. Because notifying master listener is the last thing we should do in retryable stream. Otherwise there will be resource leak, e.g. RejectedExecutionException. |
* Reorder tracing and actually closing listener to eliminate test flakiness * Use real value rather than mock for flaky test
* Reorder tracing and actually closing listener to eliminate test flakiness * Use real value rather than mock for flaky test
* Reorder tracing and actually closing listener to eliminate test flakiness * Use real value rather than mock for flaky test
* Reorder tracing and actually closing listener to eliminate test flakiness * Use real value rather than mock for flaky test
* Reorder tracing and actually closing listener to eliminate test flakiness * Use real value rather than mock for flaky test
* Reorder tracing and actually closing listener to eliminate test flakiness * Use real value rather than mock for flaky test
* Reorder tracing and actually closing listener to eliminate test flakiness * Use real value rather than mock for flaky test
* Reorder tracing and actually closing listener to eliminate test flakiness * Use real value rather than mock for flaky test
* Reorder tracing and actually closing listener to eliminate test flakiness * Use real value rather than mock for flaky test
* Reorder tracing and actually closing listener to eliminate test flakiness * Use real value rather than mock for flaky test
* Reorder tracing and actually closing listener to eliminate test flakiness * Use real value rather than mock for flaky test
Fix retry tests that became flaky. Fixes #10873