Skip to content

Got an unexpected reply from Redis on unsubscribing from multiple channels at once #2052

@mifopen

Description

@mifopen

I have a very simple script:

const sub = createClient();
function handler(...args) {
    console.log(...args);
}
await sub.subscribe(['some1', 'some2'], handler);
setTimeout(() => {
    sub.unsubscribe(['some1', 'some2'], handler);
}, 5000);

And after 5sec it crashes with the following stacktrace:

/Users/mif/Documents/GitHub/uify/apps/frontend/src/node_modules/@node-redis/client/dist/lib/client/commands-queue.js:285
        throw new Error('Got an unexpected reply from Redis');
              ^
Error: Got an unexpected reply from Redis
    at RedisCommandsQueue._RedisCommandsQueue_shiftWaitingForReply (/Users/mif/Documents/GitHub/uify/apps/frontend/src/node_modules/@node-redis/client/dist/lib/client/commands-queue.js:285:15)
    at JavascriptRedisParser.returnReply (/Users/mif/Documents/GitHub/uify/apps/frontend/src/node_modules/@node-redis/client/dist/lib/client/commands-queue.js:58:124)
    at JavascriptRedisParser.execute (/Users/mif/Documents/GitHub/uify/apps/frontend/src/node_modules/redis-parser/lib/parser.js:544:14)
    at RedisCommandsQueue.parseResponse (/Users/mif/Documents/GitHub/uify/apps/frontend/src/node_modules/@node-redis/client/dist/lib/client/commands-queue.js:194:71)
    at RedisSocket.<anonymous> (/Users/mif/Documents/GitHub/uify/apps/frontend/src/node_modules/@node-redis/client/dist/lib/client/index.js:336:83)
    at RedisSocket.emit (node:events:527:28)
    at RedisSocket.emit (node:domain:475:12)
    at Socket.<anonymous> (/Users/mif/Documents/GitHub/uify/apps/frontend/src/node_modules/@node-redis/client/dist/lib/client/socket.js:189:44)
    at Socket.emit (node:events:527:28)
    at Socket.emit (node:domain:475:12)
    at addChunk (node:internal/streams/readable:324:12)
    at readableAddChunk (node:internal/streams/readable:297:9)
    at Socket.Readable.push (node:internal/streams/readable:234:10)
    at TCP.onStreamRead (node:internal/stream_base_commons:190:23)

Environment:

  • Node.js Version: 17.6.0
  • Redis Server Version: Redis server v=6.2.6 sha=00000000:0 malloc=libc bits=64 build=f91e6fead97295d3
  • Node Redis Version: 4.0.4
  • Platform: Mac OS 12.2.1 (21D62)

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions