channel.WriteAsync hangs forever if channel is closed
Open
- Dominant language
- C#
- Stars
- 4.3k
- Forks
- 1k
- PR merge metrics
- No merged PRs in 30d
Description
Azure IoT C# SDK uses DotNetty for MQTT.
We found an issue where ReceiveAsync was hanging if DeviceClient.Dispose was called right after.
Looks like there is a race condition where if the ReceiveAsync task reaches channel.WriteAsync before the cleanup function (triggered by Dispose) gets to channel.CloseAsync, channel.WriteAsync hangs forever.
It would be expected that WriteAsync return if CloseAsync is called while it's running.
Also, looking at the API there is no option to pass cancellation tokens or set timeouts for WriteAsync.
Contributor guide
Assessment
This issue has not been assessed yet.