Skip to content
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

Client only reconnecting after around 15 minutes #2130

Open
sabrogden opened this issue Dec 18, 2024 · 1 comment
Open

Client only reconnecting after around 15 minutes #2130

sabrogden opened this issue Dec 18, 2024 · 1 comment
Labels
bug Something isn't working

Comments

@sabrogden
Copy link

sabrogden commented Dec 18, 2024

We are having an issue with a MQTTnet client that only reconnects after thinking it's been disconnected for around 15 minutes. In reality, there was only a hiccup in the network when a network switch was turned off and the internet is routed through a backup switch. We have clients that reconnect normally but this one that doesn't reconnect does sent a lot of messages, one every few seconds, we feel like this is the difference.

We are on the latest nuget package 4.3.5.114 running on .net 6.

Connection options

.WithAutoReconnectDelay(5))
.WithMaxPendingMessages(25)
.WithMaxTopicFiltersInSubscribeUnsubscribePackets(8)
.WithPendingMessagesOverflowStrategy(MqttPendingMessagesOverflowStrategy.DropOldestQueuedMessage)

I have not been able to reproduce this locally, only at a site with real networks and multiple internet providers plugged into redundant switches.

Debug from the issue is attached at the end, You can see the disconnect doesn't happen until 14:43 even though there have been send errors going on since 14:29.

1. Issue starts at 12-18 14:29:56.427
2. 12-18 14:29:56.427 | IOTCore Publisher Trace >> ClientID, [2024-12-18T19:29:56.4267204Z] [42] [MqttChannelAdapter] [Verbose]: TX (2 bytes) >>> PingReq
3. 12-18 14:29:56.433 | IOTCore Publisher Trace >> ClientID, [2024-12-18T19:29:56.4290590Z] [18] [ManagedMqttClient] [Error]: Error while publishing application message (972efaa0-46d9-4fe6-92ca-72816572e15c).
4. These continue every few minutes
5. 12-18 14:38:18.529 | IOTCore Publisher Trace >> ClientID, [2024-12-18T19:38:18.5271939Z] [44] [ManagedMqttClient] [Error]: Error while publishing application message (4d6c96f4-4746-41b1-828c-36a63f1098fd).
12-18 14:38:18.530 | IOTCore Publisher Trace >> ClientID, [2024-12-18T19:38:18.5298989Z] [44] [MqttChannelAdapter] [Verbose]: TX (6735 bytes) >>> Publish: [ClientID=Topic/Heartbeat/] [PayloadLength=6611] [QoSLevel=AtMostOnce] [Dup=False] [Retain=False] [PacketIdentifier=0]
5. Keep alive stops
6. 12-18 14:30:11.654 | IOTCore Publisher Trace >> ClientID, [2024-12-18T19:30:11.6513841Z] [10] [MqttClient] [Warning]: Error when sending MqttPingReqPacket request packet
7. 12-18 14:30:11.658 | IOTCore Publisher Trace >> ClientID, [2024-12-18T19:30:11.6577326Z] [10] [MqttClient] [Verbose]: Stopped sending keep alive packets
8. Disconnect and reconnect happens
9. 12-18 14:43:39.204 | IOTCore Publisher Trace >> ClientID, [2024-12-18T19:43:39.2035323Z] [42] [MqttClient] [Verbose]: Disconnecting [Timeout=00:01:40]
10. 12-18 14:43:39.228 | IOTCore Publisher Trace >> ClientID, [2024-12-18T19:43:39.2275252Z] [42] [MqttClient] [Verbose]: Disconnected from adapter.
11. 12-18 14:43:39.228 | IOTCore Publisher Trace >> ClientID, [2024-12-18T19:43:39.2281017Z] [42] [MqttClient] [Info]: Disconnected.
12. 12-18 14:43:44.542 | IOTCore Publisher Trace >> ClientID, [2024-12-18T19:43:44.5424334Z] [42] [MqttClient] [Verbose]: Connection with server established

Around 15 minutes is consistent across multiple times of testing this, are there any default timeouts around this time?

iotcore-debug.txt

@sabrogden sabrogden added the bug Something isn't working label Dec 18, 2024
@sabrogden
Copy link
Author

Here is an example of it working normally from the same machine, without many publish messages. You can see the ping fail, disconnect, reconnect like you would expect.

Should normal publish messages failing cause a disconnect?

iotcore-working-debug.txt

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant