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
Hey all -- I'm not sure if this is a bug or just some "how do I redis" questions -- if there's a better place for this please let me know.
We have some old redis code that uses the callback APIs that we want to keep running by using legacy mode. However, when we run our code (that's shaped a bit like this simplified example)
var redis = require('redis')
var client = redis.createClient({
port: '6379',
host: process.env.REDIS_HOST,
legacyMode: true
})
client.on('error', err => console.log('client error', err));
client.on('connect', () => console.log('client is connect'));
client.on('reconnecting', () => console.log('client is reconnecting'));
client.on('ready', () => console.log('client is ready'));
client.connect()
client.flushall(function (err, reply) {
client.set('key', 'value', function (err, replies) {
console.log("key set done")
client.quit()
})
})
console.log("main done")
we end up with a new SocketClosedUnexpectedlyError error, and then the program hangs without exiting
% node working.js
main done
client is connect
client is ready
key set done
client error SocketClosedUnexpectedlyError: Socket closed unexpectedly
at Socket.<anonymous> (/Users/astorm/Documents/redis4/node_modules/@redis/client/dist/lib/client/socket.js:182:118)
at Object.onceWrapper (events.js:422:26)
at Socket.emit (events.js:315:20)
at TCP.<anonymous> (net.js:673:12)
client is reconnecting
client is connect
client is ready
// program hangs
With [email protected] this program runs (minus the client.connect()) without issue and exits with a status code of zero (the real program we have is more complicated, this is the simplified example of the behavior we're seeing)
Is there any known issue what would lead to this sort of calling pattern producing a SocketClosedUnexpectedlyError error?
Do you have any theories on why the program just hangs at the end? (I'd presume a client that's waiting to disconnect)
Is there a way to tell the client is should not automatically reconnect when this sort of error happens?
Environment:
Node.js Version: v14.16.1 and v18.4.0
Redis Server Version: 7.0.5 (docker redis:latest)
Node Redis Version: 4.3.1
Platform: Docker Desktop on MacOS 10.15.7
The text was updated successfully, but these errors were encountered:
Hey all -- I'm not sure if this is a bug or just some "how do I redis" questions -- if there's a better place for this please let me know.
We have some old redis code that uses the callback APIs that we want to keep running by using legacy mode. However, when we run our code (that's shaped a bit like this simplified example)
we end up with a new
SocketClosedUnexpectedlyError
error, and then the program hangs without exitingWith [email protected] this program runs (minus the
client.connect()
) without issue and exits with a status code of zero (the real program we have is more complicated, this is the simplified example of the behavior we're seeing)Is there any known issue what would lead to this sort of calling pattern producing a
SocketClosedUnexpectedlyError
error?Do you have any theories on why the program just hangs at the end? (I'd presume a client that's waiting to disconnect)
Is there a way to tell the client is should not automatically reconnect when this sort of error happens?
Environment:
The text was updated successfully, but these errors were encountered: