somdoron / AsyncIO

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

GetQueuedCompletionStatusEx does not return

valeriob opened this issue · comments

Hi,
i got to this point using netmq library, i'm using a SubscriberSocket to connect to a remote publisher, on a netcore 3.01 console application.

I run the application with normal connectivity and it works as expected, i receive data.
Then i unplug the network (disable wifi for example) and correctly the api SubscriberSocket.TryReceiveFrameBytes returns false, if i turn on the network then on some computers (windows 10 1909) it start working again, on some other (same windows version and same .netcore version) it remain stuck.

I diagnosed the problem a bit thanks to netmq and asyncio source code, i got to this line of code

bool result = UnsafeMethods.GetQueuedCompletionStatusEx(m_completionPortHandle,

The issue seems like that this call never returns if i unplug the network.

The even stranger thing is that if i unplug the network for less that 10seconds it recovers, otherway it does not 😄

I'm sorry if i'm not able to provide any further detail, and i could not understand what's differente on the computers to cause the problem (wifi driver ?). Do you have any adivce on how to diagnose/ fix the problem ?
Thanks

commented

I also met with this type of issue, years ago, while my application was targeting .NET Framework 4, on both Win10 and Win2008. Since my application was communicating with a lot of IoT devices, this could occur quite frequently.

The workaround is to set a timeout to the GetQueuedCompletionStatusEx and recycle the Overlapped instances within AsyncSocket after a long-enough period to reclaim the resources.

commented

Maybe you can also take a look at #26.

Thanks @wmjordan !
Unfortunatly i'm not familiar with completition port api :(