packet_forwarder
packet_forwarder copied to clipboard
Segmentation fault on sigint
After a CTRL-C, the process is normally stopping. However, after termination of downstream thread, I get a seg fault. The forwarder has been compiled for an ARM Cortex-A5. ` *** Multi Protocol Packet Forwarder for Lora Gateway *** Version: 3.0.0 *** Lora concentrator HAL library version info *** Version: 5.0.1; Options: native;
INFO: Little endian host `
`[...] INFO: Successfully contacted server router.eu.thethings.network INFO: Successfully contacted server iot.semtech.com INFO: [main] Starting the concentrator INFO: [main] concentrator started, radio packets can now be received.
INFO: Disabling GPS mode for concentrator's counter... INFO: JIT thread activated. INFO: [up] Thread activated for all servers. INFO: host/sx1301 time offset=(1509784329s:144413µs) - drift=245385309µs INFO: Enabling GPS mode for concentrator's counter.
^C INFO: End of JIT thread
INFO: End of upstream thread
INFO: End of downstream thread Segmentation fault`
It would help if you could run the software from gdb and provide information on where the issue occurs (in which function).
The strange thing is that I have it only without gdb... If you don't see it neither, it could be cause of ressource desctruction between thread, some timing difference could explain that.
By the way, I have seen a mistake concerning the call to freeaddrinfo, it should not be called when getaddrinfo returns an error since the result is null. The freeaddrinfo call will then result to a segafault as well.
i = getaddrinfo(servers[idx].addr, servers[idx].port_down, &hints, &result);
if (i != 0) {
MSG("ERROR: [down] getaddrinfo on address %s (port %s) returned: %s\n", servers[idx].addr, servers[idx].port_down, gai_strerror(i));
//freeaddrinfo(result);
return;
}