Tweak libuv shutdown sequence (#1735)
* Tweak libuv shutdown sequence - Increase timeouts for thread and listener shutdowns - Remove post.Unreference call from AllowStopRude
This commit is contained in:
parent
dcea15dba7
commit
feb9d1281e
|
|
@ -5,7 +5,6 @@ using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Diagnostics;
|
using System.Diagnostics;
|
||||||
using System.Runtime.ExceptionServices;
|
using System.Runtime.ExceptionServices;
|
||||||
using System.Runtime.InteropServices;
|
|
||||||
using System.Threading;
|
using System.Threading;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
using Microsoft.AspNetCore.Hosting;
|
using Microsoft.AspNetCore.Hosting;
|
||||||
|
|
@ -165,9 +164,6 @@ namespace Microsoft.AspNetCore.Server.Kestrel.Transport.Libuv.Internal
|
||||||
handle?.Dispose();
|
handle?.Dispose();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
// uv_unref is idempotent so it's OK to call this here and in AllowStop.
|
|
||||||
_post.Unreference();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void OnStopImmediate()
|
private void OnStopImmediate()
|
||||||
|
|
|
||||||
|
|
@ -44,7 +44,7 @@ namespace Microsoft.AspNetCore.Server.Kestrel.Transport.Libuv
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
await Task.WhenAll(Threads.Select(thread => thread.StopAsync(TimeSpan.FromSeconds(2.5))).ToArray())
|
await Task.WhenAll(Threads.Select(thread => thread.StopAsync(TimeSpan.FromSeconds(5))).ToArray())
|
||||||
.ConfigureAwait(false);
|
.ConfigureAwait(false);
|
||||||
}
|
}
|
||||||
catch (AggregateException aggEx)
|
catch (AggregateException aggEx)
|
||||||
|
|
@ -123,7 +123,7 @@ namespace Microsoft.AspNetCore.Server.Kestrel.Transport.Libuv
|
||||||
{
|
{
|
||||||
var disposeTasks = _listeners.Select(listener => listener.DisposeAsync()).ToArray();
|
var disposeTasks = _listeners.Select(listener => listener.DisposeAsync()).ToArray();
|
||||||
|
|
||||||
if (!await WaitAsync(Task.WhenAll(disposeTasks), TimeSpan.FromSeconds(2.5)).ConfigureAwait(false))
|
if (!await WaitAsync(Task.WhenAll(disposeTasks), TimeSpan.FromSeconds(5)).ConfigureAwait(false))
|
||||||
{
|
{
|
||||||
Log.LogError(0, null, "Disposing listeners failed");
|
Log.LogError(0, null, "Disposing listeners failed");
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue