Remove UvAsyncHandle.DangerousClose

- This should stop the AVs we've been seeing in some of our test runs
This commit is contained in:
Stephen Halter 2015-11-09 19:31:46 -08:00
parent 55f6f21d5a
commit e5ff33eda2
2 changed files with 20 additions and 11 deletions

View File

@ -67,10 +67,24 @@ namespace Microsoft.AspNet.Server.Kestrel
Post(OnStop, null);
if (!_thread.Join((int)timeout.TotalMilliseconds))
{
Post(OnStopRude, null);
if (!_thread.Join((int)timeout.TotalMilliseconds))
try
{
Post(OnStopImmediate, null);
Post(OnStopRude, null);
if (!_thread.Join((int)timeout.TotalMilliseconds))
{
Post(OnStopImmediate, null);
if (!_thread.Join((int)timeout.TotalMilliseconds))
{
#if NET451
_thread.Abort();
#endif
}
}
}
catch (ObjectDisposedException)
{
// REVIEW: Should we log something here?
// Until we rework this logic, ODEs are bound to happen sometimes.
if (!_thread.Join((int)timeout.TotalMilliseconds))
{
#if NET451
@ -79,6 +93,7 @@ namespace Microsoft.AspNet.Server.Kestrel
}
}
}
if (_closeError != null)
{
_closeError.Throw();
@ -217,7 +232,7 @@ namespace Microsoft.AspNet.Server.Kestrel
// run the loop one more time to delete the open handles
_post.Reference();
_post.DangerousClose();
_post.Dispose();
_engine.Libuv.walk(
_loop,
@ -231,7 +246,7 @@ namespace Microsoft.AspNet.Server.Kestrel
},
IntPtr.Zero);
// Ensure the "DangerousClose" operation completes in the event loop.
// Ensure the Dispose operations complete in the event loop.
var ran2 = _loop.Run();
_loop.Dispose();

View File

@ -26,12 +26,6 @@ namespace Microsoft.AspNet.Server.Kestrel.Networking
_uv.async_init(loop, this, _uv_async_cb);
}
public void DangerousClose()
{
Dispose();
ReleaseHandle();
}
public void Send()
{
_uv.async_send(this);