Azure / Azure/DotNetty

channel.WriteAsync hangs forever if channel is closed

Open
#502 0 comments 0 reactions 0 assignees View on GitHub
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

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.