LTE gets blocked after client.stop()

I have an LTE w/ O/S 0.8.0rc11 and after I make a connection with client.connect() for a bit, then I call. Client.stop(). Shortly after calling Client.stop the LTE blocks all user code for upto 30 -45 seconds. After the LTE starts looping again I get the following codes.

Does anyone know what these mean?

0000040598 [comm.protocol] ERROR: Event loop error 3
0000040599 [system] WARN: Communication loop error, closing cloud socket

It seems as though the cellular connection is being interrupted causing a modem reset.

Heres the full output:
0000040598 [comm.protocol] ERROR: Event loop error 3
0000040599 [system] WARN: Communication loop error, closing cloud socket
0000040599 [system] INFO: Cloud: disconnecting
0000040599 [system] INFO: Cloud: disconnected
0000040700 [system] INFO: Cloud: connecting
0000040714 [system] INFO: Read Server Address = type:1,domain:$id.udp.particle.io
0000041639 [system] INFO: Resolved host xxxxxx.udp.particle.io to xxxxxx
0000041669 [system] INFO: Cloud socket connected
0000041671 [system] INFO: Starting handshake: presense_announce=0
0000041671 [comm.protocol.handshake] INFO: Establish secure connection
0000041695 [comm.dtls] INFO: (CMPL,RENEG,NO_SESS,ERR) restoreStatus=2
0000048990 [comm.protocol.handshake] INFO: Sending HELLO message
0000049456 [comm.protocol.handshake] INFO: Handshake completed
0000049458 [system] INFO: Send spark/device/claim/code event
0000049556 [system] INFO: Send subscriptions
0000049648 [comm.dtls] INFO: session cmd (CLS,DIS,MOV,LOD,SAV): 4
0000049648 [comm.dtls] INFO: session cmd (CLS,DIS,MOV,LOD,SAV): 3
0000049650 [comm] INFO: Sending TIME request
0000049868 [comm.protocol] INFO: Sending ‘M’ describe message
0000049976 [comm.protocol] INFO: rcv’d message type=1
0000049976 [system] INFO: Cloud connected

If this is repeatable this smells like a bug where client.stop() (I need to guess your client is defined as UDP client; since you haven’t provided that info) also closes the socket for the cloud connection.

@rickkas7, what to you thing?

BTW, your topic says: “after client.connect()”, but then you actually say that it happens after client.stop() - hence I changed the topic tile.

@ScruffR This is actually a TCP connection and it happens every time this particular function is called on the E402 module. This same function works great when used on a P1

I have some more info on this. It seems if after I call client.stop and then I disconnect from the cloud and turn back on the modem it doesnt block bleow is the ending code and log output

void cellularOFF() {
  celluarTurnedOn = false;
  Particle.disconnect();
  Cellular.disconnect();
  Cellular.off();
  delay(2000);
}

void connectToCloud() {
  if(!celluarTurnedOn){
    if (!Cellular.ready()) {
      Cellular.on();
      celluarTurnedOn = true;
    }

    if (!Cellular.connecting()) {
      Particle.connect(); //connects when in battery mode
      cellularConnectStartMillis = millis();
    }
  }
}

client.stop();
delay(300);
cellularOFF(); //trying to stop the modem from freezing
connectToCloud();
0000065700 [system] INFO: Cloud: disconnecting
0000075710 [system] INFO: Cloud: disconnected
0000086430 [system] INFO: Sim Ready
0000086430 [system] INFO: ARM_WLAN_WD 1
0000086542 [system] INFO: ARM_WLAN_WD 2
0000086542 [system] INFO: CLR_WLAN_WD 1, DHCP success
0000086542 [system] INFO: Cloud: connecting
0000086548 [system] INFO: Read Server Address = type:1,domain:$id.udp.particle.io
0000086580 [system] INFO: Cloud socket connected
0000086582 [system] INFO: Starting handshake: presense_announce=0
0000086582 [comm.protocol.handshake] INFO: Establish secure connection
0000086614 [comm.dtls] INFO: (CMPL,RENEG,NO_SESS,ERR) restoreStatus=0
0000086616 [comm.dtls] INFO: out_ctr 0,1,0,0,0,0,0,31, next_coap_id=15
0000086616 [comm.dtls] INFO: app state crc: cached: dec9a77c, actual: dec9a77c
0000086618 [comm.dtls] WARN: skipping hello message
0000086618 [comm.dtls] INFO: restored session from persisted session data. next_msg_id=21
0000086620 [comm.dtls] INFO: session cmd (CLS,DIS,MOV,LOD,SAV): 2
0000086954 [comm.protocol.handshake] INFO: resumed session - not sending HELLO message
0000086954 [system] INFO: cloud connected from existing session.
0000086956 [system] INFO: Cloud connected
0000086966 [system] INFO: Cloud: disconnecting
0000086976 [system] INFO: Cloud: disconnected
0000103700 [system] INFO: Sim not inserted? Detecting...
0000104214 [system] INFO: Sim Ready
0000104214 [system] INFO: ARM_WLAN_WD 1
0000104336 [system] INFO: ARM_WLAN_WD 2
0000104336 [system] INFO: CLR_WLAN_WD 1, DHCP success
0000104336 [system] INFO: Cloud: connecting
0000104342 [system] INFO: Read Server Address = type:1,domain:$id.udp.particle.io
0000104374 [system] INFO: Cloud socket connected
0000104376 [system] INFO: Starting handshake: presense_announce=0
0000104376 [comm.protocol.handshake] INFO: Establish secure connection
0000104848 [comm.dtls] INFO: (CMPL,RENEG,NO_SESS,ERR) restoreStatus=0
0000104848 [comm.dtls] INFO: out_ctr 0,1,0,0,0,0,0,32, next_coap_id=16
0000104850 [comm.dtls] INFO: app state crc: cached: dec9a77c, actual: dec9a77c
0000104850 [comm.dtls] WARN: skipping hello message
0000104850 [comm.dtls] INFO: restored session from persisted session data. next_msg_id=22
0000104852 [comm.dtls] INFO: session cmd (CLS,DIS,MOV,LOD,SAV): 2
0000105214 [comm.protocol.handshake] INFO: resumed session - not sending HELLO message
0000105214 [system] INFO: cloud connected from existing session.
0000105216 [system] INFO: Cloud connected
0000105460 [comm.protocol] INFO: rcv'd message type=13

