wolfMQTT icon indicating copy to clipboard operation
wolfMQTT copied to clipboard

WMQTT_NET_GLUE Error: Skt Timeout, occurred in func: WMQTT_NETGlue_DoRead, line: 522

Open Elpra-Bozas opened this issue 3 years ago • 4 comments
trafficstars

Hello,

We are seeing the following error and trying to understand where it is coming from. Could you please elaborate as to when the "WMQTT_NET_GLUE Error: Skt Timeout, occurred in func: WMQTT_NETGlue_DoRead, line: 522" will be given by wolfMQTT? The connection is good and stable, the system we are working on is a Microchip Harmony 3 PIC32MZ client along with PC/Server based Broker.

17:49:42.322 -> WMQTT_NET_GLUE Info: Started Connect 17:49:43.303 -> WMQTT_NET_GLUE Info: Connected Successfully 17:49:43.303 -> MQTT Task - run message: MqttClient_NetConnect, res: 0 17:49:43.303 -> MQTT Task - run message: MqttClient_Connect, res: 0 17:49:43.303 -> MQTT Task - Connect Ack: Return Code 0, Session Present No 17:49:45.358 -> MQTT Task - Subscribed Topic l9/0491625DA6C8/cmd/#, Qos 1 17:49:45.358 -> MQTT Task - Subscribed Topic l9/0491625DA6C8/cfg/#, Qos 1 17:49:48.381 -> MQTT Task - run message: MqttClient_Publish, res: 0 17:49:48.381 -> MQTT Task - Published Topic: l9/0491625DA6C8/sts/png 17:49:51.406 -> WMQTT_NET_GLUE Error: Skt Timeout, occurred in func: WMQTT_NETGlue_DoRead, line: 522, 17:49:51.406 -> MQTT Task - Client: 625DA6C87E345697, Disconnect error: -7 17:49:51.406 -> MQTT Task - run message: MqttClient_WaitMessage error, res: -7 17:49:51.406 -> MQTT Task - MQTT cycle Failed in state: 2, error code: -7! 17:49:51.406 -> MQTT Task - Client Start: QoS 1, broker 192.168.0.214 17:49:51.406 -> MQTT Task - run message: WMQTT_NETGlue_Initialize, res: 0 17:49:51.406 -> MQTT Task - run message: MqttClient_Init, res: 0 17:49:51.406 -> MQTT Task - run message: MqttClient_SetDisconnectCallback, res: 0 17:49:51.406 -> WMQTT_NET_GLUE Info: Started Connect 17:49:51.406 -> WMQTT_NET_GLUE Info: Connected Successfully 17:49:51.406 -> MQTT Task - run message: MqttClient_NetConnect, res: 0 17:49:51.406 -> MQTT Task - run message: MqttClient_Connect, res: 0 17:49:51.406 -> MQTT Task - Connect Ack: Return Code 0, Session Present Yes 17:49:55.357 -> MQTT Task - Subscribed Topic l9/0491625DA6C8/cmd/#, Qos 1 17:49:55.357 -> MQTT Task - Subscribed Topic l9/0491625DA6C8/cfg/#, Qos 1 17:50:00.339 -> MQTT Task - run message: MqttClient_Publish, res: 0 17:50:00.385 -> MQTT Task - Published Topic: l9/0491625DA6C8/sts/png 17:50:03.423 -> WMQTT_NET_GLUE Error: Skt Timeout, occurred in func: WMQTT_NETGlue_DoRead, line: 522, ...

Elpra-Bozas avatar Apr 27 '22 14:04 Elpra-Bozas

Hi @Elpra-Bozas

The WMQTT_NET_GLUE layer was developed by Microchip to plug into the wolfMQTT network abstraction. It looks like the publish is failing, which could cause the broker to drop the client connection. It also could have been caused by the previous subscribe (the subscribe ack is either not happening or not being printed in the log).

embhorn avatar Apr 27 '22 15:04 embhorn

Hi embhorn,

it proves that this read socket timeout error is triggered when after subscribing or publishing, we stay in a state calling MqttClient_WaitMessage function (with a timeout of 30 seconds). This read socket timeout remains for a couple of minutes and then everything works smoothly.

If we omit this transition to the WAIT_FOR_MSG state where we call the wait message interface function and sustain our publishes, then we don't see anything wrong.

Is there a limitation on this state machine transition?

Elpra-Bozas avatar Apr 27 '22 17:04 Elpra-Bozas

You should call "wait message" when you wish for the application to receive an incoming publish message from the broker: https://github.com/wolfSSL/wolfMQTT/blob/8c3cd09326fe8ef502f408bdf3b958d59332b184/examples/nbclient/nbclient.c#L467

If it times out, you should call again, or possibly send a ping if the keep alive would expire.

embhorn avatar Apr 27 '22 17:04 embhorn

Hi @Elpra-Bozas

Are there any further questions? Can I mark this issue as resolved?

embhorn avatar May 02 '22 19:05 embhorn

Since we never heard back, I'll close this issue. Please feel free to reopen with more details or send an email to [email protected]

embhorn avatar Aug 23 '22 12:08 embhorn