Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

core: Added changes to DelayedStream.setStream() should cancel the provided stream if not using it #11969

Open
wants to merge 30 commits into
base: master
Choose a base branch
from

Conversation

Sangamesh1997
Copy link

core: Added changes to DelayedStream.setStream() should cancel the provided stream if not using it

Fixes: #1537

@@ -271,14 +272,41 @@ public void uncaughtException(Thread t, Throwable e) {
verifyNoMoreInteractions(mockRealStream);
}

@Test
public void newStreamThenShutDownNow() {
Copy link
Contributor

Choose a reason for hiding this comment

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

append test with UT method name -> testNewStreamThenShutDownNow()

Copy link
Author

Choose a reason for hiding this comment

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

Fixed.

ClientStream stream = delayedTransport.newStream(
method, new Metadata(), CallOptions.DEFAULT, tracers);
stream.start(streamListener);
assertEquals(1,delayedTransport.getPendingStreamsCount());
Copy link
Contributor

@vinodhabib vinodhabib Mar 19, 2025

Choose a reason for hiding this comment

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

add an empty line above asserts statements in all applicable places.

Copy link
Author

Choose a reason for hiding this comment

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

Fixed.

Copy link
Contributor

@vinodhabib vinodhabib left a comment

Choose a reason for hiding this comment

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

Added some minor comments, please check.

return null;
}

Copy link
Contributor

Choose a reason for hiding this comment

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

remove an empty line here

Copy link
Author

Choose a reason for hiding this comment

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

Fixed.

@Sangamesh1997 Sangamesh1997 marked this pull request as ready for review March 21, 2025 07:02
Copy link
Contributor

@vinodhabib vinodhabib left a comment

Choose a reason for hiding this comment

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

Changes LGTM

synchronized (this) {
// If realStream != null, then either setStream() or cancel() has been called.
Copy link
Contributor

Choose a reason for hiding this comment

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

Has this changed ?

Copy link
Author

@Sangamesh1997 Sangamesh1997 Apr 3, 2025

Choose a reason for hiding this comment

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

No, added back the removed comment, it was accidentally missed while updating the code, but the logic still holds. if realStream() != null, it means setStream() was called, and if listener !=null, the old stream may have been cancelled.

ClientStream stream = delayedTransport.newStream(
method, new Metadata(), CallOptions.DEFAULT, tracers);
stream.start(streamListener);
assertEquals(1,delayedTransport.getPendingStreamsCount());
Copy link
Contributor

Choose a reason for hiding this comment

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

Please add a space after the comma...

Copy link
Author

Choose a reason for hiding this comment

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

Fixed.

verify(streamListener).closed(
statusCaptor.capture(), any(RpcProgress.class), any(Metadata.class));

assertEquals(0,delayedTransport.getPendingStreamsCount());
Copy link
Contributor

Choose a reason for hiding this comment

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

Please add a space after the comma...

Copy link
Author

Choose a reason for hiding this comment

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

Fixed.

ejona86 and others added 16 commits April 3, 2025 06:48
This allows Filters to access the xds configuration for their own
processing. From gRFC A83:

> This data is available via the XdsConfig attribute introduced in A74.
> If the xDS ConfigSelector is not already passing that attribute to the
> filters, it will need to be changed to do so.
It is much harder to debug refcounting problems when we ignore
impossible situations. So make such impossible cases complain loudly so
the bug is obvious.
This is to support gRFC A83 xDS GCP Authentication Filter:
> Otherwise, the filter will look in the CDS resource's metadata for a
> key corresponding to the filter's instance name.
panic() calls a good amount of code, so it could get another exception.
The SynchronizationContext is running on an arbitrary thread and we
don't want to propagate this secondary exception up its stack (to be
handled by its UncaughtExceptionHandler); it we wanted that we'd
propagate the original exception.

This second exception will only be seen in the logs; the first exception
was logged and will be used to fail RPCs.

Also related to http://yaqs/8493785598685872128 and b692b9d
…already have their connections cancelled (grpc#11934)

Some clients watching health status can cancel their watch and `HealthService` when trying to notify these watchers were getting CANCELLED exception because there was no cancellation  handler set on the `StreamObserver`. This change sets the cancellation handler that removes the watcher from the set of watcher clients to be notified of the health status.
Previously it would wait for the new LB to enter READY. However, that
prevents there being an upper-bound on how long the old policy will
continue to be used. The point of graceful switch is to avoid RPCs
seeing increased latency when we swap config. We don't want it to
prevent the system from becoming eventually consistent.
I think at some point there were more usages in the tests. But now it
is pretty easy.

PriorityLb.ChildLbState.picker is initialized to
FixedResultPicker(NoResult). So now that GracefulSwitchLb is using the
same picker, equals() is able to de-dup an update.
…CING_CONFIG (grpc#11982)

ATTR_LOAD_BALANCING_CONFIG was deleted in bf7a42d.
"EXP" stood for experimental and all documentation that referenced it made it clear it was experimental. It's been some years since we started logging a message when it was used to say it will be deleted. There's no time like the present to delete it.
@Sangamesh1997 Sangamesh1997 requested a review from AgraVator April 3, 2025 10:53
@Sangamesh1997
Copy link
Author

@AgraVator Gentle reminder on review..

# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

DelayedStream.setStream() should cancel the provided stream if not using it
10 participants