Thu 29 Aug 2013 07:32:02 AM UTC, original submission:
When processing a TCP feed from AISHub (eg: gpsd tcp://data.aishub.4143) occasionally gpsd encounters a message that has a bad checksum. When run with '-D6', the output looks like:
> gpsd -D6 tcp://data.aishub:4143
gpsd:SPIN: packet_get() fd 5 -> 37 (0)
gpsd:WARN: bad checksum in NMEA packet; expected 63.
gpsd:PROG: no /etc/gpsd/device-hook present, skipped running DEACTIVATE hook
gpsd:INFO: hunt on tcp://data.aishub.net:4143 failed (0.000746 sec since data)
gpsd:WARN: device read of tcp://data.aishub.net:4143 returned error or packet sniffer failed sync (flags {ERROR})
gpsd:IO: => client(0): {"class":"DEVICE","path":"tcp://data.aishub.net:4143","activated":0}\x0d\x0a
gpsd:INFO: closing GPS=tcp://data.aishub.net:4143 (5)
gpsd:SPIN: close(5) in gpsd_close(tcp://data.aishub.net:4143)
gpsd:PROG: no /etc/gpsd/device-hook present, skipped running DEACTIVATE hook
gpsd:SPIN: select() {3 4 6} -> { 6 } at 1377656595.767019 (errno 0)
gpsd:SPIN: packet_get() fd 6 -> 26 (0)
gpsd:SPIN: select() {3 4 6} -> { 6 } at 1377656595.767238 (errno 0)
gpsd:SPIN: packet_get() fd 6 -> 0 (0)
gpsd:DATA: tcp://data.aishub.net:4143 returned zero bytes
gpsd:DATA: tcp://data.aishub.net:4143 will be repolled in 0.010000 seconds
(here's a longer version of the above log output: https://gist.github.com/tnightingale/b6461ef7e1205eefe3cb)
At which point the tcp 'device' is dropped and no more messages are read or parsed.
I logged the stream of NMEA messages coming from AISHub and ran them through gpsfake until I encountered the error. Here's a trimmed version of the log:
!AIVDM,1,1,,2,839ec40j2d=><>=Md1b@e?bh7<P0,0*64
!AIVDM,1,1,,B,B6:fN?@0@220cJ3:tS5?LwS61P06,0*
48
(longer version: https://gist.github.com/tnightingale/6375039)
The first message parses fine, the second causes the 'bad checksum' error. It looks like there's an unintentional linebreak/whitespace character in the message.
Interestingly, while the default execution of gpsfake (with a pty device) reports the bad checksum error, the device isn't dropped. Gpsd continues to read and parse messages. However if you run gpsfake with the '-u' option (forcing UDP instead of pty) and '-D6' you see the following:
> gpsfake -u -D6 snippet.ais
gpsd:SPIN: select() {3 4 5 6 7} -> { 7 } at 1377758984.266909 (errno 0)
gpsd:SPIN: packet_get() fd 7 -> 46 (0)
gpsd:WARN: bad checksum in NMEA packet; expected 48.
gpsd:PROG: no /etc/gpsd/device-hook present, skipped running DEACTIVATE hook
gpsd:INFO: hunt on udp://127.0.0.1:5000 failed (0.001238 sec since data)
gpsd:WARN: device read of udp://127.0.0.1:5000 returned error or packet sniffer failed sync (flags {ERROR})
gpsd:IO: => client(0): {"class":"DEVICE","path":"udp://127.0.0.1:5000","activated":0}\x0d\x0a
gpsd:INFO: closing GPS=udp://127.0.0.1:5000 (7)
gpsd:SPIN: close(7) in gpsd_close(udp://127.0.0.1:5000)
gpsd:PROG: no /etc/gpsd/device-hook present, skipped running DEACTIVATE hook
The UDP 'device' and any listening clients are dropped and no more messages are read/parsed.
I have tested this with gpsd revision 3.9 compiled on debian wheezy and Mac OSX 10.8.4.
|