diff options
author | Eric S. Raymond <esr@thyrsus.com> | 2015-01-28 22:08:49 -0500 |
---|---|---|
committer | Eric S. Raymond <esr@thyrsus.com> | 2015-01-28 22:08:49 -0500 |
commit | c22e4adc07305d0ff39756843015be6b092cbcb6 (patch) | |
tree | 492bdf91e596a03206039145828211eb6ee200a6 | |
parent | 422ad051a0b9092448c6b6950849fc91a292f85b (diff) | |
download | gpsd-c22e4adc07305d0ff39756843015be6b092cbcb6.tar.gz |
Using SIOCOUTQ to flush output on client socket close caused a hard hang.
To replicate the problem:
(1) Check out the parent of this revision.
(2) Run "gpsd -n -N -D 3 /dev/ttyUSB0" substituting the device as needed.
(3) Run the following script in another window:
while true
do
date
./gpspipe -n 3 -R -o /dev/null # hang if gpsd is sick
./gpspipe -d -R -o /dev/null
sleep 2
DELAY=$RANDOM # 0-32K
#usleep ${DELAY}00 # 0-3 seconds
sleep `echo "scale=6; $DELAY / 1000000" | bc`
killall gpspipe
#ps ax | grep gpspipe
done
(4) Run gpsmon in a third window.
gpsd will hang in 3-5 minutes, requiring kill -9, in the kernal hrtime
function.
-rw-r--r-- | gpsd.c | 17 |
1 files changed, 0 insertions, 17 deletions
@@ -41,10 +41,6 @@ #ifndef S_SPLINT_S #include <unistd.h> #endif /* S_SPLINT_S */ -#ifdef __linux__ -#include <sys/ioctl.h> /* needed for ioctl(SIOCOUTQ) */ -#include <linux/sockios.h> /* needed for ioctl(SIOCOUTQ) */ -#endif /* __linux__ */ #include "gpsd_config.h" @@ -553,19 +549,6 @@ static void detach_client(struct subscriber_t *sub) } c_ip = netlib_sock2ip(sub->fd); (void)shutdown(sub->fd, SHUT_RDWR); -#ifdef __linux__ - /* - * Delay the socket close that breaks the connection until - * all pending data has shipped. - */ - for(;;) { - int outstanding; - ioctl(sub->fd, SIOCOUTQ, &outstanding); - if (!outstanding) - break; - usleep(1000); - } -#endif gpsd_report(&context.errout, LOG_SPIN, "close(%d) in detach_client()\n", sub->fd); |