-
Notifications
You must be signed in to change notification settings - Fork 493
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
Awaiting device stream request inside of direct method handler #842
Comments
Today, I have tested it on IoTHub from S1 tier (previous error is from IoTHub from Free tier ). When using S1 instance I was able to wait for device stream request inside direct method handler. After I accepted the request and shut down the application I was not able to reconnect again to IoTHub instance from that device any more. I was constantly getting
Only solution was to delete device and recreate it. Afterwards, I set custom retry policy in order to catch following exception and stack trace. Exception message: StackTrace: In both hubs (S1 and F1) devices where authenticated with self-signed certificates. |
It looks like when MQTT protocol is used, if we even just have registered direct methods (we are not combining them with device streams workflow), and we try to wait for device stream request, after client connection is once closed, it cannot be established again with that same device. |
@Perun85 - Do you still need help on this? Can you give more details on the scenario? |
I haven't tried this in a while. We switched to solution where we use two IoT Hubs, one only for device streams and other for everything else. When device streams become GA, we plan to move everything again to just one IoT Hub and it would be great if this bug can be resolved by then. |
Moving all device streaming issues to this discussion #1811. |
Microsoft.Azure.Devices.Client 1.29.0-preview-002
Microsoft.Azure.Devices 1.27.0-preview-003
Description of the issue:
When trying to await for WaitForDeviceStreamRequestAsync() inside of direct method handler deviceClient gets disconnected.
We use the flow that involves direct methods, because we need to pass additional information (IP address, port, etc.).
Is it even possible to use it in this way?
Code sample exhibiting the issue:
Console log of the issue:
Microsoft.Azure.Devices.Client.Exceptions.IotHubCommunicationException: Transient network error occurred, please retry. ---> System.Net.Sockets.SocketException: An existing connection was forcibly closed by the remote host
at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at Microsoft.Azure.Devices.Client.Transport.Mqtt.MqttIotHubAdapter.d__49.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at Microsoft.Azure.Devices.Client.Transport.Mqtt.MqttIotHubAdapter.d__37.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at Microsoft.Azure.Devices.Client.Transport.Mqtt.MqttTransportHandler.d__82.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at Microsoft.Azure.Devices.Client.Transport.ErrorDelegatingHandler.<>c__DisplayClass27_0.<b__0>d.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at Microsoft.Azure.Devices.Client.Transport.ErrorDelegatingHandler.d__28
1.MoveNext() --- End of inner exception stack trace --- at Microsoft.Azure.Devices.Client.Transport.ErrorDelegatingHandler.<ExecuteWithErrorHandlingAsync>d__28
1.MoveNext()--- End of stack trace from previous location where exception was thrown ---
at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
at Microsoft.Azure.Devices.Client.Transport.RetryDelegatingHandler.<>c__DisplayClass23_0.<b__0>d.MoveNext()
The text was updated successfully, but these errors were encountered: