-
Notifications
You must be signed in to change notification settings - Fork 103
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
Graceful shutdown support #689
Conversation
5a4a72d
to
6efe9af
Compare
src/Microsoft.Azure.SignalR.Common/ServiceConnections/ServiceConnectionBase.cs
Outdated
Show resolved
Hide resolved
src/Microsoft.Azure.SignalR.Common/ServiceConnections/ServiceConnectionBase.cs
Outdated
Show resolved
Hide resolved
src/Microsoft.Azure.SignalR.Common/ServiceConnections/ServiceConnectionBase.cs
Outdated
Show resolved
Hide resolved
6efe9af
to
f4f4b66
Compare
src/Microsoft.Azure.SignalR/ServerConnections/ServiceConnection.cs
Outdated
Show resolved
Hide resolved
src/Microsoft.Azure.SignalR.Common/ServiceConnections/ServiceConnectionBase.cs
Outdated
Show resolved
Hide resolved
src/Microsoft.Azure.SignalR/ServerConnections/ServiceConnection.cs
Outdated
Show resolved
Hide resolved
src/Microsoft.Azure.SignalR/ServerConnections/ServiceConnection.cs
Outdated
Show resolved
Hide resolved
f4f4b66
to
ef75a26
Compare
Spoke to @terencefan offline:
|
ef75a26
to
1baeecd
Compare
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.
Shouldn't we drain the outgoing pipe as the first step of the whole shutdown process or at least after we dispose the hub and close client connections but before we send the fin?
The reason is the messages queued in the pipe (and the implicit queue inside the semaphore lock) could require acks and it feels wrong to even have a possibility to send any messages after sending fin.
@KKhurin Actually we shouldn't block the outgoing pipe even after sending the The Once our app server receives a And once our A typical disconnecting process would contain 4 steps, we reduce it into 2 (FIN + FINACK) just because we are not expecting a graceful shutdown on the client-side. |
src/Microsoft.Azure.SignalR.Common/ServiceConnections/ServiceConnectionBase.cs
Outdated
Show resolved
Hide resolved
src/Microsoft.Azure.SignalR.Common/ServiceConnections/ServiceConnectionBase.cs
Outdated
Show resolved
Hide resolved
src/Microsoft.Azure.SignalR.Common/ServiceConnections/ServiceConnectionBase.cs
Outdated
Show resolved
Hide resolved
src/Microsoft.Azure.SignalR.Common/ServiceConnections/ServiceConnectionBase.cs
Outdated
Show resolved
Hide resolved
src/Microsoft.Azure.SignalR.Common/ServiceConnections/ServiceConnectionBase.cs
Outdated
Show resolved
Hide resolved
src/Microsoft.Azure.SignalR.Common/ServiceConnections/ServiceConnectionBase.cs
Outdated
Show resolved
Hide resolved
src/Microsoft.Azure.SignalR/ServerConnections/ServiceConnection.cs
Outdated
Show resolved
Hide resolved
baa06f0
to
6d55f2f
Compare
src/Microsoft.Azure.SignalR/ServerConnections/ServiceConnectionManager.cs
Outdated
Show resolved
Hide resolved
test/Microsoft.Azure.SignalR.Tests.Common/TestClasses/TestServiceConnection.cs
Outdated
Show resolved
Hide resolved
09b3d9f
to
490d5e0
Compare
src/Microsoft.Azure.SignalR.Common/ServiceConnections/ServiceConnectionContainerBase.cs
Outdated
Show resolved
Hide resolved
test/Microsoft.Azure.SignalR.Tests.Common/TestClasses/TestServiceConnection.cs
Outdated
Show resolved
Hide resolved
d920c87
to
b9cabd6
Compare
b9cabd6
to
9092312
Compare
|
||
protected async Task WriteFinAsync(IServiceConnection c) | ||
{ | ||
var ping = new PingMessage() |
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.
move to local static readonly field, serialized?
9092312
to
a16fb6a
Compare
a16fb6a
to
c9b6861
Compare
|
||
if (task != c.ConnectionOfflineTask) | ||
{ | ||
// log |
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.
Why didn't this get fixed in the PR?
|
||
if (actual != expected) | ||
{ | ||
// TODO log timeout. |
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.
Here as well.
@@ -17,7 +16,7 @@ internal interface IServiceConnectionManager<THub> where THub : Hub | |||
|
|||
Task StopAsync(); | |||
|
|||
Task ShutdownAsync(TimeSpan timeout); | |||
Task OfflineAsync(); |
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.
OfflineAsync isn't a verb. MarkOfflineAsync? MakeOfflineAsync?
The target of this PR is to ensure all incoming and outgoing packages will be processed before a scheduled shutdown.
UPDATE 11/13
UPDATE 11/12
UPDATE 11/06
UPDATE 11/05
UPDATE 11/01
UPDATE 10/31
UPDATE 10/29
UPDATE 10/28
UPDATE 10/24
The
CloseAsync
(for each server connection) contains the following 6 steps:closeConnectionLock
to ensure at most 1closeAsync
in progress.CloseConnectionMessage
with aFIN
toASRS
ASRS
receives aFIN
, it will remove the server connection immediately from its route table (to prevent new client connections from assigning to this server connection)ASRS
has sent back aCloseConnectionMessage
with aFINACK
.client connections
have stopped.ASRS
will handle the client connections and find a proper time to close them, or in some cases we just let our customer close them by themselves. So we intentionally do nothing on the SDK side during this step.incoming pipe
(StartAsync)
has stopped safely.