Azure / azure-iot-sdk-csharp

A C# SDK for connecting devices to Microsoft Azure IoT services
Other
464 stars 493 forks source link

Connecting to IOT hub / throws errors #3357

Open codeputer opened 1 year ago

codeputer commented 1 year ago

This log shows the startup of a Raspberry Pi 2W running IOT Edge software. I will have several hundred of these, and I can't figure out why this happens occassionally. Is there something I can do to make it more reliable, and/or slow down the retries?

GFSConnectDeployedLogs_Dev007_20230803.txt

timtay-microsoft commented 11 months ago

Frequent connected -> retrying -> disconnected -> connected patterns usually indicate that you are accidentally using the same device/module Id in multiple client simultaneously. IoT hub only allows each device/module identity to have one active connection to the service/IoT edge. If it detects a new connection with the same credentials as an existing connection, it will disconnect the older connection and accept the new connection. With any sort of retry policy in place, this often leads to two clients fighting over the same connection.

Can you check to see if this might be what is happening to your devices?

codeputer commented 11 months ago

I will check, and it's possible, but I believe "jitter" occurs across a number of devices that are active.

I will need to check multiple logs, as well as validate and ensure all devices have unique names.

As I use Azure deployment service, this should not happen. Is it possible to detect connections using different ip addresses but the same connection credentials?

R

Get Outlook for Androidhttps://aka.ms/AAb9ysg


From: Tim Taylor @.> Sent: Tuesday, October 17, 2023 6:09:24 PM To: Azure/azure-iot-sdk-csharp @.> Cc: Richard Reukema @.>; Author @.> Subject: Re: [Azure/azure-iot-sdk-csharp] Connecting to IOT hub / throws errors (Issue #3357)

Frequent connected -> retrying -> disconnected -> connected patterns usually indicate that you are accidentally using the same device/module Id in multiple client simultaneously. IoT hub only allows each device/module identity to have one active connection to the service/IoT edge. If it detects a new connection with the same credentials as an existing connection, it will disconnect the older connection and accept the new connection. With any sort of retry policy in place, this often leads to two clients fighting over the same connection.

Can you check to see if this might be what is happening to your devices?

— Reply to this email directly, view it on GitHubhttps://github.com/Azure/azure-iot-sdk-csharp/issues/3357#issuecomment-1767438577, or unsubscribehttps://github.com/notifications/unsubscribe-auth/AAEVJVKOEX6UOR2LCIGK5ITX74T4HAVCNFSM6AAAAAA3ESMXS2VHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMYTONRXGQZTQNJXG4. You are receiving this because you authored the thread.Message ID: @.***>