-
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
DelayedStream.setStream() should cancel the provided stream if not using it #1537
Comments
Resolves grpc#1537 Also disallow cancel() before start(). DelayedClientTransport.shutdownNow() races with stream start(), thus it shouldn't call cancel() directly. It would delay the cancellation until the stream is started.
Resolves grpc#1537 Also disallow cancel() before start(). DelayedClientTransport.shutdownNow() races with stream start(), thus it shouldn't call cancel() directly. It would delay the cancellation until the stream is started.
This is more of a code health issue, since this shouldn't cause any trouble today. It's just a place where But since that is implementation-specific, we'd like to clean it up. Moving to 1.2 though, since the change is a bit more invasive that I'd hope to do just before 1.1 release for something that shouldn't matter. |
#2618 didn't work out, because while it resolves the "real streams discarded" issue, it introduces a new issue that it may wastefully start only to cancel real streams immediately:
@ejona86 and I discussed three options to proceed with:
We find Option 2 is the cleanest, and possibly the easiest. If that turns out to be not the case, we will try Option 3. This is not urgent. We will proceed once the LBv2 switch is done. |
@zhangkun83 Is there anything more to do for this? |
It looks like this didnt make it, re pushing. |
If
cancel()
orsetStream()
was previously called thensetStream()
throws away the stream argument. It shouldcancel()
the stream to make sure resources are freed, although I think only DelayedClientTransport benefits.This should not be done until after #1536. I don't know if OkHttp suffers a similar problem. If so, we may want to revisit whether it makes sense to allow streams to be cancelled before
start()
.The text was updated successfully, but these errors were encountered: