-
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
core: fix NPE in ConfigSelectingClientCall #8087
Conversation
@@ -1226,6 +1228,29 @@ public void cancel(@Nullable String message, @Nullable Throwable cause) { | |||
} | |||
} | |||
|
|||
private static final ClientCall<Object, Object> NOOP_CALL = new ClientCall<Object, Object>() { |
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.
Note that this is copied from ClientInterceptors.NOOP_CALL
and DelayedClientCall.NOOP_CALL
. Not refactoring and reusing the code, because this makes minimum change to backport.
@Override | ||
public void start(Listener<RespT> observer, Metadata headers) { | ||
PickSubchannelArgs args = new PickSubchannelArgsImpl(method, headers, callOptions); | ||
InternalConfigSelector.Result result = configSelector.selectConfig(args); | ||
Status status = result.getStatus(); | ||
if (!status.isOk()) { | ||
executeCloseObserverInContext(observer, status); | ||
delegate = (ClientCall<ReqT, RespT>) NOOP_CALL; |
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.
It would have been nice to avoid the cast and I think it is possible to achieve that but I understand this pattern was copied from ClientInterceptors.NOOP_CALL
and DelayedClientCall.NOOP_CALL
. If possible the refactoring can combine these into one and also avoid the cast?
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.
If possible the refactoring can combine these into one and also avoid the cast?
I think so.
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.
LG with 1 comment
Fix the following bug:
ManagedChannelImpl.ConfigSelectingClientCall
may return early instart()
leavingdelegate
null, and failsrequest()
method afterstart()
.Currently the bug can only be triggered when using xDS.
Example stacktrace: