diff options
author | Eric S. Raymond <esr@thyrsus.com> | 2010-04-07 08:37:57 -0400 |
---|---|---|
committer | Eric S. Raymond <esr@thyrsus.com> | 2010-04-07 08:37:57 -0400 |
commit | 0ee8c304ad8466d0e656e50c29692b0302fcbd9c (patch) | |
tree | 5f68d351430159a18f0992c885e08e368bd659c7 /NEWS | |
parent | a0f13cb50324d587303402a6ac2713258f056177 (diff) | |
download | gpsd-0ee8c304ad8466d0e656e50c29692b0302fcbd9c.tar.gz |
Fix the select()-spin bug on disconnected devices.
Addresses Berlios tracker bug #14638: 100% cpu when Bluetooth gps device
vanishes. Also a couple of reports on the mailing lists.
The underlying problem here was that:
* Disconnecting a USB device causes reads from it to begin returning 0,
in effect an end-of-file condition.
* select(2) sets an active bit not on "I/O is ready" but on "read would not
block" -- including the end-of-file condition.
* Therefore, select() will spin any time its fd set includes a disconnected
device.
The fix is to check for a zero-length read explicitly and always take the
device out of the active set when that happens.
We were actually doing that here, but the test was defective in two ways:
1. The check for a zero return from gpsd_poll(), indicating I/O error
or zero-length read, needed to be *before* the check for full paccket
rather than after. This effectively disabled it.
2. There was a conditional arm in the gpsd_poll() code that made it ignore
zero-length reads for up to a full cycle. I think this may have been a
fossil from long ago when I experimented with non-blocking reads on
devices.
The fix for the gpsmon spin bug is probably quite similar. That's up next.
Diffstat (limited to 'NEWS')
-rw-r--r-- | NEWS | 7 |
1 files changed, 4 insertions, 3 deletions
@@ -12,9 +12,10 @@ now -L to -l can be used to enable logging (to stay consistent with the l command). There is new FAQ material on improving fix and time reference accuracy. New sections have been added to NMEA.txt on - error status indications and satellite IDs. New POLL command - brings back polling-mode operation. A Client-HOWTO has been added - to the documentation. + error status indications and satellite IDs. New POLL command brings + back polling-mode operation. A Client-HOWTO has been added to the + documentation. gpsd no longer eats CPU when a device is unexpectedky + unplugged. * Wed Mar 3 2010 Eric S. Raymond <esr@snark.thyrsus.com> - 2.92 Fix a packaging error. The new Python library module was |