evernote-sdk-js
evernote-sdk-js copied to clipboard
Catch readMessageBegin failures
Refs. #71
This patch is intended to fix uncaught exceptions triggered by a MemBuffer overrun exception.
2018-04-27T19:37:13.755+0000 - uncaughtException: Error: MemBuffer overrun
at MemBuffer.read (/[redacted]/[redacted]/node_modules/evernote/lib/thrift/transport/memBuffer.js:29:55)
at BinaryProtocol.readMessageBegin (/[redacted]/[redacted]/node_modules/evernote/lib/thrift/protocol/binaryProtocol.js:203:38)
at Thrift.Method.processResponse (/[redacted]/[redacted]/node_modules/evernote/lib/thrift/thrift.js:184:27)
at Thrift.Method.<anonymous> (/[redacted]/[redacted]/node_modules/evernote/lib/thrift/thrift.js:165:42)
at wrapTransport (/[redacted]/[redacted]/node_modules/evernote/lib/thrift/protocol/binaryProtocol.js:48:20)
at IncomingMessage.<anonymous> (/[redacted]/[redacted]/node_modules/evernote/lib/thrift/transport/binaryHttpTransport.js:82:27)
at IncomingMessage.emit (events.js:185:15)
at endReadableNT (_stream_readable.js:1106:12)
at process._tickCallback (internal/process/next_tick.js:178:19)
Thanks. This helped.
@mariecl Same error appeared in my logs, but I got another stack:
Error: MemBuffer overrun
at MemBuffer.read (/src/node_modules/evernote/lib/thrift/transport/memBuffer.js:29:55)
at BinaryProtocol.readString (/src/node_modules/evernote/lib/thrift/protocol/binaryProtocol.js:333:29)
at BinaryProtocol.readType (/src/node_modules/evernote/lib/thrift/protocol/binaryProtocol.js:353:25)
at Object.Thrift.Struct.readFields (/src/node_modules/evernote/lib/thrift/thrift.js:505:49)
at Thrift.Struct.read (/src/node_modules/evernote/lib/thrift/thrift.js:485:19)
at Object.Thrift.List.readEntries (/src/node_modules/evernote/lib/thrift/thrift.js:257:35)
at Thrift.List.read (/src/node_modules/evernote/lib/thrift/thrift.js:248:17)
at Object.Thrift.Struct.readFields (/src/node_modules/evernote/lib/thrift/thrift.js:503:53)
at Thrift.Struct.read (/src/node_modules/evernote/lib/thrift/thrift.js:485:19)
at Thrift.Method.processResponse (/src/node_modules/evernote/lib/thrift/thrift.js:204:26)
The last line points to result = this.result.read(response);
I believe, to completely fix the issue you should put into try
all code down to response.readMessageEnd();
I updated my branch to also catch errors on Membuffer.read
with the following stack trace:
at MemBuffer.read (/[...]/node_modules/evernote/lib/thrift/transport/memBuffer.js:29:55)
at BinaryProtocol.readString (/[...]/node_modules/evernote/lib/thrift/protocol/binaryProtocol.js:333:29)
at BinaryProtocol.readType (/[...]/node_modules/evernote/lib/thrift/protocol/binaryProtocol.js:353:25)
at Object.Thrift.Struct.readFields (/[...]/node_modules/evernote/lib/thrift/thrift.js:513:49)
at Thrift.Struct.read (/[...]/node_modules/evernote/lib/thrift/thrift.js:493:19)
at Object.Thrift.Struct.readFields (/[...]/node_modules/evernote/lib/thrift/thrift.js:511:53)
at Thrift.Struct.read (/[...]/node_modules/evernote/lib/thrift/thrift.js:493:19)
at Thrift.Method.processResponse (/[...]/node_modules/evernote/lib/thrift/thrift.js:212:26)
at Thrift.Method.<anonymous> (/[...]/node_modules/evernote/lib/thrift/thrift.js:165:42)
at wrapTransport (/[...]/node_modules/evernote/lib/thrift/protocol/binaryProtocol.js:48:20)```