Using:
"Microsoft.AspNetCore.Server.Kestrel": "1.1.0",
I just got (not consistent, obviously):
``
Unhandled Exception: System.AggregateException: One or more errors occurred. (Error -4082 EBUSY resource busy or locked) ---> Microsoft.AspNetCore.Server.Kestrel.Internal.Networking.UvException: Error -4082 EBUSY resource busy or locked
at Microsoft.AspNetCore.Server.Kestrel.Internal.Networking.Libuv.ThrowError(Int32 statusCode)
at Microsoft.AspNetCore.Server.Kestrel.Internal.Networking.Libuv.loop_close(UvLoopHandle handle)
at Microsoft.AspNetCore.Server.Kestrel.Internal.Networking.UvLoopHandle.ReleaseHandle()
at System.Runtime.InteropServices.SafeHandle.InternalDispose()
at Microsoft.AspNetCore.Server.Kestrel.Internal.KestrelThread.ThreadStart(Object parameter)
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
at Microsoft.AspNetCore.Server.Kestrel.Internal.KestrelThread.<StopAsync>d__45.MoveNext()
--- End of inner exception stack trace ---
at System.ThrowHelper.ThrowAggregateException(List1 exceptions)
at System.Threading.Tasks.Task.WaitAll(Task[] tasks, Int32 millisecondsTimeout, CancellationToken cancellationToken)
at Microsoft.AspNetCore.Server.Kestrel.Internal.KestrelEngine.Dispose()
at Microsoft.AspNetCore.Server.Kestrel.KestrelServer.Dispose()
at Microsoft.Extensions.DependencyInjection.ServiceProvider.Dispose()
at Microsoft.AspNetCore.Hosting.Internal.WebHost.Dispose()
at Raven.Server.RavenServer.Dispose() in C:\Work\ravendb-4.0\src\Raven.Server\RavenServer.cs:line 374
at Raven.Server.Program.Main(String[] args) in C:\Work\ravendb-4.0\src\Raven.Server\Program.cs:line 64
````
Do you know if any connections were still open when the server was shutdown? If you're unsure, you can enable Trace or Debug logging. Knowing which Windows version you saw this on might also help. Thanks.
Windows 10, and there _shouldn't_ have been any open connections.
I closed any before I closed the server
@halter73 to find the bug with more details and close this one as dup.
We'll keep this since it was filed first. The dup is https://github.com/aspnet/KestrelHttpServer/issues/1333 (A socket stopped by uv_read_stop doesn't keep uv_run executing leading to EBUSY error during shutdown) From the issue:
The following exception will be thrown during shutdown because KestrelThread.OnStopRude() is never called and the stopped UvTcpHandles are never closed.
Unhandled Exception: System.AggregateException: One or more errors occurred. (Error -4082 EBUSY resource busy or locked) (Error -4082 EBUSY resource busy or locked) ---> Microsoft.AspNetCore.Server.Kestrel.Internal.Networking.UvException: Error -4082 EBUSY resource busy or locked
at Microsoft.AspNetCore.Server.Kestrel.Internal.Networking.Libuv.ThrowError(Int32 statusCode) in KestrelHttpServer\src\Microsoft.AspNetCore.Server.Kestrel\Internal\Networking\Libuv.cs:line 83
at Microsoft.AspNetCore.Server.Kestrel.Internal.Networking.Libuv.ThrowIfErrored(Int32 statusCode) in KestrelHttpServer\src\Microsoft.AspNetCore.Server.Kestrel\Internal\Networking\Libuv.cs:line 74
at Microsoft.AspNetCore.Server.Kestrel.Internal.Networking.Libuv.loop_close(UvLoopHandle handle) in KestrelHttpServer\src\Microsoft.AspNetCore.Server.Kestrel\Internal\Networking\Libuv.cs:line 112
at Microsoft.AspNetCore.Server.Kestrel.Internal.Networking.UvLoopHandle.ReleaseHandle() in KestrelHttpServer\src\Microsoft.AspNetCore.Server.Kestrel\Internal\Networking\UvLoopHandle.cs:line 49
at System.Runtime.InteropServices.SafeHandle.InternalDispose()
at Microsoft.AspNetCore.Server.Kestrel.Internal.KestrelThread.ThreadStart(Object parameter) in KestrelHttpServer\src\Microsoft.AspNetCore.Server.Kestrel\Internal\Infrastructure\KestrelThread.cs:line 310
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
at Microsoft.AspNetCore.Server.Kestrel.Internal.KestrelThread.<StopAsync>d__45.MoveNext() in KestrelHttpServer\src\Microsoft.AspNetCore.Server.Kestrel\Internal\Infrastructure\KestrelThread.cs:line 151
--- End of inner exception stack trace ---
at System.ThrowHelper.ThrowAggregateException(List`1 exceptions)
at System.Threading.Tasks.Task.WaitAll(Task[] tasks, Int32 millisecondsTimeout, CancellationToken cancellationToken)
at System.Threading.Tasks.Task.WaitAll(Task[] tasks, Int32 millisecondsTimeout)
at System.Threading.Tasks.Task.WaitAll(Task[] tasks)
at Microsoft.AspNetCore.Server.Kestrel.Internal.KestrelEngine.Dispose() in KestrelHttpServer\src\Microsoft.AspNetCore.Server.Kestrel\Internal\KestrelEngine.cs:line 54
at Microsoft.AspNetCore.Server.Kestrel.KestrelServer.Dispose() in KestrelHttpServer\src\Microsoft.AspNetCore.Server.Kestrel\KestrelServer.cs:line 213
at Microsoft.Extensions.DependencyInjection.ServiceProvider.Dispose()
at Microsoft.AspNetCore.Hosting.Internal.WebHost.Dispose()
at WebApplication10.Program.Main(String[] args) in C:\Users\shalter\Documents\Visual Studio 2015\Projects\WebApplication10\src\WebApplication10\Program.cs:line 60
Note to self to also move the disposal of WriteReqPool to KestrelThread.ThreadStart also as part of this change.
This is fixed
Most helpful comment
Note to self to also move the disposal of WriteReqPool to KestrelThread.ThreadStart also as part of this change.