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

Not working keepalive option in Podman container #1319

Closed
LeeDongGeon1996 opened this issue Mar 31, 2021 · 1 comment
Closed

Not working keepalive option in Podman container #1319

LeeDongGeon1996 opened this issue Mar 31, 2021 · 1 comment

Comments

@LeeDongGeon1996
Copy link

LeeDongGeon1996 commented Mar 31, 2021

I'm running Redis(v=6.0.10) in the container with official container image using Podman(v.2.5).
And I'm trying to connect Redis server to my Node application with ioredis .
The configuration in my app is like the below:

    private static readonly redisConfig: ioRedis.RedisOptions = {
      connectionName: "Server Application",
      host: process.env.DB_HOST,
      port: Number(process.env.REDIS_PORT),
      password: process.env.REDIS_PASSWORD,
      retryStrategy: (times) => {
        console.log("Redis connection is lost with somehow reason.");
        console.log("attempt: " + times);
        if (times > 5) {
          return undefined;
        }
  
        return Math.min(times * 500, 2000);
      },
      keepAlive:100,
    };

But it looks like keepAlive doesn't work.

When I tried CLIENT LIST command at redis-cli inside the Redis container:

id=13 addr=<MY_IP_ADDRESS>:54984 fd=10 name= age=772 idle=772 flags=N db=0 sub=0 psub=0 multi=-1 qbuf=0 qbuf-free=0 argv-mem=0 obl=0 oll=0 omem=0 tot-mem=20512 events=r cmd=client user=default
id=15 addr=127.0.0.1:56604 fd=9 name= age=12 idle=0 flags=N db=0 sub=0 psub=0 multi=-1 qbuf=26 qbuf-free=32742 argv-mem=10 obl=0 oll=0 omem=0 tot-mem=61466 events=r cmd=client user=default

The first one is the client from my Node application. You can see the port is 54984.

Now, It is the result of sudo netstat -napo | grep 6379:

tcp        0      0 0.0.0.0:6379            0.0.0.0:*               LISTEN      306194/conmon        off (0.00/0/0)
tcp        0      0 10.0.0.4:54984          <MY_IP_ADDRESS>:6379      ESTABLISHED 307509/node          keepalive (7126.59/0/0)

You can see that keepalive time is set to almost 7200 sec.
So I set tcp-keepalive, which is Redis configuration var, to "1" by myself.

Now then, ioredis reconnects the client...
Is there something wrong I did in ioredis config?

@LeeDongGeon1996 LeeDongGeon1996 changed the title Not working keepalive option in Podman container Not working keepalive option in Podman container Mar 31, 2021
@marcbachmann
Copy link
Collaborator

Thanks for reporting this.
The cause for that issue is most likely nodejs/node#31663
There's another issue here with a reproduction: #1339
I'll close this for now.

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

2 participants