Crash for "Failed TCP accept: too many open files"

I have installed ejabberd 17.06 over Red Hat Enterprise Linux Server release 7.3 (Maipo) with 20GB of HDD and 4GB of RAM
This ejabberd is only used for around 20 users now.

I have a problem. The process "/opt/ejabberd-17.06/bin/beam.smp -K true -P 250000........" has around 80 open files when it starts. If one user log in Jabber, open files increased at 1, and if one user log out, open files decreased at 1. This is normal.

The problem is that anything at server is increasing the open files for the beam.smp process, apart of the login/logout from users.

The ulimit values is 1024 for open files

Many days after the process starts, open files is going to increase until create an error when exceed 1024 open files.
Then, we have this at log:

2017-11-06 21:26:03.322 [error] <0.338.0>@ejabberd_listener:accept:309 (#Port<0.17979>) Failed TCP accept: too many open files

If you check the open files of beam.smp while the error time, is over 1024

If you restart ejabberd, the open files value decreased totally to around 80 again, and after a few days, the problem appears again.

I have config to debug the ejabberd logs, but I don't see useful information of this problem.

It's strange. Is there any

It's strange. Is there any clue in the result of lsof? in my test server with just one client connected:

$ lsof -p 1583 | wc -l
78

$ lsof -p 1583
...
beam.smp 1583 bernar  mem       REG                8,7    14608  253085 /lib/x86_64-linux-gnu/libdl-2.24.so
beam.smp 1583 bernar  mem       REG                8,7   162608  253078 /lib/x86_64-linux-gnu/ld-2.24.so
...
beam.smp 1583 bernar   35u      REG                8,7     7404  791648 /usr/local/var/lib/ejabberd/passwd.DAT
beam.smp 1583 bernar   36u      REG                8,7    14255  791658 /usr/local/var/lib/ejabberd/privacy.DAT
beam.smp 1583 bernar   37u      REG                8,7     5464  791652 /usr/local/var/lib/ejabberd/private_storage.DAT
beam.smp 1583 bernar   38u      REG                8,7     5464  791700 /usr/local/var/lib/ejabberd/pubsub_item.DAT
beam.smp 1583 bernar   39u      REG                8,7     5464  791667 /usr/local/var/lib/ejabberd/roster_version.DAT
beam.smp 1583 bernar   40u      REG                8,7     5464  791590 /usr/local/var/lib/ejabberd/pubsub_item_3.DAT
beam.smp 1583 bernar   41u      REG                8,7     5464  791656 /usr/local/var/lib/ejabberd/push_session.DAT
beam.smp 1583 bernar   42u      REG                8,7     5464  791685 /usr/local/var/lib/ejabberd/vcard.DAT
beam.smp 1583 bernar   43u     IPv6            1335239      0t0     TCP *:xmpp-client (LISTEN)
beam.smp 1583 bernar   44u     IPv6            1335240      0t0     TCP *:xmpp-server (LISTEN)
beam.smp 1583 bernar   45u     IPv6            1335241      0t0     TCP *:5280 (LISTEN)
beam.smp 1583 bernar   46u     IPv6            1517431      0t0     TCP localhost:xmpp-client->localhost:39025 (ESTABLISHED)
Syndicate content