Hello,
I've made the attached patch to prevent the situation where the udp-receiver hang out indefinitly waiting for data when the server has been killed after having started to send data.
In this case, the udp-received program would hang indefinitly.
Since in my program, udp-receiver is called through system(...); the result is a hang.
With this patch I use a SIGALARM signal to reset a flag to 0, and act as a watchdog. The watchdog is started just before the sending data phase of the protocol, and is feed each time a packet is received from the server.
If 2 times in a row the watchdog is not feed, the program exit in error.
The current value is set as a #define as 60s, which is in effect 2mn before udp-receiver is actually killed.
However I am aware that this implementation is somehow crude, and I would be interested by any other way to do that.
Additionally, if someone is interested by this patch, I could make it so that the watchdog period is configurable on the command-line.
Thanks for your time,
Julien
Hello Julien,
On 2010-09-13 11:59, Julien Aube wrote:
Hello,
I've made the attached patch to prevent the situation where the udp-receiver hang out indefinitly waiting for data when the server has been killed after having started to send data.
In this case, the udp-received program would hang indefinitly.
Since in my program, udp-receiver is called through system(...); the result is a hang.
With this patch I use a SIGALARM signal to reset a flag to 0, and act as a watchdog. The watchdog is started just before the sending data phase of the protocol, and is feed each time a packet is received from the server.
If 2 times in a row the watchdog is not feed, the program exit in error.
The current value is set as a #define as 60s, which is in effect 2mn before udp-receiver is actually killed.
However I am aware that this implementation is somehow crude, and I would be interested by any other way to do that.
Additionally, if someone is interested by this patch, I could make it so that the watchdog period is configurable on the command-line.
Thanks for your time,
Julien
In version 20110710, udp-receiver now has a new flag --receive-timeout <seconds> which allows to set such a timeout (this is implemented using select)
Regards,
Alain