-
Notifications
You must be signed in to change notification settings - Fork 496
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
SetMethodHandlerAsync throws SemaphoreFullException #1502
Comments
Can you describe roughly how you are using the device client around the times that you have seen it? Are you using the device client in only one thread? Are you also setting up any other callbacks on the SDK? And is the device client open before you call |
I have the DeviceClient registered as singleton in DI (Microsoft DI). I am initializing the deviceClient using I can imagine it's hard to pinpoint the source of the problem. |
Are you using this device client singleton in multiple threads at once, though? |
There are multiple places where the deviceclient is used (for listening and sending events) - so it can be that multiple threads are accessing the deviceclient at once. The type that I am registering is a wrapper around the Microsoft.Azure.Devices.Client.DeviceClient - and in the constructor I do something like
|
I believe we have identified the fix for this issue. There were some instances where our code would fail to grab the semaphore but still try to release it anyways. The fix has now been checked in and we'll update this thread once it has been released. |
This fix has now been released: https://github.com/Azure/azure-iot-sdk-csharp/releases/tag/lts_2020-8-19 |
@timtay-microsoft, @arabelaa, @abhipsaMisra, thank you for your contribution to our open-sourced project! Please help us improve by filling out this 2-minute customer satisfaction survey |
Context
Description of the issue
Exception is sometimes thrown when registering direct methods. This doesn't happen all the time. I am afraid something is wrong in a different thread causing the executing thread to release the semaphore twice. I can't reproduce the issue locally, unfortunately.
The text was updated successfully, but these errors were encountered: