Skip to content

redis create too many fd on one of node in cluster #2098

Open

Description

@jomolangma

I use redis 3.0 RC1 which run on CentOS, there are 6 nodes in my cluster(node1...node6), in initial, there are 20 fds on all nodes, when I run my program (use JedisCluster), there are 71 fds on all nodes,which is right, for there are 51 redis clients in my program, then when run the program several hours later, the fds on one of my nodes is 10127 (other nodes still 71)which will cause my program get the error (CLUSTERDOWN), and I know this is caused by connection(connection reset by peer), then I try to increase the client count with the command:
config set maxclients 15000
about 20 seconds later, the count of fd on this node is 15131, my program still can't connect to redis. If I still increase the maxclients, then after several minutes later, more fds created.

[user01@i-18-212-VM fd]$ ll /proc/5510/fd
............................................................................................................
l-wx------ 1 user01 users 64 Oct 24 10:08 15130 -> pipe:[22194086]
lr-x------ 1 user01 users 64 Oct 24 10:08 15129 -> pipe:[22194086]
l-wx------ 1 user01 users 64 Oct 24 10:08 15128 -> pipe:[22194085]
lr-x------ 1 user01 users 64 Oct 24 10:08 15127 -> pipe:[22194085]
l-wx------ 1 user01 users 64 Oct 24 10:08 15126 -> pipe:[22194084]
lr-x------ 1 user01 users 64 Oct 24 10:08 15125 -> pipe:[22194084]

when this happen, I also can't connect to redis with redis-cli (Connection reset by peer), I had to kill the redis node and restart this node

if need more info, please contact me.

use command "sudo ls /proc/5510/fd | wc -l" to get the fd count, 5510 the PID of redis node.

My redis.conf:
port 6379
cluster-enabled yes
cluster-config-file nodes.conf
cluster-node-timeout 15000
appendonly yes
appendfsync no
auto-aof-rewrite-percentage 100
auto-aof-rewrite-min-size 1024mb
timeout 600

Activity

  1. changed the title [-]redis create many many fd in one of node in cluster[/-] [+]redis create too many fd on one of node in cluster[/+] on Oct 24, 2014
  2. jomolangma commented on Oct 24, 2014

    @jomolangma
    Author

    and i found that when if the node have lots of fds, then the aof file is more more bigger than others, the normal node's aof file is about 6G, but collapse nodes's aof file is about 20G

    when I restart the node and run BGREWRITEAOF command, receive (error) ERR, and this command will increate 6 fds

    [user01@i-18-210-VM ~]$ sudo ls /proc/12609/fd | wc -l
    116
    [user01@i-18-210-VM ~]$ cd /data/redis/
    [user01@i-18-210-VM redis]$ ./redis-cli -c
    127.0.0.1:6379> bgrewriteaof
    (error) ERR
    127.0.0.1:6379> exit
    [user01@i-18-210-VM redis]$ sudo ls /proc/12609/fd | wc -l
    122

  3. mattsta commented on Oct 24, 2014

    @mattsta
    Contributor

    Keep using your first command to check the purpose of all the fds:

    ll /proc/[PID]/fd/

    You can even try this to see all your redis connections:

    sudo netstat -nape |grep redis-

    Notice how all the additional fds are just socket connections used by your clients.

    Any problem with resources running out or files growing too big is because your Redis clients are connecting too much (without closing their connections) and/or writing a lot of data.

  4. jomolangma commented on Oct 24, 2014

    @jomolangma
    Author

    Hi, I run the command sudo sysctl vm.overcommit_memory=1 to solve the problem, but there are still questions, when fail to run command bgrewriteaof, why the redis increate 6 fds?

    when trigger to rewrite aof, but failed, then it will continue to trigger to rewrite the aof, then lots of fds created.

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