h0x91b / redis-fast-driver

78 stars 13 forks source link

Possible issue with auto reconnect #22

Closed HcgRandon closed 4 years ago

HcgRandon commented 6 years ago

(I knew about this before my PR, also below is a test with a version prior to my PR) If you restart the redis server the driver doesn't seem to continue to retry connecting here is a simplified example I pulled from my code:

Start redis server: docker run -d --name redis -p 6379:6379 redis:latest

Create test app:

mkdir redistest && cd redistest
yarn add redis-fast-driver@2.1.0

test.js:

'use strict';

const RedisClient = require('redis-fast-driver');

const cli = new RedisClient({
        host: '127.0.0.1',
        port: 6379,
        maxRetries: 25,
        auth: null,
        db: null,
        autoConnect: true,
        doNotRunQuitOnEnd: true,
});

cli.on('ready', () => console.log('ready'));
cli.on('reconnecting', retry => console.log('reconnecting...', retry));
cli.on('error', e => console.log(e));

run app node test.js

restart redis: docker restart redis

App Output:

$ node test.js 
ready
(docker restart executed)
Server closed the connection
reconnecting... 1
(node process exits)
h0x91b commented 6 years ago

Hi, I merged your commit and other changes and released version 2.1.1.

After a fast check for reconnection issue, I don't see a problem, please try to reproduce it on 2.1.1.

HcgRandon commented 6 years ago

Thanks, could i ask what node version u did ur check on?

h0x91b commented 6 years ago

v8.9.4 on OS X, maybe its a docker related? (I checked it without docker)

HcgRandon commented 6 years ago

Tried a few different node versions as well as without docker. Still getting this behavior if the server is away for more then a few secs when restarting it. It does work however if the server is restarted instantly after it goes away.

I will try to get more concrete details and examples later.

Seeing issue on: Linux (Debian), tested with node v8.9.4 & v9.11.1

EDIT: I will be able to test this more later today (05/02/18) or the day after.

HcgRandon commented 6 years ago

Sorry, got preoccupied by life and other projets. But now I'm back to this. Yeah this is def still an issue. At least everywhere I test it, (I have only tested on linux machines)

You can repo this behavior, by simply running the above test.js and killing off the redis server in any way, even if it is outside of docker. Auto reconnect simply never kicks in.

@h0x91b If you like we could do some sort of call, maybe on Discord? And I could show you the exact behavior I'm seeing.

h0x91b commented 6 years ago

Hi, please make sure that you checked 2.1.2 version.

If it doesn't work I can do a call, my timezone is UTC+2 (10:35 am right now).

I can do a call after 19 UTC+2.

HcgRandon commented 6 years ago

Hi can confirm I'm on latest version. I am off work tomorrow so let's do a call sometime then. I am on EDT time. Add me on discord, my username is: HcgRandon#0001

On Tue, May 29, 2018, 03:35 Arseniy Pavlenko notifications@github.com wrote:

Hi, please make sure that you checked 2.1.2 version.

If it doesn't work I can do a call, my timezone is UTC+2 (10:35 am right now).

I can do a call after 19 UTC+2.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/h0x91b/redis-fast-driver/issues/22#issuecomment-392681047, or mute the thread https://github.com/notifications/unsubscribe-auth/AF1uf8sTeGOrDxqhfuVitjkIqQ7rXmJLks5t3PowgaJpZM4Ttn3B .

HcgRandon commented 6 years ago

I keep spacing this. I get a ton of friend requests on discord so please let me know who you are. If you need to get in a server with me so you can DM me feel free to join my bot guild https://ayana.io/community again sorry for delay