tedis icon indicating copy to clipboard operation
tedis copied to clipboard

uncaught exception: protocol tries to read unavailable data

Open bgrosse-midokura opened this issue 5 years ago • 2 comments

    at Function.byteLength (buffer.js:515:11)
    at Protocol.parse (/home/gipsy/o/qdice/node_modules/tedis/src/core/protocol.ts:74:29)
    at Socket.<anonymous> (/home/gipsy/o/qdice/node_modules/tedis/src/core/base.ts:133:23)
    at Socket.emit (events.js:189:13)
    at Socket.EventEmitter.emit (domain.js:441:20)
    at addChunk (_stream_readable.js:284:12)
    at readableAddChunk (_stream_readable.js:265:11)
    at Socket.Readable.push (_stream_readable.js:220:10)
    at TCP.onStreamRead [as onread] (internal/stream_base_commons.js:94:17)

My guess is that, on larger values, the socket stream's data event might not always send $<size> together with whatever is expected next, it might send it in two (or more) events. But base/protocol only knows to parse this at once. I tried to fix it but couldn't figure it out.

bgrosse-midokura avatar May 10 '20 08:05 bgrosse-midokura

Can you provide case data, or the size of the data that caused the error?

dasoncheng avatar Nov 03 '20 01:11 dasoncheng

We met the same issue here. When the string data size is kind of large (around 30000 chars), this error would occur randomly without any ways to handle.

emowen4 avatar Nov 21 '20 14:11 emowen4