# Too many open files

**URL:** <https://forums.percona.com/t/too-many-open-files/6995>\
**Category:** Percona Server for MySQL 8.0\
**Created:** [May 2, 2019, 6:50am UTC](https://forums.percona.com/t/too-many-open-files/6995 "2019-05-02T06:50:12Z")\
**Posts on this page:** 11\
**Page:** 1

<div class="post-metadata">

**Author:** ![acerola](https://avatars.discourse-cdn.com/v4/letter/a/91b2a8/32.png) [@acerola](https://forums.percona.com/u/acerola)\
**Post date:** [May 2, 2019, 6:50am UTC](https://forums.percona.com/t/too-many-open-files/6995/1 "2019-05-02T06:50:12Z")

</div>

I am using latest Percona/MySQL 8.0.15. The server was up for about 25 days. Today, it became inaccessible by IP and socket. In PHP I got “resource temporarily unavailable” and in mysql log:

```auto
2019-04-07T11:16:46.496996Z 0 [System] [MY-011323] [Server] X Plugin ready for connections...
2019-05-01T04:59:01.212412Z 0 [ERROR] [MY-010283] [Server] Error in accept: Too many open files
2019-05-02T04:19:37.455224Z 0 [ERROR] [MY-010283] [Server] Error in accept: Too many open files
2019-05-02T04:23:53.497133Z 0 [ERROR] [MY-010283] [Server] Error in accept: Too many open files
2019-05-02T04:28:09.539736Z 0 [ERROR] [MY-010283] [Server] Error in accept: Too many open files
2019-05-02T04:32:25.579582Z 0 [ERROR] [MY-010283] [Server] Error in accept: Too many open files
2019-05-02T04:36:41.621105Z 0 [ERROR] [MY-010283] [Server] Error in accept: Too many open files
2019-05-02T04:40:57.664604Z 0 [ERROR] [MY-010283] [Server] Error in accept: Too many open files
2019-05-02T04:45:13.704270Z 0 [ERROR] [MY-010283] [Server] Error in accept: Too many open files
2019-05-02T04:49:29.743013Z 0 [ERROR] [MY-010283] [Server] Error in accept: Too many open files
2019-05-02T04:53:45.783448Z 0 [ERROR] [MY-010283] [Server] Error in accept: Too many open files
2019-05-02T04:58:02.425095Z 0 [ERROR] [MY-010283] [Server] Error in accept: Too many open files
2019-05-02T11:41:25.660976Z 0 [ERROR] [MY-010283] [Server] Error in accept: Too many open files
2019-05-02T11:45:41.694016Z 0 [ERROR] [MY-010283] [Server] Error in accept: Too many open files
2019-05-02T11:49:57.728520Z 0 [ERROR] [MY-010283] [Server] Error in accept: Too many open files

```

I restarted the process and it came back up.

Any idea why this happened and how to prevent it?

---

<div class="post-metadata">

**Author:** ![DBennett](https://sea1.discourse-cdn.com/flex019/user_avatar/forums.percona.com/dbennett/32/17_2.png) [@DBennett](https://forums.percona.com/u/DBennett)\
**Post date:** [May 3, 2019, 11:58am UTC](https://forums.percona.com/t/too-many-open-files/6995/2 "2019-05-03T11:58:58Z")

</div>

Hi acerola,

Can you share what distribution and version you are on?

---

<div class="post-metadata">

**Author:** ![acerola](https://avatars.discourse-cdn.com/v4/letter/a/91b2a8/32.png) [@acerola](https://forums.percona.com/u/acerola)\
**Post date:** [May 20, 2019, 7:10pm UTC](https://forums.percona.com/t/too-many-open-files/6995/3 "2019-05-20T19:10:33Z")

</div>

Centos 7. All up to date.

---

<div class="post-metadata">

**Author:** ![lalit.choudhary](https://sea1.discourse-cdn.com/flex019/user_avatar/forums.percona.com/lalit.choudhary/32/51_2.png) [@lalit.choudhary](https://forums.percona.com/u/lalit.choudhary)\
**Post date:** [July 5, 2019, 9:35am UTC](https://forums.percona.com/t/too-many-open-files/6995/4 "2019-07-05T09:35:05Z")

</div>

Please check open file limit on the database server using ulimit -a and make sure it has sufficient open-file limit for a user with respect to count of the database files.

---

<div class="post-metadata">

**Author:** ![acerola](https://avatars.discourse-cdn.com/v4/letter/a/91b2a8/32.png) [@acerola](https://forums.percona.com/u/acerola)\
**Post date:** [July 10, 2019, 9:32am UTC](https://forums.percona.com/t/too-many-open-files/6995/5 "2019-07-10T09:32:17Z")

</div>

Today it happened again.

```auto
2019-06-07T08:06:51.730482Z 0 [System] [MY-011323] [Server] X Plugin ready for connections. Socket: '/mysql_socket/mysqlx.sock' bind-address: '::' port: 
2019-07-10T14:30:08.645268Z 0 [ERROR] [MY-010283] [Server] Error in accept: Too many open files
2019-07-10T14:34:24.682315Z 0 [ERROR] [MY-010283] [Server] Error in accept: Too many open files
2019-07-10T14:38:40.711770Z 0 [ERROR] [MY-010283] [Server] Error in accept: Too many open files
2019-07-10T14:42:56.741497Z 0 [ERROR] [MY-010283] [Server] Error in accept: Too many open files
2019-07-10T14:47:12.771797Z 0 [ERROR] [MY-010283] [Server] Error in accept: Too many open files
2019-07-10T14:50:56.141127Z 0 [System] [MY-010910] [Server] /usr/sbin/mysqld: Shutdown complete (mysqld 8.0.15-6) Percona Server (GPL), Release 6, Revision 63abd08.

```

```auto
# ulimit -a
core file size (blocks, -c) 0
data seg size (kbytes, -d) unlimited
scheduling priority (-e) 0
file size (blocks, -f) unlimited
pending signals (-i) 513402
max locked memory (kbytes, -l) 64
max memory size (kbytes, -m) unlimited
open files (-n) 1024
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) 513402
virtual memory (kbytes, -v) unlimited
file locks (-x) unlimited

```

---

<div class="post-metadata">

**Author:** ![acerola](https://avatars.discourse-cdn.com/v4/letter/a/91b2a8/32.png) [@acerola](https://forums.percona.com/u/acerola)\
**Post date:** [July 10, 2019, 1:08pm UTC](https://forums.percona.com/t/too-many-open-files/6995/6 "2019-07-10T13:08:14Z")

</div>

I am monitoring the open files with lsof. I noticed that mysql is opening more than one handle to the slow query log file. A couple hours ago there were only 5. Now 17. It looks like a resource leak.

```auto
# lsof -a -p `pidof mysqld`

mysqld 15929 mysql 111r REG 259,3 1883109219 14286853 /<path>/slow_log.CSV
mysqld 15929 mysql 112u REG 259,3 1883109219 14286853 /<path>/slow_log.CSV
mysqld 15929 mysql 130r REG 259,3 1883109219 14286853 /<path>/slow_log.CSV
mysqld 15929 mysql 131r REG 259,3 1883109219 14286853 /<path>/slow_log.CSV
mysqld 15929 mysql 140r REG 259,3 1883109219 14286853 /<path>/slow_log.CSV
mysqld 15929 mysql 142r REG 259,3 1883109219 14286853 /<path>/slow_log.CSV
mysqld 15929 mysql 143r REG 259,3 1883109219 14286853 /<path>/slow_log.CSV
mysqld 15929 mysql 145r REG 259,3 1883109219 14286853 /<path>/slow_log.CSV
mysqld 15929 mysql 146r REG 259,3 1883109219 14286853 /<path>/slow_log.CSV
mysqld 15929 mysql 150r REG 259,3 1883109219 14286853 /<path>/slow_log.CSV
mysqld 15929 mysql 151r REG 259,3 1883109219 14286853 /<path>/slow_log.CSV
mysqld 15929 mysql 152r REG 259,3 1883109219 14286853 /<path>/slow_log.CSV
mysqld 15929 mysql 155r REG 259,3 1883109219 14286853 /<path>/slow_log.CSV
mysqld 15929 mysql 157r REG 259,3 1883109219 14286853 /<path>/slow_log.CSV
mysqld 15929 mysql 158r REG 259,3 1883109219 14286853 /<path>/slow_log.CSV
mysqld 15929 mysql 159r REG 259,3 1883109219 14286853 /<path>/slow_log.CSV
mysqld 15929 mysql 160r REG 259,3 1883109219 14286853 /<path>/slow_log.CSV

```

---

<div class="post-metadata">

**Author:** ![yosefy](https://avatars.discourse-cdn.com/v4/letter/y/7ab992/32.png) [@yosefy](https://forums.percona.com/u/yosefy)\
**Post date:** [July 15, 2019, 7:11am UTC](https://forums.percona.com/t/too-many-open-files/6995/7 "2019-07-15T07:11:18Z")

</div>

hi, we also have this  
and it is huge problem

when is release of 8.0.16 planned? it has fix i think  
thanx

---

<div class="post-metadata">

**Author:** ![lorraine.pocklington](https://sea1.discourse-cdn.com/flex019/user_avatar/forums.percona.com/lorraine.pocklington/32/37_2.png) [@lorraine.pocklington](https://forums.percona.com/u/lorraine.pocklington)\
**Post date:** [July 15, 2019, 8:28am UTC](https://forums.percona.com/t/too-many-open-files/6995/8 "2019-07-15T08:28:24Z")

</div>

Hello, thanks for the updates.

You are correct that it is a known issue, and I am sorry for the challenges that this is bringing to you. There is a fix pending release in Percona Server for MySQL, and the bug also affects upstream software (i.e. MySQL),

The best thing you can do to get earliest advice of the availability of the fix is to subscribe to this bug ticket as that will notify you when the release is made available [URL][[PS-5582] The table '/tmp/#...' is full! - Percona JIRA](https://jira.percona.com/browse/PS-5582%5B/URL%5D) .

The release is in the foreseeable future, but we do not provide advance dates for software releases, so I am unable to provide you with a specific date. I will try to update this post, but the most reliable and quickest way to receive notification is to (a) subscribe to the JIRA report and (b) subscribe to the blog where we publish release notes on the day the release is made available.

Thanks for your patience.

---

<div class="post-metadata">

**Author:** ![lalit.choudhary](https://sea1.discourse-cdn.com/flex019/user_avatar/forums.percona.com/lalit.choudhary/32/51_2.png) [@lalit.choudhary](https://forums.percona.com/u/lalit.choudhary)\
**Post date:** [October 27, 2021, 9:25am UTC](https://forums.percona.com/t/too-many-open-files/6995/9 "2021-10-27T09:25:09Z")

</div>

Such problem should be fixed using following option,

Increase limit as per your need

example:  
mysql my.cnf  
[mysqld]  
open\_files\_limit=60000  
OS:  
ulimit -n 60000

---

<div class="post-metadata">

**Author:** ![acerola](https://avatars.discourse-cdn.com/v4/letter/a/91b2a8/32.png) [@acerola](https://forums.percona.com/u/acerola)\
**Post date:** [October 27, 2021, 9:38am UTC](https://forums.percona.com/t/too-many-open-files/6995/10 "2021-10-27T09:38:15Z")

</div>

Wow. Didn’t expect to get a reply after over 2 years.  
As explained above, this was a bug in that version of MySQL/Percona. After updating it, the problem was resolved.  
Thanks all for the help.

---

<div class="post-metadata">

**Author:** ![lalit.choudhary](https://sea1.discourse-cdn.com/flex019/user_avatar/forums.percona.com/lalit.choudhary/32/51_2.png) [@lalit.choudhary](https://forums.percona.com/u/lalit.choudhary)\
**Post date:** [October 27, 2021, 9:42am UTC](https://forums.percona.com/t/too-many-open-files/6995/11 "2021-10-27T09:42:47Z")

</div>

Thank you for the update, Good to have a possible solution as it might help others.
