Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Subscriber fails to reconnect with "Cannot send commands in PubSub mode" #2080

Closed
tugtugtug opened this issue Apr 12, 2022 · 0 comments · Fixed by #2092
Closed

Subscriber fails to reconnect with "Cannot send commands in PubSub mode" #2080

tugtugtug opened this issue Apr 12, 2022 · 0 comments · Fixed by #2092
Labels

Comments

@tugtugtug
Copy link

We have username/password defined in options, and some scripts defined for the subscriber, and it seems after the socket is disconnected, the reconnection always fails with the following error.
My guess is one of these failed,

this.#queue.addCommand(
.

Despite the intention of the error, it seems pretty bad design to assume a server limitation on the client side. We already had to workaround this by specifying the ignorePubSubMode for pings, but it seems even the lib itself had issues dealing with this. I would suggest a global option to disable this entirely.

Error: Cannot send commands in PubSub mode
    at /test/node_modules/@node-redis/client/dist/lib/client/index.js:323:23
    at runMicrotasks (<anonymous>)
    at processTicksAndRejections (node:internal/process/task_queues:96:5)
    at async Promise.all (index 0)
    at async RedisSocket.socketInitiator (/test/node_modules/@node-redis/client/dist/lib/client/index.js:332:13)
    at async RedisSocket._RedisSocket_connect (/test/node_modules/@node-redis/client/dist/lib/client/socket.js:128:13)
    at async Commander.connect (/test/node_modules/@node-redis/client/dist/lib/client/index.js:162:9)

Environment:

  • Node.js Version: v16.14.2
  • Redis Server Version: 6.2.5
  • Node Redis Version: redis@4.0.6
  • Platform: Debian bullseye
@tugtugtug tugtugtug added the Bug label Apr 12, 2022
leibale added a commit to leibale/node-redis that referenced this issue Apr 21, 2022
leibale added a commit that referenced this issue Apr 25, 2022
* fix socket error handlers, reset parser on error

* fix #2080 - reset pubSubState on socket error

* fix pubsub

* fix "RedisSocketInitiator"
leibale added a commit that referenced this issue Apr 25, 2022
* parser

* a new RESP parser :)

* clean code

* fix simple string and bulk string cursor

* performance improvements

* change typescript compiler target

* do not use stream.Transform

* Update decoder.ts

* fix for 1d09acb

* improve integer performance

* revert 1d09acb

* improve RESP2 decoder performance

* improve performance

* improve encode performance

* remove unused import

* upgrade benchmark deps

* clean code

* fix socket error handlers, reset parser on error

* fix #2080 - reset pubSubState on socket error

* reset decoder on socket error

* fix pubsub

* fix "RedisSocketInitiator"

* fix returnStringsAsBuffers

* fix merge
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant