paho.mqtt.c icon indicating copy to clipboard operation
paho.mqtt.c copied to clipboard

MQTTAsync_connectionLost not triggered if PINGRESP not received in keepalive interval

Open zlm919 opened this issue 6 months ago • 1 comments

Describe the bug MQTTAsync_connectionLost not triggered if PINGRESP not received in keepalive interval

To Reproduce

  1. set keepAliveInterval 5( To ensure that step 5 occurs before isReady:361(1) )
  2. MQTTAsync client is connected server.
  3. pulled out the LAN uplink cable
  4. SEND PINGREQ
  5. PINGRESP not received in keepalive interval
  6. after servral minutes, the connlost callback is still not being called

Expected behavior Trigger MQTTAsync_connectionLost.

Log files trace.log

20240809 105722.099 (3064745284) (1)> MQTTAsync_cycle:2989 20240809 105722.099 (3064745284) (2)> Socket_getReadySocket:491 20240809 105722.099 (3064745284) (3)> Socket_continueWrites:1369 20240809 105722.099 (3064745284) (3)< Socket_continueWrites:1420 (0) 20240809 105722.099 (3064835396) (1)< Thread_wait_cond:467 (110) 20240809 105722.099 (3064835396) (1)> MQTTAsync_checkTimeouts:1689 20240809 105722.099 (3064835396) (1)< MQTTAsync_checkTimeouts:1777 20240809 105722.099 (3064835396) (1)> Thread_wait_cond:441 20240809 105722.099 (3064745284) (3)> isReady:349 20240809 105722.099 (3064745284) (3)< isReady:361 (0) 20240809 105723.229 (3064745284) (2)< Socket_getReadySocket:577 (0) 20240809 105723.229 (3064745284) (2)> MQTTAsync_sleep:105 20240809 105723.229 (3064745284) (2)< MQTTAsync_sleep:111 20240809 105723.229 (3064745284) (2)> MQTTAsync_retry:2759 20240809 105723.229 (3064745284) (3)> MQTTProtocol_keepalive:704 20240809 105723.229 PINGRESP not received in keepalive interval for client 123231412512513124_5 on socket 8, disconnecting 20240809 105723.229 (3064745284) (4)> MQTTAsync_closeSession:2408 20240809 105723.229 (3064745284) (5)> MQTTAsync_closeOnly:2377 20240809 105723.229 (3064745284) (6)> MQTTProtocol_checkPendingWrites:996 20240809 105723.229 (3064745284) (6)< MQTTProtocol_checkPendingWrites:1013 20240809 105723.229 (3064745284) (6)> MQTTPacket_send_disconnect:516 20240809 105723.229 (3064745284) (7)> MQTTPacket_send:201 20240809 105723.229 (3064745284) (8)> MQTTPacket_encode:304 20240809 105723.229 (3064745284) (8)< MQTTPacket_encode:317 (1) 20240809 105723.229 (3064745284) (8)> MQTTPacket_encode:304 20240809 105723.229 (3064745284) (8)< MQTTPacket_encode:317 (1) 20240809 105723.229 (3064745284) (8)> WebSocket_putdatas:944 20240809 105723.229 (3064745284) (9)> Socket_putdatas:770 20240809 105723.229 (3064745284) (10)> Socket_writev:694 20240809 105723.229 (3064745284) (10)< Socket_writev:746 (2) 20240809 105723.370 (3064745284) (9)< Socket_putdatas:825 (0) 20240809 105723.370 (3064745284) (8)< WebSocket_putdatas:975 (0) 20240809 105723.370 (3064745284) (7)< MQTTPacket_send:236 (0) 20240809 105723.370 8 123231412512513124_5 -> DISCONNECT (0) 20240809 105723.370 (3064745284) (6)< MQTTPacket_send_disconnect:543 (0) 20240809 105723.370 (3064745284) (6)> WebSocket_close:524 20240809 105723.370 (3064745284) (6)< WebSocket_close:572 20240809 105723.370 (3064745284) (6)> SSLSocket_close:947 20240809 105723.370 (3064745284) (7)> SSLSocket_destroyContext:934 20240809 105723.370 (3064745284) (7)< SSLSocket_destroyContext:938 20240809 105723.370 (3064745284) (6)< SSLSocket_close:960 (1) 20240809 105723.370 (3064745284) (6)> Socket_close:940 20240809 105723.370 (3064745284) (7)> Socket_close_only:866 20240809 105723.370 (3064745284) (7)< Socket_close_only:880 (0) 20240809 105723.370 (3064745284) (7)> Socket_abortWrite:1322 20240809 105723.370 (3064745284) (7)< Socket_abortWrite:1343 (0) 20240809 105723.370 (3064745284) (7)> SocketBuffer_cleanup:153 20240809 105723.370 (3064745284) (7)< SocketBuffer_cleanup:165 20240809 105723.370 Removed socket 8 20240809 105723.370 Removed socket 8 20240809 105723.415 (3064745284) (6)< Socket_close:1008 (0) 20240809 105723.415 (3064745284) (5)< MQTTAsync_closeOnly:2402 20240809 105723.415 (3064745284) (4)< MQTTAsync_closeSession:2415 20240809 105723.415 (3064745284) (3)< MQTTProtocol_keepalive:757 20240809 105723.415 (3064745284) (3)> MQTTProtocol_retry:881 20240809 105723.415 (3064745284) (3)< MQTTProtocol_retry:900 20240809 105723.415 (3064745284) (2)< MQTTAsync_retry:2769 20240809 105723.415 (3064745284) (1)< MQTTAsync_cycle:3153 (0) 20240809 105723.415 (3064745284) (1)> MQTTAsync_cycle:2989 20240809 105723.415 (3064745284) (2)> Socket_getReadySocket:491 20240809 105723.415 (3064745284) (2)< Socket_getReadySocket:577 (0) 20240809 105723.415 (3064745284) (2)> MQTTAsync_sleep:105 20240809 105723.415 (3064745284) (2)< MQTTAsync_sleep:111 20240809 105723.415 (3064745284) (2)> MQTTAsync_retry:2759 20240809 105723.415 (3064745284) (3)> MQTTProtocol_retry:881 20240809 105723.415 (3064745284) (3)< MQTTProtocol_retry:900 20240809 105723.415 (3064745284) (2)< MQTTAsync_retry:2769 20240809 105723.415 (3064745284) (1)< MQTTAsync_cycle:3153 (0)

** Environment (please complete the following information):**

  • OS: [Openwrt Linux 4.9.63]
  • Version [1.3.11]

Additional context

zlm919 avatar Aug 09 '24 03:08 zlm919