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

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
Thread:
Lists: pgsql-general pgsql-in-general

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!"

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Peter J. Holzer 2025-01-19 11:37:01 Re: Design of a reliable task processing queue
Previous Message Durgamahesh Manne 2025-01-19 09:01:18 Re: Postgresql database terminates abruptly with too many open files error

Browse pgsql-in-general by date

  From Date Subject
Previous Message Durgamahesh Manne 2025-01-19 09:01:18 Re: Postgresql database terminates abruptly with too many open files error