Re: Postgresql database terminates abruptly with too many open files error

Lists: pgsql-generalpgsql-in-general
From: Sri Mrudula Attili <sri(at)ebi(dot)ac(dot)uk>
To: pgsql-in-general(at)postgresql(dot)org
Subject: Postgresql database terminates abruptly with toomay open files error
Date: 2025-01-14 12:52:34
Message-ID: 0af98214-3c2a-43e5-9bbf-ddd79b85ea93@ebi.ac.uk
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-general pgsql-in-general

Hello Team,

 We have a postgresql VDB(virtual database- Delphix) that keeps
terminating due "to too many open files".

Below are few alerts that we could see from the postgresql.log

< 2025-01-14 11:37:20.724 GMT >LOG:  out of file descriptors: Too many
open files in system; release and retry

< 2025-01-14 11:37:20.724 GMT >FATAL:  epoll_create1 failed: Too many
open files in system

The number of allowed openfiles at OS level are 65000. even then we see
these all these being utilised and causing the database to terminate.

Is there a way we could avoid this.

Thanks,

Sri


From: Sri Mrudula Attili <sri(at)ebi(dot)ac(dot)uk>
To: pgsql-general(at)postgresql(dot)org
Subject: Postgresql database terminates abruptly with too many open files error
Date: 2025-01-14 12:58:44
Message-ID: 709d5fa0-85e1-40a2-a6a4-11040f4e5b62@ebi.ac.uk
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-general pgsql-in-general

Hello Team,

 We have a postgresql VDB(virtual database- Delphix) that keeps
terminating due "to too many open files".

Below are few alerts that we could see from the postgresql.log

< 2025-01-14 11:37:20.724 GMT >LOG:  out of file descriptors: Too many
open files in system; release and retry

< 2025-01-14 11:37:20.724 GMT >FATAL:  epoll_create1 failed: Too many
open files in system

The number of allowed openfiles at OS level are 65000. even then we see
these all these being utilised and causing the database to terminate.

Is there a way we could avoid this.

Thanks,

Sri


From: Frank Lanitz <frank(at)frank(dot)uvena(dot)de>
To: pgsql-general(at)lists(dot)postgresql(dot)org
Subject: Re: Postgresql database terminates abruptly with too many open files error
Date: 2025-01-14 13:39:06
Message-ID: 83e42564-ae78-4876-9525-d1f48843c532@frank.uvena.de
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-general 사설 토토 : 사설 토토 메일

Hello,

Have you checked something like lsof to see open file descriptors to see?

Cheers,
frank

Am 14.01.25 um 13:58 schrieb Sri Mrudula Attili:
> Hello Team,
>
>  We have a postgresql VDB(virtual database- Delphix) that keeps terminating due "to too many open files".
>
> Below are few alerts that we could see from the postgresql.log
>
>
> < 2025-01-14 11:37:20.724 GMT >LOG:  out of file descriptors: Too many open files in system; release and retry
>
> < 2025-01-14 11:37:20.724 GMT >FATAL:  epoll_create1 failed: Too many open files in system
>
>
> The number of allowed openfiles at OS level are 65000. even then we see these all these being utilised and causing the database to terminate.
>
>
> Is there a way we could avoid this.
>
>
> Thanks,
>
> Sri
>
>
>


From: Ron Johnson <ronljohnsonjr(at)gmail(dot)com>
To: pgsql-general <pgsql-general(at)postgresql(dot)org>
Subject: Re: Postgresql database terminates abruptly with too many open files error
Date: 2025-01-14 13:39:27
Message-ID: CANzqJaBvSYzEue9H4ENRUnFfkmmFaRw94D0U6EtBZPwgrbxU5g@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-general 사설 토토 : 사설 토토 메일

On Tue, Jan 14, 2025 at 7:58 AM Sri Mrudula Attili <sri(at)ebi(dot)ac(dot)uk> wrote:

> Hello Team,
>
> We have a postgresql VDB(virtual database- Delphix) that keeps
> terminating due "to too many open files".
>
> Below are few alerts that we could see from the postgresql.log
>
>
> < 2025-01-14 11:37:20.724 GMT >LOG: out of file descriptors: Too many
> open files in system; release and retry
>
> < 2025-01-14 11:37:20.724 GMT >FATAL: epoll_create1 failed: Too many
> open files in system
>
>
> The number of allowed openfiles at OS level are 65000. even then we see
> these all these being utilised and causing the database to terminate.
>
>
> Is there a way we could avoid this.
>

We need more information.

--
Death to <Redacted>, and butter sauce.
Don't boil me, I'm still alive.
<Redacted> lobster!


From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Sri Mrudula Attili <sri(at)ebi(dot)ac(dot)uk>
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: Postgresql database terminates abruptly with too many open files error
Date: 2025-01-14 14:19:53
Message-ID: 679341.1736864393@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: Postg젠 토토SQL : pgsql-in-general

