Skip to content
This repository has been archived by the owner on Aug 5, 2022. It is now read-only.

RangeError: Illegal offset: 0 <= 32736 (+4) <= 32739 in ProtoBuf read #13

Open
Egrodo opened this issue Nov 29, 2018 · 2 comments
Open

Comments

@Egrodo
Copy link

Egrodo commented Nov 29, 2018

Hi there, I'm working on a school project using your MTA library.

So I'm fully using your library (with some personal augments for ease of use) and it's working fantastic, I really appreciate your effort.

That being said, it would seem I'm running into a problem. Randomly I'll have a perfectly valid request to mta.schedule() throw the following error:

RangeError: Illegal offset: 0 <= 32736 (+4) <= 32739 at ByteBuffer.module.exports.ByteBufferPrototype.readUTF8String (C:\Users\egrodo\Documents\code\choochooserver\node_modules\mta-gtfs\node_modules\bytebuffer\dist\bytebuffer-node.js:2117:27) at ByteBuffer.module.exports.ByteBufferPrototype.readVString (C:\Users\egrodo\Documents\code\choochooserver\node_modules\mta-gtfs\node_modules\bytebuffer\dist\bytebuffer-node.js:2209:24) at Element.ProtoBuf.Reflect.ElementPrototype.decode (C:\Users\egrodo\Documents\code\choochooserver\node_modules\mta-gtfs\node_modules\protobufjs\dist\protobuf.js:2185:35) at Field.ProtoBuf.Reflect.FieldPrototype.decode (C:\Users\egrodo\Documents\code\choochooserver\node_modules\mta-gtfs\node_modules\protobufjs\dist\protobuf.js:3752:33) at Message.ProtoBuf.Reflect.MessagePrototype.decode (C:\Users\egrodo\Documents\code\choochooserver\node_modules\mta-gtfs\node_modules\protobufjs\dist\protobuf.js:3263:45) at Element.ProtoBuf.Reflect.ElementPrototype.decode (C:\Users\egrodo\Documents\code\choochooserver\node_modules\mta-gtfs\node_modules\protobufjs\dist\protobuf.js:2201:46) at Field.ProtoBuf.Reflect.FieldPrototype.decode (C:\Users\egrodo\Documents\code\choochooserver\node_modules\mta-gtfs\node_modules\protobufjs\dist\protobuf.js:3752:33) at Message.ProtoBuf.Reflect.MessagePrototype.decode (C:\Users\egrodo\Documents\code\choochooserver\node_modules\mta-gtfs\node_modules\protobufjs\dist\protobuf.js:3258:48) at Element.ProtoBuf.Reflect.ElementPrototype.decode (C:\Users\egrodo\Documents\code\choochooserver\node_modules\mta-gtfs\node_modules\protobufjs\dist\protobuf.js:2201:46) at Field.ProtoBuf.Reflect.FieldPrototype.decode (C:\Users\egrodo\Documents\code\choochooserver\node_modules\mta-gtfs\node_modules\protobufjs\dist\protobuf.js:3752:33)

There seems to be no pattern to this either. I could be sending the exact same request every 60 seconds for an hour and it won't happen, but then it'll go and happen 3 times in a row. It's not necessarily a fatal` issue, I have my front end retrying on failed requests, but it's definitely annoying and could cause a lot of problems when I make the project available publicly.

The randomness of this error leads me to think that it's an issue with the MTA API itself rather than your implementation of it, but I'd really appreciate it if you could take a look at see if there might be a better way to handle the error and attempt retries within the library instead? I'm still learning Javascript so I don't know enough to fork the library yet but maybe I'll do that some day.

Thank you for your time

@Egrodo Egrodo changed the title Illegal group end indicator in ProtoBuf decode RangeError: Illegal offset: 0 <= 32736 (+4) <= 32739 in ProtoBuf read Dec 1, 2018
@Egrodo
Copy link
Author

Egrodo commented Dec 3, 2018

I'm seeing that the answer to a lot of these issues is to upgrade protobuf to latest. Could be a potential fix? protobufjs/protobuf.js#476

@aamaliaa
Copy link
Owner

aamaliaa commented Dec 7, 2018

Hi @Egrodo, I have noticed this error from time to time, as well. A protobuf upgrade is likely needed to fix it. Unfortunately because the upgraded version has breaking changes, it's a larger project that I personally haven't had the time to take on yet. I'd definitely welcome a PR, however! 😃

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants