İnitial sync failed because of Too many open files

I have 3 node replica. One of them has crashed. Start to initial sync by deleting data directory. After 7-8 hours later primary mongo was restarted because of Too many open files.

Two times initial sync failed. Is there a solution ? How many limit should I set ?

{"t":{"$date":"2023-06-10T13:33:05.288+00:00"},"s":"I", "c":"CONNPOOL", "id":22572, "ctx":"MirrorMaestro","msg":"Dropping all pooled connections","attr":{"hostAndPort":"11.1.1.1:27017","error":"HostUnreachable: Error connecting to 11.1.1.1:27017 :: caused by :: Too many open files"}}

ulimits;

core file size          (blocks, -c) unlimited
data seg size           (kbytes, -d) unlimited
scheduling priority             (-e) 0
file size               (blocks, -f) unlimited
pending signals                 (-i) 337612
max locked memory       (kbytes, -l) unlimited
max memory size         (kbytes, -m) unlimited
open files                      (-n) 200000
pipe size            (512 bytes, -p) 8
POSIX message queues     (bytes, -q) 819200
real-time priority              (-r) 0
stack size              (kbytes, -s) 8192
cpu time               (seconds, -t) unlimited
max user processes              (-u) 200000
virtual memory          (kbytes, -v) unlimited
file locks                      (-x) unlimited

Hi @Yunus_Dal,

recommended settings are:

  • 64000 for open files (option -n) and
  • 64000 for processes (option -u)

As mentioned from documentazione:

1 Like

I have tried to set 64K but it is not work. if I set 64K, primary mongodb reach this limit in a hour and fire Too Many Open Files error.

Hi @Yunus_Dal ,
Check that indeed the values are set correctly, under /proc/pid_process_mongo/limits.

BR

What are these? 200,000 is already larger than recommended value (65535) for both open file and max user processes.

I increased limit. İt worked.

core file size (blocks, -c) unlimited
data seg size (kbytes, -d) unlimited
scheduling priority (-e) 0
file size (blocks, -f) unlimited
pending signals (-i) 337612
max locked memory (kbytes, -l) unlimited
max memory size (kbytes, -m) unlimited
open files (-n) 900000
pipe size (512 bytes, -p) 8
POSIX message queues (bytes, -q) 819200
real-time priority (-r) 0
stack size (kbytes, -s) 8192
cpu time (seconds, -t) unlimited
max user processes (-u) 900000
virtual memory (kbytes, -v) unlimited
file locks (-x) unlimited

1 Like

This topic was automatically closed 5 days after the last reply. New replies are no longer allowed.