Sri Mrudula Attili <sri(at)ebi(dot)ac(dot)uk> writes:
>  We have a postgresql VDB(virtual database- Delphix) that keeps
> terminating due "to too many open files".

What do you have max_connections set to, and how many actually-live
server processes are there typically?

> The number of allowed openfiles at OS level are 65000.

I'm suspecting that you either need to increase that, decrease
max_files_per_process (which defaults to 1000), or decrease
max_connections.

regards, tom lane


From: Sri Mrudula Attili <sri(at)ebi(dot)ac(dot)uk>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: Postgresql database terminates abruptly with too many open files error
Date: 2025-01-15 11:42:30
Message-ID: 9b69fcc6-dca1-4671-af00-b250f154fb14@ebi.ac.uk
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-general pgsql-in-general

Hello Tom,

The max_connections =200 and max_files_per_process =1000 as you mentioned.

So should a max_files_per_process =500 helps?

I could see from the number of connections to the databaseis not
exceeding 20. But still these 20 are causing all the damage or using up
all the openfiles quota.

Thanks,

Sri

On 14/01/2025 14:19, Tom Lane wrote:
> Sri Mrudula Attili <sri(at)ebi(dot)ac(dot)uk> writes:
>>  We have a postgresql VDB(virtual database- Delphix) that keeps
>> terminating due "to too many open files".
> What do you have max_connections set to, and how many actually-live
> server processes are there typically?
>
>> The number of allowed openfiles at OS level are 65000.
> I'm suspecting that you either need to increase that, decrease
> max_files_per_process (which defaults to 1000), or decrease
> max_connections.
>
> regards, tom lane


From: Durgamahesh Manne <maheshpostgres9(at)gmail(dot)com>
To: Sri Mrudula Attili <sri(at)ebi(dot)ac(dot)uk>
Cc: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, PostgreSQL mailing lists <pgsql-general(at)postgresql(dot)org>
Subject: Re: Postgresql database terminates abruptly with too many open files error
Date: 2025-01-19 09:01:18
Message-ID: CAJCZkoLT_9iL+C9iMP+C6-7Fha0uy4UN5c6vNZPRoKs-+G8viQ@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-general pgsql-in-general

---------- Forwarded message ---------
From: Sri Mrudula Attili <sri(at)ebi(dot)ac(dot)uk>
Date: Wed, 15 Jan, 2025, 17:12
Subject: Re: Postgresql database terminates abruptly with too many open
files error
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: <pgsql-general(at)postgresql(dot)org>

Hello Tom,

The max_connections =200 and max_files_per_process =1000 as you mentioned.

So should a max_files_per_process =500 helps?

I could see from the number of connections to the databaseis not
exceeding 20. But still these 20 are causing all the damage or using up
all the openfiles quota.

Thanks,

Sri

On 14/01/2025 14:19, Tom Lane wrote:
> Sri Mrudula Attili <sri(at)ebi(dot)ac(dot)uk> writes:
>> We have a postgresql VDB(virtual database- Delphix) that keeps
>> terminating due "to too many open files".
> What do you have max_connections set to, and how many actually-live
> server processes are there typically?
>
>> The number of allowed openfiles at OS level are 65000.
> I'm suspecting that you either need to increase that, decrease
> max_files_per_process (which defaults to 1000), or decrease
> max_connections.
>
> regards, tom lane

Hi Team,

What is the final conclusion for this ?

Regards,
Durga Mahesh


From: "Peter J(dot) Holzer" <hjp-pgsql(at)hjp(dot)at>
To: pgsql-general(at)lists(dot)postgresql(dot)org
Subject: Re: Postgresql database terminates abruptly with too many open files error
Date: 2025-01-19 11:06:16
Message-ID: 20250119110616.2vu7oblzoxnqfkqx@hjp.at
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: Postg토토 베이SQL 와이즈 토토 : 와이즈 토토 메일

On 2025-01-15 11:42:30 +0000, Sri Mrudula Attili wrote:
> The max_connections =200 and max_files_per_process =1000 as you mentioned.
>
> So should a max_files_per_process =500 helps?
>
>
> I could see from the number of connections to the databaseis not exceeding
> 20. But still these 20 are causing all the damage or using up all the
> openfiles quota.

If there are 20 processes with at most 1000 open files each, that's only
20'000 open files. So where do the other 45'536 files come from?

Use something like

lsof | awk '{print $1, $2}' | uniq -c | sort -n

to find the processes with the most open files (but be aware that lsof
reports file descriptors for each thread, so any multi-threaded programs
will be vastly inflated)

hp

--
_ | Peter J. Holzer | Story must make more sense than reality.
|_|_) | |
| | | hjp(at)hjp(dot)at | -- Charles Stross, "Creative writing
__/ | http://www.hjp.at/ | challenge!"