qapi_Net_MQTT_Connect stuck with parameter clean_session=false

Hi All,

I try to run the quectel example ‘mqtt’ application on my BG96 device.
I modify the mqtt parameter to use ‘mqtt.eclipse.org’ and setup clean_session flag to false.

And I found that,

  1. When I run the app first time, everything goes fine (mqtt connect, publish, subscribe, disconnect …)
  2. Then I reset the device
  3. The app stuck in qapi_Net_MQTT_Connect() function

To solve the stuck situation, I need to change the clean_session back to true, or modify the client_id and run the app again.

Full Log:
[11:25:22:930]
[11:25:28:681] MQTT Task Start…␊
[11:25:28:713] ~ qapi_Device_Info_Init OK [0][dev_info] status, status 0␊
[11:25:28:729] [dev_info] qapi_Device_Info_Set_Callback, status 0␊
[11:25:31:174] ~ mqtt_network_indication_cb OK [29]␊
[11:25:31:174] ~type[b] id[29] status[0]␊
[11:25:31:190] NW SIGNAL EVENT IS [1]␊
[11:25:31:206] waiting for network enabled…␊
[11:25:32:052] ~ mqtt_network_indication_cb OK [29]␊
[11:25:32:052] ~type[b] id[29] status[0]␊
[11:25:32:052] ~ mqtt_network_indication_cb OK [29]␊
[11:25:32:052] NW SIGNAL EVENT IS [1]␊
[11:25:32:068] ~type[b] id[29] status[0]␊
[11:25:32:068] waiting for network enabled…␊
[11:25:32:148] ~ mqtt_network_indication_cb OK [29]␊
[11:25:32:148] ~type[b] id[29] status[1]␊
[11:25:32:163] NW SIGNAL EVENT IS [2]␊
[11:25:32:180] network enabled!␊
[11:25:32:180] Initializes the DSS netctrl library␊
[11:25:32:195] DSS netctrl library has been initialized.␊
[11:25:32:226] Registering Callback tcp_dss_handle␊
[11:25:32:226] tcp_dss_handle 867093368, status 0␊
[11:25:32:226] Registed tcp_dss_handler success␊
[11:25:32:242] Setting tech to Automatic␊
[11:25:32:242] Setting APN - internet.iot␊
[11:25:32:259] Setting family to IPv4␊
[11:25:32:275] qapi_DSS_Start_Data_Call start!!!.␊
[11:25:32:306] Start Data service success.␊
[11:25:32:322] Data test event callback, event: 1␊
[11:25:32:322] Data Call Connected.␊
[11:25:32:339] <— static IP address information —>␊
[11:25:32:354] static IP: 10.161.232.245␊
[11:25:32:354] Gateway IP: 10.161.232.246␊
[11:25:32:370] Primary DNS IP: 168.95.1.1␊
[11:25:32:386] Second DNS IP: 168.95.192.1␊
[11:25:32:386] <— End of system info —>␊
[11:25:32:402] SIGNAL EVENT IS [4]␊
[11:25:32:418] DSS_SIG_EVT_CONN_E Signal␊
[11:25:32:418] conn_mqtt entry␊
[11:25:32:434] @@@j = 1␊
[11:25:32:450] Primary DNS IP: 168.95.1.1␊
[11:25:32:450] Second DNS IP: 168.95.192.1␊
[11:25:32:466] Start DNSc…device_name: rmnet_data0␊
[11:25:32:496] hostname: mqtt.eclipse.org is resoling in interface: rmnet_data0␊
[11:25:32:960] reshost ret: 0␊
[11:25:32:989] ␊
[11:25:32:989] mqtt.eclipse.org --> 137.135.83.217␊
[11:25:32:989] client_len=8, client_str=22345678␊
[11:25:32:989] mqtt_cli_connect entry␊
[11:25:33:004] Mqtt Context created success, ctx=0x8097a90c␊
[11:25:33:004] Connecting…␊
[11:25:33:532] MQTT Connected, reason code=0␊
[11:25:33:532] MQTT Connect Successfull␊
[11:25:33:548] subscribing…␊
[11:25:33:548] Subscribe Successfull␊
[11:25:33:564] Published trying…␊
[11:25:33:580] Published Successfull␊
[11:25:34:539] Subscribe granted, topic=hello_topic, qos=1␊
[11:25:35:561] Publish Callback type PUBACK, QOS 1 msg Id 28625␊
[11:25:36:575] Message Callback: qos=1, topic=hello_topic, msg=pub test: hello␊
[11:25:41:593] Disconnecting…␊
[11:25:41:593] Disconnect Successfull␊
[11:25:56:791]
[11:26:00:765]
[11:26:06:517] MQTT Task Start…␊
[11:26:06:548] ~ qapi_Device_Info_Init OK [0][dev_info] status, status 0␊
[11:26:06:564] [dev_info] qapi_Device_Info_Set_Callback, status 0␊
[11:26:08:609] ~ mqtt_network_indication_cb OK [29]␊
[11:26:08:626] ~type[b] id[29] status[0]␊
[11:26:08:626] NW SIGNAL EVENT IS [1]␊
[11:26:08:641] waiting for network enabled…␊
[11:26:09:536] ~ mqtt_network_indication_cb OK [29]␊
[11:26:09:552] ~type[b] id[29] status[0]␊
[11:26:09:552] ~ mqtt_network_indication_cb OK [29]␊
[11:26:09:589] NW SIGNAL EVENT IS [1]␊
[11:26:09:589] ~type[b] id[29] status[0]␊
[11:26:09:589] waiting for network enabled…␊
[11:26:09:589] ~ mqtt_network_indication_cb OK [29]␊
[11:26:09:589] ~type[b] id[29] status[1]␊
[11:26:09:669] ~ mqtt_network_indication_cb OK [29]␊
[11:26:09:669] NW SIGNAL EVENT IS [2]␊
[11:26:09:669] ~type[b] id[29] status[1]␊
[11:26:09:669] network enabled!␊
[11:26:09:669] ~ mqtt_network_indication_cb OK [29]␊
[11:26:09:669] Initializes the DSS netctrl library␊
[11:26:09:669] ~type[b] id[29] status[1]␊
[11:26:09:669] DSS netctrl library has been initialized.␊
[11:26:09:669] ~ mqtt_network_indication_cb OK [29]␊
[11:26:09:669] Registering Callback tcp_dss_handle␊
[11:26:09:669] ~type[b] id[29] status[1]␊
[11:26:09:669] tcp_dss_handle 1169447326, status 0␊
[11:26:09:669] ~ mqtt_network_indication_cb OK [29]␊
[11:26:09:669] Registed tcp_dss_handler success␊
[11:26:09:669] ~type[b] id[29] status[1]␊
[11:26:09:669] Setting tech to Automatic␊
[11:26:09:695] ~ mqtt_network_indication_cb OK [29]␊
[11:26:09:695] Setting APN - internet.iot␊
[11:26:09:695] ~type[b] id[29] status[1]␊
[11:26:09:695] Setting family to IPv4␊
[11:26:09:711] qapi_DSS_Start_Data_Call start!!!.␊
[11:26:09:743] Start Data service success.␊
[11:26:09:759] Data test event callback, event: 1␊
[11:26:09:759] Data Call Connected.␊
[11:26:09:775] <— static IP address information —>␊
[11:26:09:791] static IP: 10.161.248.103␊
[11:26:09:791] Gateway IP: 10.161.248.104␊
[11:26:09:807] Primary DNS IP: 168.95.1.1␊
[11:26:09:823] Second DNS IP: 168.95.192.1␊
[11:26:09:823] <— End of system info —>␊
[11:26:09:839] SIGNAL EVENT IS [4]␊
[11:26:09:839] DSS_SIG_EVT_CONN_E Signal␊
[11:26:09:855] conn_mqtt entry␊
[11:26:09:870] @@@j = 1␊
[11:26:09:870] Primary DNS IP: 168.95.1.1␊
[11:26:09:886] Second DNS IP: 168.95.192.1␊
[11:26:09:902] Start DNSc…device_name: rmnet_data0␊
[11:26:09:932] hostname: mqtt.eclipse.org is resoling in interface: rmnet_data0␊
[11:26:10:156] reshost ret: 0␊
[11:26:10:186] ␊
[11:26:10:186] mqtt.eclipse.org --> 137.135.83.217␊
[11:26:10:186] client_len=8, client_str=22345678␊
[11:26:10:186] mqtt_cli_connect entry␊
[11:26:10:202] Mqtt Context created success, ctx=0x8097a92c␊
[11:26:10:202] Connecting…␊

This requires grabbing the LOG to locate the specific reason. If required, please contact the local FAE.