Heres some more information: if I call the below code then the module does not lock up. but its not ideal to have to reset the cellular connection.

      client.stop();
      delay(300);
      Particle.disconnect();
      Cellular.disconnect();
      delay(300);
      Particle.connect();
0000007878 [system] INFO: Sim Ready
0000007878 [system] INFO: ARM_WLAN_WD 1
0000023171 [system] INFO: ARM_WLAN_WD 2
0000023171 [system] INFO: CLR_WLAN_WD 1, DHCP success
0000023171 [system] INFO: Cloud: connecting
0000023177 [system] INFO: Read Server Address = type:1,domain:$id.udp.particle.io
0000023513 [system] INFO: Cloud socket connected
0000023515 [system] INFO: Starting handshake: presense_announce=0
0000023515 [comm.protocol.handshake] INFO: Establish secure connection
0000023547 [comm.dtls] INFO: (CMPL,RENEG,NO_SESS,ERR) restoreStatus=0
0000023547 [comm.dtls] INFO: out_ctr 0,1,0,0,0,0,0,12, next_coap_id=7
0000023549 [comm.dtls] INFO: app state crc: cached: d4f9aa1a, actual: d4f9aa1a
0000023549 [comm.dtls] WARN: skipping hello message
0000023551 [comm.dtls] INFO: restored session from persisted session data. next_msg_id=7
0000023551 [comm.dtls] INFO: session cmd (CLS,DIS,MOV,LOD,SAV): 2
0000023955 [comm.protocol.handshake] INFO: resumed session - not sending HELLO message
0000023955 [system] INFO: cloud connected from existing session.
0000023957 [system] INFO: Cloud connected
0000024314 [comm.protocol] INFO: rcv'd message type=13
0000024516 [comm.protocol] INFO: rcv'd message type=13
                ---------START OF CLIENT CONNECT -------------------------
0000046012 [comm.protocol] INFO: rcv'd message type=2
                ---------START OF CLIENT STOP -------------------------
0000057878 [system] INFO: Cloud: disconnecting
0000067888 [system] INFO: Cloud: disconnected
0000078688 [system] INFO: Sim Ready
0000078688 [system] INFO: ARM_WLAN_WD 1
0000078800 [system] INFO: ARM_WLAN_WD 2
0000078800 [system] INFO: CLR_WLAN_WD 1, DHCP success
0000078800 [system] INFO: Cloud: connecting
0000078806 [system] INFO: Read Server Address = type:1,domain:$id.udp.particle.io
0000078838 [system] INFO: Cloud socket connected
0000078840 [system] INFO: Starting handshake: presense_announce=0
0000078840 [comm.protocol.handshake] INFO: Establish secure connection
0000078872 [comm.dtls] INFO: (CMPL,RENEG,NO_SESS,ERR) restoreStatus=0
0000078874 [comm.dtls] INFO: out_ctr 0,1,0,0,0,0,0,15, next_coap_id=9
0000078874 [comm.dtls] INFO: app state crc: cached: d4f9aa1a, actual: d4f9aa1a
0000078876 [comm.dtls] WARN: skipping hello message
0000078876 [comm.dtls] INFO: restored session from persisted session data. next_msg_id=9
0000078878 [comm.dtls] INFO: session cmd (CLS,DIS,MOV,LOD,SAV): 2
0000079220 [comm.protocol.handshake] INFO: resumed session - not sending HELLO message
0000079220 [system] INFO: cloud connected from existing session.
0000079222 [system] INFO: Cloud connected

Can you file a GitHub issue for this?
https://docs.particle.io/reference/device-os/firmware/photon/#system-events

Maybe you can also brows the already filed issues to see whether there already is one that could be linked to yours.

1 Like

A new issue has been opened in GitHub.

1 Like