Closed Maci3jPy closed 12 months ago
edgeHub is not expected to immediately send messages upstream upon connection restoration. While offline, it periodically retries to send messages, so it is expected that there is some delay between regaining connectivity and messages being sent upstream. Do you eventually see messages being sent upstream?
Hi, no unfortunately the edgeHub is stuck in this mode forever. It only start sending them when I restart it. It can be stuck like this for multiple days.
Hi, I was trying to downgrade edgeAgent and edgeHub and it looks like on 1.4.14 the problem still occurs but in 1.4.09 edge works as intended - it handles the disconnection and send message upstream normally after coming back to online state.
Ok, thanks for the update. The only major changes between 1.4.9 and 1.4.14 that might affect message forwarding are .NET SDK updates. We will investigate this. Could you also try the latest version of edgeAgent and edgeHub (1.4.23)?
Please reopen this if you are able to repro with the latest version of edgeAgent/edgeHub. Closing issue.
Hi, I am able to reproduce it on 1.4.24. The issue still is there. The Edge lost connection for 20 minutes, turn back online and after that stopped pushing messages to upstream - restart of edgeHub was needed to get it to work back.
@gordonwang0 Could you please re-open the issue?
I investigated this further and was not able to reproduce it. My repro steps were:
az iot hub monitor-events
and see the messages generated by SimulatedTemperatureSensorI tried this several times, and was able to see all messages received, even ones generated while the device was offline. Sometimes it takes a few minutes for messages to reappear, but I am not able to repro a scenario where messages don't appear. Could you try these steps above and let me know if you repro this issue?
Expected Behavior
IoT Edge after restoring the connection to Internet should push all cached messages and send them upstream and send all new messages live to upstream.
Current Behavior
Edge after entering disconnected state and then when going back to connected state (after internet connection is restored) keeps caching messages and is not pushing them upstream. After restarting the edgeHub edge pushes all cached messages and operates normally but the restart is required.
Steps to Reproduce
Context (Environment)
Device Information
Runtime Versions
Logs
edge-agent logs
``` <6> 2023-09-26 06:11:39.251 +00:00 [INF] - Starting compaction of stores <6> 2023-09-26 06:11:39.251 +00:00 [INF] - Starting compaction of store moduleState <6> 2023-09-26 06:11:39.251 +00:00 [INF] - Starting compaction of store default <6> 2023-09-26 06:11:39.251 +00:00 [INF] - Starting compaction of store deploymentConfig <6> 2023-09-26 06:12:30.893 +00:00 [INF] - Starting periodic operation refresh twin config... <6> 2023-09-26 06:12:30.955 +00:00 [INF] - Obtained Edge agent twin from IoTHub with desired properties version 71 and reported properties version 248. <6> 2023-09-26 06:12:30.957 +00:00 [INF] - Successfully completed periodic operation refresh twin config <6> 2023-09-26 07:12:30.955 +00:00 [INF] - Starting periodic operation refresh twin config... <6> 2023-09-26 07:12:31.006 +00:00 [INF] - Obtained Edge agent twin from IoTHub with desired properties version 71 and reported properties version 248. <6> 2023-09-26 07:12:31.007 +00:00 [INF] - Successfully completed periodic operation refresh twin config <6> 2023-09-26 07:16:35.065 +00:00 [INF] - Obtained Edge agent twin from IoTHub with desired properties version 71 and reported properties version 248. <6> 2023-09-26 07:18:13.065 +00:00 [INF] - Obtained Edge agent twin from IoTHub with desired properties version 71 and reported properties version 248. <6> 2023-09-26 08:11:39.252 +00:00 [INF] - Starting compaction of stores <6> 2023-09-26 08:11:39.252 +00:00 [INF] - Starting compaction of store moduleState <6> 2023-09-26 08:11:39.252 +00:00 [INF] - Starting compaction of store default <6> 2023-09-26 08:11:39.252 +00:00 [INF] - Starting compaction of store deploymentConfig <6> 2023-09-26 08:12:31.006 +00:00 [INF] - Starting periodic operation refresh twin config... <6> 2023-09-26 08:12:31.033 +00:00 [INF] - Obtained Edge agent twin from IoTHub with desired properties version 71 and reported properties version 248. <6> 2023-09-26 08:12:31.035 +00:00 [INF] - Successfully completed periodic operation refresh twin config ```edge-hub logs
``` <6> 2023-09-26 07:07:11.285 +00:00 [INF] - Transport closed. CorrelationId 1336c232 <6> 2023-09-26 07:07:11.291 +00:00 [INF] - "Request finished HTTP/1.1 GET https://edge_ip/$iothub/websocket - - - 101 - - 3899813.5647ms" <6> 2023-09-26 07:07:11.298 +00:00 [INF] - Closing device proxy for device Id edge_name/edgeblob <6> 2023-09-26 07:07:11.318 +00:00 [INF] - Closing receiver in cloud proxy 6b099344-32fc-4bfd-a18f-a9aff6c72a24 for edge_name/edgeblob <6> 2023-09-26 07:07:11.319 +00:00 [INF] - Closed cloud proxy 6b099344-32fc-4bfd-a18f-a9aff6c72a24 for edge_name/edgeblob <6> 2023-09-26 07:07:11.319 +00:00 [INF] - Device connection removed for device edge_name/edgeblob <6> 2023-09-26 07:07:11.493 +00:00 [INF] - "Request starting HTTP/1.1 GET https://edge_ip/$iothub/websocket - -" <6> 2023-09-26 07:07:11.493 +00:00 [INF] - Processed MQTT WebSocket request with CorrelationId 7b7d24a8-85fc-47d3-b007-06e84d8a9904 <6> 2023-09-26 07:07:11.639 +00:00 [INF] - Updated reported properties for edge_name/$edgeHub <6> 2023-09-26 07:07:11.754 +00:00 [INF] - Client edge_name/edgeblob in device scope authenticated locally. <6> 2023-09-26 07:07:11.754 +00:00 [INF] - Successfully generated identity for clientId edge_name/edgeblob and username edge_ip/edge_name/edgeblob/?api-version=2018-06-30&DeviceClientType=.NET%2F1.20.3%20%28.NET%20Core%203.1.21%3B%20Linux%205.4.0-128-generic%20%23144-Ubuntu%20SMP%20Tue%20Sep%2020%2011%3A00%3A04%20UTC%202022%3B%20X64%29%20iot-edge-blob-storage%2F1.4.1.0%20%28UploadOff%29 <6> 2023-09-26 07:07:11.754 +00:00 [INF] - "ClientAuthenticated, edge_name/edgeblob, 5057ed06" <6> 2023-09-26 07:07:11.754 +00:00 [INF] - New device connection for device edge_name/edgeblob <6> 2023-09-26 07:07:11.754 +00:00 [INF] - Client edge_name/edgeblob connected to edgeHub, processing existing subscriptions. <6> 2023-09-26 07:07:11.755 +00:00 [INF] - Bind device proxy for device edge_name/edgeblob <6> 2023-09-26 07:07:11.755 +00:00 [INF] - Binding message channel for device Id edge_name/edgeblob <6> 2023-09-26 07:07:11.756 +00:00 [INF] - Attempting to connect to IoT Hub for client edge_name/edgeblob via AMQP... <6> 2023-09-26 07:07:11.758 +00:00 [INF] - Processing pending subscriptions for edge_name/edgeblob <6> 2023-09-26 07:07:11.760 +00:00 [INF] - Processing subscriptions TwinResponse, DesiredPropertyUpdates for client edge_name/edgeblob. <6> 2023-09-26 07:07:11.762 +00:00 [INF] - Set subscriptions from session state for edge_name/edgeblob <6> 2023-09-26 07:07:11.765 +00:00 [INF] - Processing subscriptions TwinResponse, DesiredPropertyUpdates for client edge_name/edgeblob. <6> 2023-09-26 07:07:11.765 +00:00 [INF] - Set subscriptions from session state for edge_name/edgeblob <6> 2023-09-26 07:07:11.829 +00:00 [INF] - Cloud connection for edge_name/edgeblob is True <6> 2023-09-26 07:07:11.829 +00:00 [INF] - Connection status for edge_name/edgeblob changed to ConnectionEstablished <6> 2023-09-26 07:07:11.829 +00:00 [INF] - Client edge_name/edgeblob connected to cloud, processing existing subscriptions. <6> 2023-09-26 07:07:11.829 +00:00 [INF] - Skipping edge_name/edgeblob for subscription processing, as it is currently being processed. <6> 2023-09-26 07:07:11.829 +00:00 [INF] - Created cloud proxy for client edge_name/edgeblob via AMQP, with client operation timeout 20 seconds. <6> 2023-09-26 07:07:11.829 +00:00 [INF] - Initialized cloud proxy 4feae539-8b36-4856-9034-49fe3585dd29 for edge_name/edgeblob <6> 2023-09-26 07:07:11.829 +00:00 [INF] - Created cloud connection for client edge_name/edgeblob <6> 2023-09-26 07:07:11.854 +00:00 [INF] - Processing pending subscriptions for edge_name/edgeblob <6> 2023-09-26 07:07:11.855 +00:00 [INF] - Processing pending subscriptions for edge_name/edgeblob <6> 2023-09-26 07:07:11.855 +00:00 [INF] - Processing pending subscriptions for edge_name/edgeblob <6> 2023-09-26 07:07:16.874 +00:00 [INF] - Updated reported properties for edge_name/$edgeHub <6> 2023-09-26 07:12:11.259 +00:00 [INF] - Entering periodic task to reauthenticate connected clients <6> 2023-09-26 07:14:24.701 +00:00 [INF] - Starting periodic operation Get EdgeHub config... <6> 2023-09-26 07:14:37.370 +00:00 [INF] - Started task to cleanup processed and stale messages for endpoint iothub <6> 2023-09-26 07:14:37.403 +00:00 [INF] - Cleaned up 71 messages from queue for endpoint iothub and 71 messages from message store. <6> 2023-09-26 07:14:37.403 +00:00 [INF] - Started task to cleanup processed and stale messages for endpoint edge_name/customemodule6/SensorStatus <6> 2023-09-26 07:14:37.405 +00:00 [INF] - Cleaned up 0 messages from queue for endpoint edge_name/customemodule6/SensorStatus and 0 messages from message store. <6> 2023-09-26 07:14:37.405 +00:00 [INF] - Started task to cleanup processed and stale messages for endpoint edge_name/customemodule1/SensorMsg <6> 2023-09-26 07:14:37.825 +00:00 [INF] - Cleaned up 3226 messages from queue for endpoint edge_name/customemodule1/SensorMsg and 1 messages from message store. <6> 2023-09-26 07:14:37.825 +00:00 [INF] - Started task to cleanup processed and stale messages for endpoint edge_name/edgeSpotterLogger/Spotter <6> 2023-09-26 07:14:38.264 +00:00 [INF] - Cleaned up 3226 messages from queue for endpoint edge_name/edgeSpotterLogger/Spotter and 3225 messages from message store. <6> 2023-09-26 07:14:38.264 +00:00 [INF] - Started task to cleanup processed and stale messages for endpoint edge_name/customemodule3/HandlerData <6> 2023-09-26 07:14:38.264 +00:00 [INF] - Cleaned up 0 messages from queue for endpoint edge_name/customemodule3/HandlerData and 0 messages from message store. <6> 2023-09-26 07:14:38.264 +00:00 [INF] - Started task to cleanup processed and stale messages for endpoint edge_name/customemodule2/SensorData <6> 2023-09-26 07:14:38.582 +00:00 [INF] - Cleaned up 2837 messages from queue for endpoint edge_name/customemodule2/SensorData and 2 messages from message store. <6> 2023-09-26 07:14:38.582 +00:00 [INF] - Started task to cleanup processed and stale messages for endpoint edge_name/customemodule4/stoppage <6> 2023-09-26 07:14:38.584 +00:00 [INF] - Cleaned up 13 messages from queue for endpoint edge_name/customemodule4/stoppage and 13 messages from message store. <6> 2023-09-26 07:14:38.584 +00:00 [INF] - Started task to cleanup processed and stale messages for endpoint edge_name/customemodule3/SensorData <6> 2023-09-26 07:14:38.923 +00:00 [INF] - Cleaned up 2835 messages from queue for endpoint edge_name/customemodule3/SensorData and 2835 messages from message store. <6> 2023-09-26 07:14:44.701 +00:00 [INF] - Exiting connected state <6> 2023-09-26 07:14:44.701 +00:00 [INF] - Entering unreachable state <4> 2023-09-26 07:14:44.703 +00:00 [WRN] - Error getting twin for edge_name/$edgeHub System.TimeoutException: The operation timed out. ---> Microsoft.Azure.Devices.Client.Exceptions.IotHubCommunicationException: Transient network error occurred, please retry. ---> System.TimeoutException: The operation has timed out. at Microsoft.Azure.Devices.Client.Transport.Amqp.AmqpTransportHandler.RoundTripTwinMessageAsync(AmqpTwinMessageType amqpTwinMessageType, TwinCollection reportedProperties, CancellationToken cancellationToken) at Microsoft.Azure.Devices.Client.Transport.Amqp.AmqpTransportHandler.SendTwinGetAsync(CancellationToken cancellationToken) at Microsoft.Azure.Devices.Client.Transport.ErrorDelegatingHandler.ExecuteWithErrorHandlingAsync[T](Func`1 asyncOperation) --- End of inner exception stack trace --- at Microsoft.Azure.Devices.Client.Transport.ErrorDelegatingHandler.ExecuteWithErrorHandlingAsync[T](Func`1 asyncOperation) at Microsoft.Azure.Devices.Client.Transport.RetryDelegatingHandler.<>c__DisplayClass35_0.<Additional Information
I think this is not happening always. Looks like sometimes Edge is comming bug to normal state after disconnecting. It's a quite dangerous bug because as per the IoT Hub and everything Edge is connected but it is not sending any messages forward to upstream. In the logs disconnection happened at around 07:00.