You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The queue only saves jobs to Redis when I create a brand new connection using the queue connection parameters (but using an existing redisClient doesn't work). My redisClient works, as I can pull data from Redis normally, it's only the queue that is not able to save jobs on Redis when using my own redisClient.
I know in your sample you were using various options on both the Redis client and the queue/job, but those should be largely inconsequential here so I pared it down to just the core of sharing connections and enqueuing/processing jobs. If you find that some particular option or pattern causes trouble, let me know and I can take a closer look.
Hello @skeggse ! Before all, thanks for the good work <3
I'm having similar issue, it already happened that the server lost connection to Redis, which caused server crash & reboot, and in between, loosing some events that were not pushed into the queue. I tried the retry_strategy and when I simulate the deconnect / reconnect to Redis, I have
"ReplyError: NOSCRIPT No matching script. Please use EVAL." when new events are pushed to the queue. I read about this in other issues but it should've been fixed, so I'm not sure why I'm getting this?
Sounds like you have the makings of a test-case? Would you be open to making a PR with a test that demonstrates this functionality? I can take a look, but it'd be much easier if I can just npm test and see the test failure :)
@skeggse Yeah I understand, not really practical for me neither as you have to manually restart your redis in local environment to reproduce the error...
But I think I found a workaround (or maybe I should've done it this way from the beginning...):
You'll definitely want to avoid re-creating the queue. This:
you have to manually restart your redis in local environment to reproduce the error...
Is new information, and makes sense - SCRIPT LOAD does not load scripts into some persistent storage on Redis' side. When Redis restarts, it the scripts won't be loaded, and bee-queue doesn't know that the server reloaded.
@LewisJEllis: I know we're moving to ioredis; would it be easy to listen to a reconnect event, check the Server/run_id value (or check for scripts being loaded), and reload the scripts if necessary? (I'm mostly not familiar with ioredis' events)
Alright, so now it's working good after reconnect, but I'm still getting errors for jobs that were added during the connection loss... I'm not sure what to do in such case.
Activity
LewisJEllis commentedon May 22, 2018
Thanks for the report and snippet. I investigated a bit and I am not able to reproduce. Can you try the below snippet and let me know how it behaves:
This works for me as I would expect and after 2.01 seconds has printed:
I know in your sample you were using various options on both the Redis client and the queue/job, but those should be largely inconsequential here so I pared it down to just the core of sharing connections and enqueuing/processing jobs. If you find that some particular option or pattern causes trouble, let me know and I can take a closer look.
skeggse commentedon Jul 10, 2018
Closing due to inactivity. Feel free to reopen.
alexisohayon commentedon Aug 13, 2018
Hello @skeggse ! Before all, thanks for the good work <3
I'm having similar issue, it already happened that the server lost connection to Redis, which caused server crash & reboot, and in between, loosing some events that were not pushed into the queue. I tried the retry_strategy and when I simulate the deconnect / reconnect to Redis, I have
"ReplyError: NOSCRIPT No matching script. Please use EVAL." when new events are pushed to the queue. I read about this in other issues but it should've been fixed, so I'm not sure why I'm getting this?
thanks!
skeggse commentedon Aug 13, 2018
Sounds like you have the makings of a test-case? Would you be open to making a PR with a test that demonstrates this functionality? I can take a look, but it'd be much easier if I can just
npm testand see the test failure :)alexisohayon commentedon Aug 13, 2018
@skeggse Yeah I understand, not really practical for me neither as you have to manually restart your redis in local environment to reproduce the error...
But I think I found a workaround (or maybe I should've done it this way from the beginning...):
(from an external module)
(from the endpoint that needs to add the job)
So like this, it seems to be working but I'm not sure if it's a good idea to "recreate" the queue at each call. Wdyt?
Thanks again :)
skeggse commentedon Aug 13, 2018
You'll definitely want to avoid re-creating the queue. This:
Is new information, and makes sense -
SCRIPT LOADdoes not load scripts into some persistent storage on Redis' side. When Redis restarts, it the scripts won't be loaded, and bee-queue doesn't know that the server reloaded.@LewisJEllis: I know we're moving to
ioredis; would it be easy to listen to areconnectevent, check theServer/run_idvalue (or check for scripts being loaded), and reload the scripts if necessary? (I'm mostly not familiar withioredis' events)alexisohayon commentedon Aug 13, 2018
I see :/ Any way to reload the script directly in the retry_strategy, when redis reconnects?
skeggse commentedon Aug 13, 2018
You could maybe do something like
This will check whether each script exists, and if it doesn't, it'll load it.
alexisohayon commentedon Aug 13, 2018
Nice! Gonna try this right now :)
alexisohayon commentedon Aug 13, 2018
Alright, so now it's working good after reconnect, but I'm still getting errors for jobs that were added during the connection loss... I'm not sure what to do in such case.