Lora-net / picoGW_packet_forwarder

A LoRa packet forwarder running on the host of a LoRa Picocell Gateway that forwards RF packets receive by the concentrator to a server through a IP/UDP link, and emits RF packets that are sent by the server.
Other
47 stars 51 forks source link

lor_pkt_fwd hangs right after a reboot #11

Closed haimiko closed 1 year ago

haimiko commented 4 years ago

If I reboot my Linux gateway and try running the pkt forwarder it hangs until I ctrl-c it then re-run it. Not to mention it always hangs when running as a system service or via crontab using the @reboot. .

Right after reboot:

./lora_pkt_fwd
*** Packet Forwarder for Lora PicoCell Gateway ***
Version: 0.1.0
*** Lora concentrator HAL library version info ***
Version: 0.2.3;
*** MCU FW version for LoRa PicoCell Gateway ***
Version: 0x010A0006
***
INFO: Little endian host
INFO: found global configuration file global_conf.json, parsing it
INFO: global_conf.json does contain a JSON object named SX1301_conf, parsing SX1301 parameters
INFO: lorawan_public 1, clksrc 1
INFO: antenna_gain 0 dBi
INFO: Configuring TX LUT with 16 indexes
INFO: radio 0 enabled (type SX1257), center frequency 902700000, RSSI offset -164.000000, tx enabled 1
INFO: radio 1 enabled (type SX1257), center frequency 903400000, RSSI offset -164.000000, tx enabled 0
INFO: Lora multi-SF channel 0>  radio 0, IF -400000 Hz, 125 kHz bw, SF 7 to 12
INFO: Lora multi-SF channel 1>  radio 0, IF -200000 Hz, 125 kHz bw, SF 7 to 12
INFO: Lora multi-SF channel 2>  radio 0, IF 0 Hz, 125 kHz bw, SF 7 to 12
INFO: Lora multi-SF channel 3>  radio 0, IF 200000 Hz, 125 kHz bw, SF 7 to 12
INFO: Lora multi-SF channel 4>  radio 1, IF -300000 Hz, 125 kHz bw, SF 7 to 12
INFO: Lora multi-SF channel 5>  radio 1, IF -100000 Hz, 125 kHz bw, SF 7 to 12
INFO: Lora multi-SF channel 6>  radio 1, IF 100000 Hz, 125 kHz bw, SF 7 to 12
INFO: Lora multi-SF channel 7>  radio 1, IF 300000 Hz, 125 kHz bw, SF 7 to 12
INFO: Lora std channel> radio 0, IF 300000 Hz, 500000 Hz bw, SF 8
INFO: FSK channel 8 disabled
INFO: global_conf.json does contain a JSON object named gateway_conf, parsing gateway parameters
INFO: gateway MAC address is configured to XXXXX
INFO: server hostname or IP address is configured to "XXXXXX.com"
INFO: upstream port is configured to "1700"
INFO: downstream port is configured to "1700"
INFO: downstream keep-alive interval is configured to 10 seconds
INFO: statistics display interval is configured to 30 seconds
INFO: upstream PUSH_DATA time-out is configured to 100 ms
INFO: packets received with a valid CRC will be forwarded
INFO: packets received with a CRC error will NOT be forwarded
INFO: packets received with no CRC will NOT be forwarded
^CINFO: [main] concentrator started, packet can now be received

INFO: End of upstream thread

INFO: End of downstream thread
INFO: concentrator stopped successfully
INFO: Exiting packet forwarder program
INFO: Stopping concentrator

After ctrl-c and restarting works just fine:

*** Packet Forwarder for Lora PicoCell Gateway ***
Version: 0.1.0
*** Lora concentrator HAL library version info ***
Version: 0.2.3;
*** MCU FW version for LoRa PicoCell Gateway ***
Version: 0x010A0006
***
INFO: Little endian host
INFO: found global configuration file global_conf.json, parsing it
INFO: global_conf.json does contain a JSON object named SX1301_conf, parsing SX1301 parameters
INFO: lorawan_public 1, clksrc 1
INFO: antenna_gain 0 dBi
INFO: Configuring TX LUT with 16 indexes
INFO: radio 0 enabled (type SX1257), center frequency 902700000, RSSI offset -164.000000, tx enabled 1
INFO: radio 1 enabled (type SX1257), center frequency 903400000, RSSI offset -164.000000, tx enabled 0
INFO: Lora multi-SF channel 0>  radio 0, IF -400000 Hz, 125 kHz bw, SF 7 to 12
INFO: Lora multi-SF channel 1>  radio 0, IF -200000 Hz, 125 kHz bw, SF 7 to 12
INFO: Lora multi-SF channel 2>  radio 0, IF 0 Hz, 125 kHz bw, SF 7 to 12
INFO: Lora multi-SF channel 3>  radio 0, IF 200000 Hz, 125 kHz bw, SF 7 to 12
INFO: Lora multi-SF channel 4>  radio 1, IF -300000 Hz, 125 kHz bw, SF 7 to 12
INFO: Lora multi-SF channel 5>  radio 1, IF -100000 Hz, 125 kHz bw, SF 7 to 12
INFO: Lora multi-SF channel 6>  radio 1, IF 100000 Hz, 125 kHz bw, SF 7 to 12
INFO: Lora multi-SF channel 7>  radio 1, IF 300000 Hz, 125 kHz bw, SF 7 to 12
INFO: Lora std channel> radio 0, IF 300000 Hz, 500000 Hz bw, SF 8
INFO: FSK channel 8 disabled
INFO: global_conf.json does contain a JSON object named gateway_conf, parsing gateway parameters
INFO: gateway MAC address is configured to XXXXXXX
INFO: server hostname or IP address is configured to "XXX.com"
INFO: upstream port is configured to "1700"
INFO: downstream port is configured to "1700"
INFO: downstream keep-alive interval is configured to 10 seconds
INFO: statistics display interval is configured to 30 seconds
INFO: upstream PUSH_DATA time-out is configured to 100 ms
INFO: packets received with a valid CRC will be forwarded
INFO: packets received with a CRC error will NOT be forwarded
INFO: packets received with no CRC will NOT be forwarded
INFO: [main] concentrator started, packet can now be received
INFO: host/sx1301 time offset=(1577737689s:337748µs) - drift=1577737689337748µs
INFO: [down] PULL_ACK received in 28 ms
^C
##### 2019-12-30 20:28:14 GMT #####
### [UPSTREAM] ###
# RF packets received by concentrator: 0
# CRC_OK: 0.00%, CRC_FAIL: 0.00%, NO_CRC: 0.00%
# RF packets forwarded: 0 (0 bytes)
# PUSH_DATA datagrams sent: 0 (0 bytes)
# PUSH_DATA acknowledged: 0.00%
### [DOWNSTREAM] ###
# PULL_DATA sent: 1 (100.00% acknowledged)
# PULL_RESP(onse) datagrams received: 0 (0 bytes)
# RF packets sent to concentrator: 0 (0 bytes)
# TX errors: 0
### [JIT] ###
src/jitqueue.c:448:jit_print_queue(): INFO: [jit] queue is empty
### [GPS] ###
# GPS sync is disabled
##### END #####

INFO: End of upstream thread
INFO: concentrator stopped successfully
INFO: Exiting packet forwarder program
INFO: Stopping concentrator

If I reboot then I need to run it once, ctrl-c and re-run again.

haimiko commented 4 years ago

I noticed that it cannot run as a systemd service. Will always hang as it is having trouble reading from FD 3. Works just fine in the foreground or if I start from a shell nohup and then disown. However will hang even if I nohup and disown from systemd startup unless I run it with a strace and output the result of strace to a file.

databang-io commented 4 years ago

Same issue here did you find a solution ?

haimiko commented 4 years ago

Unfortunately no. My fix is to run it with strace. Works great.

smtc-bot commented 1 year ago

Thank you for your inquiry.

Customers are encouraged to submit technical questions via our dedicated support portal at https://semtech.force.com/ldp/ldp_support.

We invite all users to visit the LoRa Developer Portal Forum at https://forum.lora-developers.semtech.com and to join the thriving LoRa development community!