bugGPSD - Bugs: bug #39122, JSON interface parse error

 
 

bug #39122: JSON interface parse error

Submitted by:  None
Submitted on:  Thu 30 May 2013 07:04:32 AM UTC  
 
Category: NoneSeverity: 3 - Normal
Item Group: NoneStatus: Fixed
Privacy: PublicAssigned to: None
Open/Closed: Closed

Add a New Comment(Rich Markup)
   

You are not logged in

Please log in, so followups can be emailed to you.

 

Tue 24 Sep 2013 04:39:11 AM UTC, comment #4:

Should be fixed now in the repository heaf version; please test.

Eric S. Raymond <esr>
Project Administrator
Tue 24 Sep 2013 03:14:35 AM UTC, comment #3:

Successfully reproduced here. This means I should be able to fix it shortly.

Eric S. Raymond <esr>
Project Administrator
Mon 23 Sep 2013 09:19:49 AM UTC, comment #2:

Yes, I meant that there is no ';' after the message has parsed. As you can see from the error message, it says "Unrecognized request '?POLL'". I suspected that the reason why this happens is that the parser removes the ; mark from the latter command. It is only my guess. The bug might be more complicated.

However, you should be able to repeat this bug by sending that message. The second command won't be recognized.

Anonymous
Fri 20 Sep 2013 01:59:29 PM UTC, comment #1:

I am puzzled by this report. You write:

Shouldn't be too hard because it seems that it is only matter of not having ; char after the ?POLL command.

But in the call $self->socket->send(qq(?DEVICES;\n?POLL;\n)) that you say reliably repeats this bug, there is a ';' after the poll command.

Eric S. Raymond <esr>
Project Administrator
Thu 30 May 2013 07:04:32 AM UTC, original submission:

If two or more messages are sent to gpsd's JSON interface right after another then gpsd might not recognize the latter command. For example, perl's Net::GPSD3 client (http://cpansearch.perl.org/src/MRDVT/Net-GPSD3-0.18/lib/Net/GPSD3.pm) sends messages ?DEVICES; and ?POLL; to gpsd and then reads responses from socket. Mostly gpsd can recognize both commands but every once in a while POLL is not recognized. If that is a case Net::GPSD3 ends up in a infinite loop and the responses are:

{"class":"DEVICES","devices":[{"class":"DEVICE","path":"/dev/ttyUSB6","activated":"2013-05-30T05:27:12.926Z","flags":1,"driver":"Generic NMEA","native":0,"bps":9600,"parity":"N","stopbits":1,"cycle":1.00}]}
{"class":"ERROR","message":"Unrecognized request '?POLL'"}

Because this bug happens only now and then I tried to solve how to repeat this bug easily. I end up replacing these two lines in GPSD3.pm

$self->socket->send(qq(?DEVICES;\n)) unless $self->cache->DEVICES;
$self->socket->send(qq(?POLL;\n));

with line

$self->socket->send(qq(?DEVICES;\n?POLL;\n)) unless $self->cache->DEVICES;

In my tests this change will always result in above error message. Naturally this bug could be avoided by reading the response to ?DEVICES; command and sending the ?POLL; command only after that. Anyhow, I would like to get this fixed. Shouldn't be too hard because it seems that it is only matter of not having ; char after the ?POLL command.

Anonymous

 

(Note: upload size limit is set to 16384 kB, after insertion of the required escape characters.)

Attach File(s):
   
   
Comment:
   

Attached Files
file #28207:  gpsd-better_str_parsing.patch added by None (511B - text/x-patch - Fixes parsing for commands. This fixes perl issue.)

 

Depends on the following items: None found

Items that depend on this one: None found

 

Carbon-Copy List
  • -unavailable- added by esr (Posted a comment)
  •  

    Do you think this task is very important?
    If so, you can click here to add your encouragement to it.
    This task has 0 encouragements so far.

    Only logged-in users can vote.

     

    Please enter the title of George Orwell's famous dystopian book (it's a date):

     

     

    Follow 5 latest changes.

    Date Changed By Updated Field Previous Value => Replaced By
    Fri 22 Nov 2013 01:45:39 PM UTCesrOpen/ClosedOpen=>Closed
    Sun 29 Sep 2013 07:56:47 PM UTCesrStatusReady For Test=>Fixed
    Tue 24 Sep 2013 04:39:11 AM UTCesrStatusNeed Info=>Ready For Test
    Fri 20 Sep 2013 01:59:29 PM UTCesrStatusNone=>Need Info
    Thu 30 May 2013 07:17:54 AM UTCNoneAttached File-=>Added gpsd-better_str_parsing.patch, #28207

    Back to the top


    Powered by Savane 3.1-cleanup1