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

**URL:** <https://community.neo4j.com/t/warning-max-1024-open-files-allowed-minimum-of-40000-recommended-see-the-neo4j-manual/3679>\
**Category:** Installation\
**Created:** [December 6, 2018, 6:32pm UTC](https://community.neo4j.com/t/warning-max-1024-open-files-allowed-minimum-of-40000-recommended-see-the-neo4j-manual/3679 "2018-12-06T18:32:23Z")\
**Posts on this page:** 14\
**Page:** 1

<div class="post-metadata">

**Author:** ![paolodipietro58](https://sea1.discourse-cdn.com/flex021/user_avatar/community.neo4j.com/paolodipietro58/32/21045_2.png) [@paolodipietro58](https://community.neo4j.com/u/paolodipietro58)\
**Post date:** [December 6, 2018, 6:32pm UTC](https://community.neo4j.com/t/warning-max-1024-open-files-allowed-minimum-of-40000-recommended-see-the-neo4j-manual/3679/1 "2018-12-06T18:32:23Z")

</div>

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

```auto
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

```auto
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

---

<div class="post-metadata">

**Author:** ![stefan.armbruster](https://sea1.discourse-cdn.com/flex021/user_avatar/community.neo4j.com/stefan.armbruster/32/74_2.png) [@stefan.armbruster](https://community.neo4j.com/u/stefan.armbruster)\
**Post date:** [December 7, 2018, 9:21am UTC](https://community.neo4j.com/t/warning-max-1024-open-files-allowed-minimum-of-40000-recommended-see-the-neo4j-manual/3679/2 "2018-12-07T09:21:04Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![paolodipietro58](https://sea1.discourse-cdn.com/flex021/user_avatar/community.neo4j.com/paolodipietro58/32/21045_2.png) [@paolodipietro58](https://community.neo4j.com/u/paolodipietro58)\
**Post date:** [December 7, 2018, 11:59am UTC](https://community.neo4j.com/t/warning-max-1024-open-files-allowed-minimum-of-40000-recommended-see-the-neo4j-manual/3679/3 "2018-12-07T11:59:27Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![stefan.armbruster](https://sea1.discourse-cdn.com/flex021/user_avatar/community.neo4j.com/stefan.armbruster/32/74_2.png) [@stefan.armbruster](https://community.neo4j.com/u/stefan.armbruster)\
**Post date:** [December 7, 2018, 3:39pm UTC](https://community.neo4j.com/t/warning-max-1024-open-files-allowed-minimum-of-40000-recommended-see-the-neo4j-manual/3679/4 "2018-12-07T15:39:34Z")

</div>

Try with these file contents:

```auto
* 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.

---

<div class="post-metadata">

**Author:** ![paolodipietro58](https://sea1.discourse-cdn.com/flex021/user_avatar/community.neo4j.com/paolodipietro58/32/21045_2.png) [@paolodipietro58](https://community.neo4j.com/u/paolodipietro58)\
**Post date:** [December 8, 2018, 6:56pm UTC](https://community.neo4j.com/t/warning-max-1024-open-files-allowed-minimum-of-40000-recommended-see-the-neo4j-manual/3679/5 "2018-12-08T18:56:09Z")

</div>

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 🙂🙂🙂

---

<div class="post-metadata">

**Author:** ![stefan.armbruster](https://sea1.discourse-cdn.com/flex021/user_avatar/community.neo4j.com/stefan.armbruster/32/74_2.png) [@stefan.armbruster](https://community.neo4j.com/u/stefan.armbruster)\
**Post date:** [December 8, 2018, 7:21pm UTC](https://community.neo4j.com/t/warning-max-1024-open-files-allowed-minimum-of-40000-recommended-see-the-neo4j-manual/3679/6 "2018-12-08T19:21:00Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![DrYak](https://sea1.discourse-cdn.com/flex021/user_avatar/community.neo4j.com/dryak/32/7519_2.png) [@DrYak](https://community.neo4j.com/u/DrYak)\
**Post date:** [November 20, 2019, 4:47pm UTC](https://community.neo4j.com/t/warning-max-1024-open-files-allowed-minimum-of-40000-recommended-see-the-neo4j-manual/3679/7 "2019-11-20T16:47:13Z")

</div>

> [@paolodipietro58](#):
>
> I also tried an alternate way, adding `NEO4J_ULIMIT_NOFILE=60000` to /etc/default/neo4j with no success.

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.

---

<div class="post-metadata">

**Author:** ![dkroot2](https://sea1.discourse-cdn.com/flex021/user_avatar/community.neo4j.com/dkroot2/32/8331_2.png) [@dkroot2](https://community.neo4j.com/u/dkroot2)\
**Post date:** [January 3, 2020, 9:54pm UTC](https://community.neo4j.com/t/warning-max-1024-open-files-allowed-minimum-of-40000-recommended-see-the-neo4j-manual/3679/8 "2020-01-03T21:54:32Z")

</div>

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

```auto
[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.

---

<div class="post-metadata">

**Author:** ![guilherme.cortial](https://sea1.discourse-cdn.com/flex021/user_avatar/community.neo4j.com/guilherme.cortial/32/11479_2.png) [@guilherme.cortial](https://community.neo4j.com/u/guilherme.cortial)\
**Post date:** [May 20, 2020, 1:39pm UTC](https://community.neo4j.com/t/warning-max-1024-open-files-allowed-minimum-of-40000-recommended-see-the-neo4j-manual/3679/9 "2020-05-20T13:39:55Z")

</div>

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

thanks!

---

<div class="post-metadata">

**Author:** ![poghosyan.arthur](https://sea1.discourse-cdn.com/flex021/user_avatar/community.neo4j.com/poghosyan.arthur/32/5260_2.png) [@poghosyan.arthur](https://community.neo4j.com/u/poghosyan.arthur)\
**Post date:** [May 26, 2020, 11:07am UTC](https://community.neo4j.com/t/warning-max-1024-open-files-allowed-minimum-of-40000-recommended-see-the-neo4j-manual/3679/10 "2020-05-26T11:07:43Z")

</div>

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"

---

<div class="post-metadata">

**Author:** ![canbax](https://sea1.discourse-cdn.com/flex021/user_avatar/community.neo4j.com/canbax/32/3681_2.png) [@canbax](https://community.neo4j.com/u/canbax)\
**Post date:** [June 18, 2020, 12:53pm UTC](https://community.neo4j.com/t/warning-max-1024-open-files-allowed-minimum-of-40000-recommended-see-the-neo4j-manual/3679/11 "2020-06-18T12:53:42Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![SimplicityGuy](https://sea1.discourse-cdn.com/flex021/user_avatar/community.neo4j.com/simplicityguy/32/7885_2.png) [@SimplicityGuy](https://community.neo4j.com/u/SimplicityGuy)\
**Post date:** [August 12, 2020, 5:05am UTC](https://community.neo4j.com/t/warning-max-1024-open-files-allowed-minimum-of-40000-recommended-see-the-neo4j-manual/3679/12 "2020-08-12T05:05:28Z")

</div>

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:

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

```

have `"NEO4J_ULIMIT_NOFILE=60000"` added to it?

---

<div class="post-metadata">

**Author:** ![p.dipietro](https://sea1.discourse-cdn.com/flex021/user_avatar/community.neo4j.com/p.dipietro/32/19019_2.png) [@p.dipietro](https://community.neo4j.com/u/p.dipietro)\
**Post date:** [July 8, 2021, 10:07am UTC](https://community.neo4j.com/t/warning-max-1024-open-files-allowed-minimum-of-40000-recommended-see-the-neo4j-manual/3679/13 "2021-07-08T10:07:56Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![kvig](https://sea1.discourse-cdn.com/flex021/user_avatar/community.neo4j.com/kvig/32/5572_2.png) [@kvig](https://community.neo4j.com/u/kvig)\
**Post date:** [July 8, 2021, 5:32pm UTC](https://community.neo4j.com/t/warning-max-1024-open-files-allowed-minimum-of-40000-recommended-see-the-neo4j-manual/3679/14 "2021-07-08T17:32:08Z")

</div>

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](https://neo4j.com/developer/kb/number-of-open-files-on-linux/) I added two files:  
**/etc/pam.d/common-session** and **/etc/pam.d/common-session-noninteractive** with the following line:

```auto
session required pam_limits.so

```

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