Skip to content

Redis Server Crash reconnect error? #24

Closed

Description

@mllongze

Hello @LewisJEllis 👽

test the code below to my local project

 var job = queue.createJob({name: "test"}).save();
        job.on('succeeded', function (result) {
            console.log('Received result for job ' + job.id + ': result : ' + JSON.stringify(result));
        })
        queue.on('error', function (err) {
            console.log("queue all error show -- ", err);
        });
        queue.process(function (job, done) {
            //do ... ing
            return done(null, job.data);
        });

stop redis server

Error: Redis connection to 127.0.0.1:6379 failed - connect ECONNREFUSED

restart redis server

execute code again

/Users/xxxx/node-project/socket/node_modules/bee-queue/node_modules/redis/index.js:578
                throw callback_err;
                      ^
Error: NOSCRIPT No matching script. Please use EVAL.
    at ReplyParser.<anonymous> (/Users/xxxx/node-project/socket/node_modules/bee-queue/node_modules/redis/index.js:320:31)
    at ReplyParser.emit (events.js:107:17)
    at ReplyParser.send_error (/Users/xxx/node-project/socket/node_modules/bee-queue/node_modules/redis/lib/parser/javascript.js:298:10)
    at ReplyParser.execute (/Users/xxxx/node-project/socket/node_modules/bee-queue/node_modules/redis/lib/parser/javascript.js:183:22)
    at RedisClient.on_data (/Users/xxxx/node-project/socket/node_modules/bee-queue/node_modules/redis/index.js:550:27)
    at Socket.<anonymous> (/Users/xxxx/node-project/socket/node_modules/bee-queue/node_modules/redis/index.js:105:14)
    at Socket.emit (events.js:107:17)
    at readableAddChunk (_stream_readable.js:163:16)
    at Socket.Readable.push (_stream_readable.js:126:10)
    at TCP.onread (net.js:538:20)

Activity

  1. mllongze commented on Nov 25, 2015

    @mllongze
    Author

    Hi @LewisJEllis

    I think i find the question!

    because client.evalsha is rebuild cache when redis server restart.

    so i fixed it. add [flushCache, buildCache] on client "ready"。

    the flushCache only like this

    delete cachedServers[serverKey]; 

    I don't know this change will not have a problem!

  2. LewisJEllis commented on Nov 25, 2015

    @LewisJEllis
    Member

    Oh, hmm. I know restarting Redis clears the script cache, which we depend on having populated on bee-queue startup. I suppose if we just clear it on a restart then bee-queue will repopulate the cache.

  3. LewisJEllis commented on Nov 25, 2015

    @LewisJEllis
    Member

    Oh, yep, roughly that is exactly the fix I was just describing. If you want to send a PR, I'll verify it and publish a new version to npm.

  4. mllongze commented on Nov 25, 2015

    @mllongze
    Author

    @LewisJEllis
    Thank you for your answer.
    I looking forward for you add cluster.
    I will always focus on the project. 😃

  5. davisford commented on Dec 8, 2015

    @davisford

    I'm seeing the same problem on localhost redis 3.0.3. I am working on migrating some code from kue to bee-queue, and when I start the app up, I hit this exact exception. I get that the EVALSHA command will fail with this error if the script's shasum doesn't already exist in redis' cache, but then the client is supposed to turn around and do EVAL with the script source, right? So, why am I hitting this on a first time execution where I've never used bee-queue before? The scripts obviously would not be cached, so I would expect it to recover from this and push them to the server, right?

    I'm not sure I follow the recommended fix above -- can someone clarify?

    Ah, ok, I see @mllongze provided his own forked fix here -- any chance you can submit that PR here, or @LewisJEllis can you provide a fix and repub to npm?

  6. LewisJEllis commented on Dec 8, 2015

    @LewisJEllis
    Member

    Yes, I can do that fix and publish a new version to npm tonight. I originally wanted to give @mllongze time to send a PR since he originally found the fix, but it's been long enough.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions