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

@ -66,6 +66,8 @@ namespace Microsoft.AspNet.Server.Kestrel
Post(OnStop, null); Post(OnStop, null);
if (!_thread.Join((int)timeout.TotalMilliseconds)) if (!_thread.Join((int)timeout.TotalMilliseconds))
{
try
{ {
Post(OnStopRude, null); Post(OnStopRude, null);
if (!_thread.Join((int)timeout.TotalMilliseconds)) if (!_thread.Join((int)timeout.TotalMilliseconds))
@ -79,6 +81,19 @@ namespace Microsoft.AspNet.Server.Kestrel
} }
} }
} }
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
_thread.Abort();
#endif
}
}
}
if (_closeError != null) if (_closeError != null)
{ {
_closeError.Throw(); _closeError.Throw();
@ -217,7 +232,7 @@ namespace Microsoft.AspNet.Server.Kestrel
// run the loop one more time to delete the open handles // run the loop one more time to delete the open handles
_post.Reference(); _post.Reference();
_post.DangerousClose(); _post.Dispose();
_engine.Libuv.walk( _engine.Libuv.walk(
_loop, _loop,
@ -231,7 +246,7 @@ namespace Microsoft.AspNet.Server.Kestrel
}, },
IntPtr.Zero); IntPtr.Zero);
// Ensure the "DangerousClose" operation completes in the event loop. // Ensure the Dispose operations complete in the event loop.
var ran2 = _loop.Run(); var ran2 = _loop.Run();
_loop.Dispose(); _loop.Dispose();

View File

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