WARNING: Max 1024 open files allowed, minimum of 40000 recommended. See the Neo4j manual

I got the error in object when I bin/neo4j start.

neo4j@neo4j:/neo4j/neo4j-community-3.5.0$ bin/neo4j start
Active database: graph.db
Directories in use:
  home:         /neo4j/neo4j-community-3.5.0
  config:       /neo4j/neo4j-community-3.5.0/conf
  logs:         /neo4j/neo4j-community-3.5.0/logs
  plugins:      /neo4j/neo4j-community-3.5.0/plugins
  import:       /neo4j/neo4j-community-3.5.0/import
  data:         /neo4j/neo4j-community-3.5.0/data
  certificates: /neo4j/neo4j-community-3.5.0/certificates
  run:          /neo4j/neo4j-community-3.5.0/run
Starting Neo4j.
WARNING: Max 1024 open files allowed, minimum of 40000 recommended. See the Neo4j manual.
Started neo4j (pid 17466). It is available at http://0.0.0.0:7474/
There may be a short delay until the server is ready.
See /neo4j/neo4j-community-3.5.0/logs/neo4j.log for current status.

I added the following lines in /etc/security/limits.conf

neo4j soft nofile 40000
neo4j hard nofile 40000
root soft nofile 40000
root hard nofile 40000

but the error persists. I also tried an alternate way, adding NEO4J_ULIMIT_NOFILE=60000 to /etc/default/neo4j with no success.

Please, note that the error is only on the console output but NOT into the neo4j.log!
Maybe it's not an error anymore?

Can anyone provide a good answer for v3.5.0?

My config is:

  • Ubuntu server 18.04.01
  • Neo 3.5.0 Community, Browser 3.2.13
1 Like

In Ubuntu you put your settings in /etc/security/limits.d/neo4j.conf instead.

No Stefan. I used your suggestion but the error persists.

Try with these file contents:

* soft nofile 40000
* hard nofile 40000

And be sure to reboot the machine afterwards. I'm not aware of a way to apply this config change otherwise.

Hi Stefan,

Sorry but neither this approach runs.

Is there a way to check the effective value into the running OS after neo4j is started?

This is because The message is not present into the log,and in this moment, all the different alternatives are loaded together!!!!

Iā€™m available to test everything necessary to solve the problem, but I need inputs :slightly_smiling_face::slightly_smiling_face::slightly_smiling_face:

check what ulimit -n spits out. Try with root user and the uid used for running neo4j - most likely there's a neo4j user for this.

For the people landing here by Google (because it's one of the most highly ranked page), see the content of modern /etc/default/neo4j:

It is NOT used for the new systemd service.
To change these values with systemd, please use

systemctl edit neo4j.service

Most of the modern Linux distro do use systemcd

(including the above mentionned Ubuntu 18.04 - save for a few exceptions such as Gentoo's OpenRC)
You need instead to add the file limit options in /etc/systemd/system/neo4j.service.d/override.conf using the above command.

The neo4j 3.5.0 service on CentOS seems to have an increased limit configured by default:

[Service]
ExecStart=/usr/share/neo4j/bin/neo4j console
Restart=on-failure
User=neo4j
Group=neo4j
Environment="NEO4J_CONF=/etc/neo4j" "NEO4J_HOME=/var/lib/neo4j"
LimitNOFILE=60000
TimeoutSec=120

Correspondingly, Neo4j service doesn't warn about this in my logs. However, neo4j-admin memrec does. That looks to me as a false alarm.

1 Like

Managed to solve?
I really have a problem with this OS.

thanks!

if you're running neo4j using docker-compose, just add these lines to your neo4j service in docker-compose.yml file.
ulimits:
nofile:
soft: "40000"
hard: "40000"

2 Likes

I'm using neo4j database for more than 1 year. Everytime I start server, I see this warning. How can I solve this? I'm using neo4j in ubuntu and also in windows machines

So what's the verdict here on the right setting? Does /lib/systemd/system/neo4j.service on Debian have the right setting with LimitNOFILE=60000? I still see the error message when running neo4j-admin memrec. Or should perhaps this line:

Environment="NEO4J_CONF=/etc/neo4j" "NEO4J_HOME=/var/lib/neo4j"

have "NEO4J_ULIMIT_NOFILE=60000" added to it?

I opened this thread on 2018.
It is interesting to see the nothing has changed: I just install a freshly copy of neo4j and the error persists.

I thing unfairy that nobody in neo4j is able to spend some time to give a 'precise' and 'definitive' response to this query.

I ran into this today and I didn't want to run the server as a service, at least not yet. I already had the entry in /etc/security/limits.conf for nofiles, but it didn't take effect.
Looking at Number of open files - Knowledge Base I added two files:
/etc/pam.d/common-session and /etc/pam.d/common-session-noninteractive with the following line:

session required pam_limits.so

After su'ing back to my user, ulimit -n confirmed that it worked.