-
Notifications
You must be signed in to change notification settings - Fork 307
webHost.Dispose() does not complete #918
Comments
WebListener may be waiting for current requests to complete. Are there any long running requests active when this happens? |
Do you have any logs? Turning the logs up to verbose might help you see what's happening. You could also take a look at the debugger or a dump to see what the active threads are doing. |
I actually have a repro with a simple WebListener application. Check out the basic web app here. https://github.com/izaaz/SFTestApp I deployed this to my local cluster and generated fake traffic using the following script.
When this program is running, try upgrading the SF with a new version. You'll notice the cluster go into warning state. Meanwhile, I am going to try taking a dump of the process and see what might be going on. |
You shouldn't need a dump right? Just pause the threads and look at the callstacks. Parallel stacks is a great tool for this if you can reproduce it in vs |
Should just be on symbols |
@masnider I am not sure if i understood what you meant? It wasn't able to find it in the default "Microsoft Symbol Servers" |
Just to add, when I use kestrel instead of weblistener, I don't see the issue anymore. |
Looks like a deadlock of sorts.. Thread calling webhost.Dispose owns a lock on System.Collections.Generic.Dictionary`2[[Microsoft.Extensions.DependencyInjection.ServiceLookup.IService, Microsoft.Extensions.DependencyInjection],[System.Object, mscorlib]] And is now waiting for requests to drain.... However, at least one request that’s supposed to drain is actually trying to acquire that lock.. so it’s stuck in: 000000001b79ce98 00007ffd977a6c24 [HelperMethodFrame: 000000001b79ce98] System.Threading.Monitor.Enter(System.Object) |
@Tratcher it seems like WebListener waits indefinitely on requests to drain. There should be a timeout like in Kestrel. |
Opened aspnet/HttpSysServer#298 as this isn't a hosting issue. |
Pls make it configurable ;) |
Unfortunately, I can't think of a great workaround for this one. You'd have to copy the MessagePump code and tweak this method https://github.com/aspnet/HttpSysServer/blob/5fca3b0022a5125e0dad98004abd4e01983f98fe/src/Microsoft.AspNetCore.Server.WebListener/MessagePump.cs#L222-L226. Then you could register it as the server for your application. |
Hi,
We have a dot net core WebListener service deployed in Service Fabric. When we upgrade the service version, SF tries to stop the application by calling CloseAsync before it upgrades it to the new version. This is our implementation for that.
What we see is, when the service is receiving traffic and when service fabric calls CloseAsync, the dispose function call does not complete (no exception gets thrown) and hence service fabric waits for 15 minutes before killing the application. Where as, when the service is not receiving any traffic, the dispose method completes fine and everything executes as expected.
Any idea why dispose might not be returning when the service is receiving traffic?
Thanks,
Izaaz
The text was updated successfully, but these errors were encountered: