-
Notifications
You must be signed in to change notification settings - Fork 14
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
Resumable connection and explicit ShutdownAsync/CloseAsync calls #891
Comments
This sounds fine. |
I have slightly preference for use https://github.com/dotnet/runtime/search?p=1&q=Changed |
Somewhat related: I find the Close vs Shutdown distinction very confusing. If close = non-graceful shutdown, should we just add a bool parameter to |
I was thinking of renaming CloseAsync to AbortAsync to be more explicit. I can live with a bool if you prefer ( What I don't really like is that |
As far as I can tell, CloseAsync is async only because INetworkConnection is IAsyncDisposable but not Disposable and we don't distinguish between graceful and non-graceful closure for INetworkConnection. Could we either make INetworkConnection Disposable (and as a result Close non-async) or add graceful vs non-graceful closure of an INetworkConnection where the non-graceful closure is sync? I find Abort + Shutdown a little bit clearer than Close + Shutdown, however I think a single term would be even better, like: vs state = shutting down |
Yes, the ice and icerpc protocol implement graceful closure and close the network transport connection without making any assumption on the transport closure implementation.
It's a bit like the PipeReader/Writer complete methods. Some transport implementations might require async, others don't. In general higher level transport protocols such as SSL or WebSocket have their own shutdown logic which is async (TCP also has shutdown write actually). However, we prefer to implement our own shutdown logic with ice/icerpc to guarantee at-most-once retry semantics.
There's also more discussions on this here: dotnet/runtime#43290 As you can see, lots of discussions there :). I think the simplest is to keep the transport async disposable and try to ensure that the transport connection is closed with the recommended sequence (if the language API allows it!). And even if don't really care because we use our own graceful shutdown logic to ensure it works regardless of what the underlying transport implements. |
Say we use a transport which provides only an async network connection closure, say And we implement XxxNetworkConnection.Dispose with What would be the downside? That we may lose some |
As of today, it makes no differences (especially since we don't care about sending SSL However I have no idea if tomorrow a transport will require an async graceful closure for which it will be desirable to wait for the closure (for the application implementation purpose). For sure, we don't take a great risk at having a synchronous network connection dispose method. |
@bentoi, can we close this issue? |
Related to #889
What should be the behavior of the following code?
Should the second
IcePingAsync
:ShutdownAsync
,CloseAsync
orDisposeAsync
),ShutdownAsync
orCloseAsync
. The connection is no longer resumable only ifDisposeAsync
is called.We implement the second option but I'm thinking the first one would be better given that
DisposeAsync
semantics are the same as callingShutdownAsync("", new CancellationToken(canceled: true));
(likeServer
). In other words, explicitly shutting down, closing or disposing the connection should make the connection non-resumable.The connection
ClosedEvent
and the newShutdownCompletion
task would only be called/completed once the application call toShutdownAsync
,CloseAsync
orDisposeAsync
complete.The text was updated successfully, but these errors were encountered: