jpmeijers / ttn-resin-gateway-rpi

81 stars 41 forks source link

Connection with TTN is not restored after connectivity issues #7

Open SloMusti opened 6 years ago

SloMusti commented 6 years ago

I have a RPi 3 + IC880A board deployed with the latest version of this repository and the gateway goes online after some time due to loss of connectivity to TTN servers and does not reconnect automatically but needs to be restarted manually through resin. This is somewhat of a corner-case given that it is on a rather bad WiFi uplink, but should still manage to restore connectivity when possible.

The log looks like this when it stops working. Reconnect happens and ti states connected, but that is not actually the case and remains offline on TTN until the application is restarted. This happens repeatedly and thus we can easily test potential fixes.

Edit: Note that after reconnect is issued, there are no packets received anymore nor the real-time statistics are printed out.

14.12.17 21:00:18 (+0100) ### [PERFORMANCE] ###
14.12.17 21:00:18 (+0100) # Upstream radio packet quality: 66.67%.
14.12.17 21:00:18 (+0100) # Semtech status report send.
14.12.17 21:00:18 (+0100) ##### END #####
14.12.17 21:00:18 (+0100) 20:00:18  INFO: [TTN] bridge.eu.thethings.network RTT 927
14.12.17 21:00:20 (+0100) 20:00:20  ERROR: [TTN] send status failed for bridge.eu.thethings.network
14.12.17 21:00:20 (+0100) 20:00:20  INFO: [TTN] Reconnecting bridge.eu.thethings.network
14.12.17 21:00:21 (+0100) 20:00:21  INFO: [up] TTN lora packet send to server "bridge.eu.thethings.network"
14.12.17 21:00:37 (+0100) [TTN Gateway]: Resetting concentrator on default pin 22.
14.12.17 21:00:37 (+0100) 20:00:37  *** Multi Protocol Packet Forwarder for Lora Gateway ***
14.12.17 21:00:37 (+0100) Version: 3.0.10
14.12.17 21:00:37 (+0100) 20:00:37  *** Lora concentrator HAL library version info ***
14.12.17 21:00:37 (+0100) Version: 5.0.1; Options: native;
14.12.17 21:00:37 (+0100) ***
14.12.17 21:00:37 (+0100) 20:00:37  INFO: Little endian host
14.12.17 21:00:37 (+0100) 20:00:37  INFO: found global configuration file global_conf.json, parsing it
14.12.17 21:00:37 (+0100) 20:00:37  INFO: global_conf.json does contain a JSON object named SX1301_conf, parsing SX1301 parameters
14.12.17 21:00:37 (+0100) 20:00:37  INFO: lorawan_public 1, clksrc 1
14.12.17 21:00:37 (+0100) 20:00:37  INFO: no configuration for LBT
14.12.17 21:00:37 (+0100) 20:00:37  INFO: antenna_gain 0 dBi
14.12.17 21:00:37 (+0100) 20:00:37  INFO: Configuring TX LUT with 16 indexes
14.12.17 21:00:37 (+0100) 20:00:37  INFO: radio 0 enabled (type SX1257), center frequency 867500000, RSSI offset -166.000000, tx enabled 1
14.12.17 21:00:37 (+0100) 20:00:37  INFO: radio 1 enabled (type SX1257), center frequency 868500000, RSSI offset -166.000000, tx enabled 0
14.12.17 21:00:37 (+0100) 20:00:37  INFO: Lora multi-SF channel 0>  radio 1, IF -400000 Hz, 125 kHz bw, SF 7 to 12
14.12.17 21:00:37 (+0100) 20:00:37  INFO: Lora multi-SF channel 1>  radio 1, IF -200000 Hz, 125 kHz bw, SF 7 to 12
14.12.17 21:00:37 (+0100) 20:00:37  INFO: Lora multi-SF channel 2>  radio 1, IF 0 Hz, 125 kHzbw, SF 7 to 12
14.12.17 21:00:37 (+0100) 20:00:37  INFO: Lora multi-SF channel 3>  radio 0, IF -400000 Hz, 125 kHz bw, SF 7 to 12
14.12.17 21:00:37 (+0100) 20:00:37  INFO: Lora multi-SF channel 4>  radio 0, IF -200000 Hz, 125 kHz bw, SF 7 to 12
14.12.17 21:00:37 (+0100) 20:00:37  INFO: Lora multi-SF channel 5>  radio 0, IF 0 Hz, 125 kHzbw, SF 7 to 12
14.12.17 21:00:37 (+0100) 20:00:37  INFO: Lora multi-SF channel 6>  radio 0, IF 200000 Hz, 125 kHz bw, SF 7 to 12
14.12.17 21:00:37 (+0100) 20:00:37  INFO: Lora multi-SF channel 7>  radio 0, IF 400000 Hz, 125 kHz bw, SF 7 to 12
14.12.17 21:00:37 (+0100) 20:00:37  INFO: Lora std channel> radio 1, IF -200000 Hz, 250000 Hzbw, SF 7
14.12.17 21:00:37 (+0100) 20:00:37  INFO: FSK channel> radio 1, IF 300000 Hz, 125000 Hz bw, 50000 bps datarate
14.12.17 21:00:37 (+0100) 20:00:37  INFO: global_conf.json does contain a JSON object named gateway_conf, parsing gateway parameters
14.12.17 21:00:37 (+0100) 20:00:37  INFO: gateway MAC address is configured to XXXXXXXXXXX
14.12.17 21:00:37 (+0100) 20:00:37  INFO: Found 1 servers in array.
14.12.17 21:00:37 (+0100) 20:00:37  INFO: Server 0 configured to "bridge.eu.thethings.network"
14.12.17 21:00:37 (+0100) 20:00:37  INFO: packets received with a valid CRC will be forwarded
14.12.17 21:00:37 (+0100) 20:00:37  INFO: packets received with a CRC error will NOT be forwarded
14.12.17 21:00:37 (+0100) 20:00:37  INFO: packets received with no CRC will NOT be forwarded
14.12.17 21:00:37 (+0100) 20:00:37  INFO: Reference latitude is configured to XXXXX deg
14.12.17 21:00:37 (+0100) 20:00:37  INFO: Reference longitude is configured to XXXXXX deg
14.12.17 21:00:37 (+0100) 20:00:37  INFO: Reference altitude is configured to 0 meters
14.12.17 21:00:37 (+0100) 20:00:37  INFO: GPS is enabled
14.12.17 21:00:37 (+0100) 20:00:37  INFO: Using fake GPS coordinates instead of real.
14.12.17 21:00:37 (+0100) 20:00:37  INFO: Upstream data is enabled
14.12.17 21:00:37 (+0100) 20:00:37  INFO: Downstream data is enabled
14.12.17 21:00:37 (+0100) 20:00:37  INFO: Ghoststream data is disabled
14.12.17 21:00:37 (+0100) 20:00:37  INFO: Radiostream data is enabled
14.12.17 21:00:37 (+0100) 20:00:37  INFO: Statusstream data is enabled
14.12.17 21:00:37 (+0100) 20:00:37  INFO: Beacon is disabled
14.12.17 21:00:37 (+0100) 20:00:37  INFO: Monitor is disabled
14.12.17 21:00:37 (+0100) 20:00:37  INFO: Packet logger is disabled
14.12.17 21:00:37 (+0100) 20:00:37  INFO: Flush output after statistic is disabled
14.12.17 21:00:37 (+0100) 20:00:37  INFO: Flush after each line of output is disabled
14.12.17 21:00:37 (+0100) 20:00:37  INFO: Watchdog is disabled
14.12.17 21:00:37 (+0100) 20:00:37  INFO: Contact email configured to "XXXXX"
14.12.17 21:00:37 (+0100) 20:00:37  INFO: Description configured to "XXXXXXX"
14.12.17 21:00:37 (+0100) 20:00:37  INFO: [Transports] Initializing protocol for 1 servers
14.12.17 21:00:43 (+0100) 20:00:43  ERROR: [TTN] Connection to server "bridge.eu.thethings.network" failed, retry in 30 seconds
14.12.17 21:00:52 (+0100) 20:00:52  ERROR: [TTN] Connection to server "bridge.eu.thethings.network" failed, retry in 30 seconds
14.12.17 21:01:32 (+0100) 20:01:32  ERROR: [TTN] Connection to server "bridge.eu.thethings.network" failed, retry in 60 seconds
14.12.17 21:02:38 (+0100) 20:02:38  INFO: [TTN] server "bridge.eu.thethings.network" connected
SloMusti commented 6 years ago

This may be relevant: https://github.com/TheThingsNetwork/packet_forwarder/issues/37

SloMusti commented 6 years ago

https://github.com/TheThingsNetwork/packet_forwarder/issues/65