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

Command queue state error: parsing "NaN": invalid syntax #1920

Open
steamwings opened this issue Oct 8, 2024 · 1 comment
Open

Command queue state error: parsing "NaN": invalid syntax #1920

steamwings opened this issue Oct 8, 2024 · 1 comment

Comments

@steamwings
Copy link

steamwings commented Oct 8, 2024

Running into this trying to deploy a Mastodon server.

The error

Redis Client Error! Error: Command queue state error. If you can reproduce this, please report it. Last reply: OK
    at DataHandler.shiftCommand (/opt/mastodon/node_modules/ioredis/built/DataHandler.js:173:27)
    at DataHandler.returnReply (/opt/mastodon/node_modules/ioredis/built/DataHandler.js:50:27)
    at JavascriptRedisParser.returnReply (/opt/mastodon/node_modules/ioredis/built/DataHandler.js:21:22)
    at JavascriptRedisParser.execute (/opt/mastodon/node_modules/redis-parser/lib/parser.js:544:14)
    at Socket.<anonymous> (/opt/mastodon/node_modules/ioredis/built/DataHandler.js:25:20)
    at Socket.emit (node:events:514:28)
    at Socket.emit (node:domain:552:15)
    at addChunk (node:internal/streams/readable:343:12)
    at readableAddChunk (node:internal/streams/readable:316:9)
    at Readable.push (node:internal/streams/readable:253:10)
Uncaught ReplyError: strconv.Atoi: parsing "NaN": invalid syntax
    at parseError (/opt/mastodon/node_modules/redis-parser/lib/parser.js:179:12)
    at parseType (/opt/mastodon/node_modules/redis-parser/lib/parser.js:302:14) {
  command: { name: 'select', args: [ 'NaN' ] }

Seems like it may be an issue with redis-parser? Please let me know if other context would be useful.

EDIT: After setting showFriendlyErrorStack: true, the last bit looks different:

Uncaught ReplyError: strconv.Atoi: parsing "NaN": invalid syntax
    at tryCatcher (/opt/mastodon/node_modules/standard-as-callback/built/utils.js:12:23)
    at /opt/mastodon/node_modules/standard-as-callback/built/index.js:22:53
    at process.processTicksAndRejections (node:internal/process/task_queues:95:5) {
  command: { name: 'select', args: [ 'NaN' ] }

EDIT 2:

Here's a snippet of the code context. You can see the source here. I think the only important context here is that nothing has been done with the Redis instance except to create it.

  const createRedisClient = async (config) => {
    const { redisParams, redisUrl } = config;
    const client = new Redis(redisUrl, redisParams);
    client.on('error', (err) => log.error('Redis Client Error!', err));
    return client;
  };
  ...
  const redisSubscribeClient = await createRedisClient(redisConfig);

EDIT 3: This looks suspicious

EDIT 4:
Here's the additional output from starting node with DEBUG=ioredis:*

ioredis:redis status[<ip>]: connecting -> connect +27ms
  ioredis:redis write command[<ip>]: NaN -> auth([ 'default', '<oopshadtoresetthispassword>' ]) +1ms
  ioredis:redis write command[<ip>]: NaN -> info([]) +3ms
  ioredis:redis status[<ip>]: connect -> ready +14ms
  ioredis:connection connect to db [NaN] +0ms
  ioredis:redis write command[<ip>]: NaN -> select([ 'NaN' ]) +0ms
@steamwings
Copy link
Author

Looks like my issue was caused by passing db: 'default' in the config. The issue resolved when I passed 0 for db instead.

Still, this should probably be fixed, so I'll leave this open.

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

No branches or pull requests

1 participant