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

MQTT Client Disconnecting Every Minute - UDP Sync? (GIT8266O-409) #838

Open
pirlite2 opened this issue Mar 3, 2020 · 0 comments
Open

MQTT Client Disconnecting Every Minute - UDP Sync? (GIT8266O-409) #838

pirlite2 opened this issue Mar 3, 2020 · 0 comments

Comments

@pirlite2
Copy link

pirlite2 commented Mar 3, 2020

Using the latest pulled version.

I have an MQTT client working fine adapted from an example program; I can subscribe and publish even at QoS2. Except the client disconnects around every minute (e.g. 134 disconnections/reconnections in a timed 137 minute period). The log output for a cycle between connections is shown below (the "MQTT connected" and "MQTT subscribed" messages are mine):

...
MQTT connected
D (8783553) MQTT_CLIENT: msg_type=5, msg_id=8349
D (8783559) MQTT_CLIENT: received MQTT_MSG_TYPE_PUBREC
D (8783571) MQTT_CLIENT: msg_type=9, msg_id=45734
D (8783575) MQTT_CLIENT: pending_id=45734, pending_msg_count = 2
D (8783582) MQTT_CLIENT: Subscribe successful
MQTT subscribed
D (8783591) MQTT_CLIENT: msg_type=7, msg_id=8349
D (8783597) MQTT_CLIENT: received MQTT_MSG_TYPE_PUBCOMP
D (8783605) MQTT_CLIENT: pending_id=45734, pending_msg_count = 1
D (8783614) OUTBOX: DELETED msgid=8349, msg_type=3, remain size=0
D (8783623) MQTT_CLIENT: Receive MQTT_MSG_TYPE_PUBCOMP, finish QoS2 publish
MQTT published
D (8813650) MQTT_CLIENT: Sent PING successful
D (8813655) MQTT_CLIENT: PING sent
D (8813658) MQTT_CLIENT: msg_type=13, msg_id=0
D (8813662) MQTT_CLIENT: MQTT_MSG_TYPE_PINGRESP
D (8828435) udp_sync: UDP sync cache udp 0x40108048
D (8828441) udp_sync: UDP sync clear udp 0x40108048
D (8828447) udp_sync: UDP sync cache udp 0x40108048
D (8828452) udp_sync: UDP sync clear udp 0x40108048
D (8828457) udp_sync: UDP sync cache udp 0x40108048
D (8828462) udp_sync: UDP sync clear udp 0x40108048
D (8828468) udp_sync: UDP sync cache udp 0x40108048
D (8828473) udp_sync: UDP sync clear udp 0x40108048
E (8828481) TRANS_TCP: tcp_poll_read select error 113, errno = Software caused connection abort, fd = 0
E (8828495) MQTT_CLIENT: Read error or end of stream
I (8828504) MQTT_CLIENT: Reconnect after 10000 ms
MQTT disconnected
D (8838511) MQTT_CLIENT: Reconnecting...
D (8843514) TRANS_TCP: [sock=0],connecting to server IP:172.16.0.1,Port:1883...
D (8843530) MQTT_CLIENT: Transport connected to mqtt://172.16.0.1:1883
I (8843536) MQTT_CLIENT: Sending MQTT CONNECT message, type: 1, id: 0000
D (8843552) MQTT_CLIENT: Connected
D (8843555) MQTT_CLIENT: mqtt_enqueue id: 0, type=1 successful
D (8843561) MQTT_CLIENT: mqtt_enqueue id: 46230, type=3 successful
D (8843568) OUTBOX: ENQUEUE msgid=46230, msg_type=3, len=46, size=46
D (8843575) MQTT_CLIENT: Sent subscribe topic=trv, id: 26140, type=8 successful
I (8843585) simple wifi: sent subscribe successfully to trv
MQTT connected
...

The actual disconnect seems to occur with:

TRANS_TCP: tcp_poll_read select error 113, errno = Software caused connection abort, fd = 0

which I am interpreting as a socket error; the fd (file descriptor?) value of zero looks suspicious.

Now it may be coincidence, but every disconnect seems to be preceded by a series of udp_sync messages, which puzzles me as I cannot see where I am using UDP. In fact, investigating the the udp_sync_cache and udp_sync_clear functions, I can see an if-statement that skips the udp-sync operation if the sys_current_task_is_tcpip function returns true, which would seem reasonable, but is not happening. I cannot find the sys_current_task_is_tcpip function.

The reconnections all require a single attempt apart from the second which always needs 9 reconnection attempts - puzzling.

Any suggestions/guidance oh this? In particular, the UDP sync stuff looks very odd.

Peter

@github-actions github-actions bot changed the title MQTT Client Disconnecting Every Minute - UDP Sync? MQTT Client Disconnecting Every Minute - UDP Sync? (GIT8266O-409) Mar 3, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant