1

I need some help of expert in Postgres. I'm getting a problem in my application.

Problem: PG::InsufficientResources:

ERROR: could not open shared memory segment "/PostgreSQL.1477116630": Too many open files in system
STATEMENT: SELECT "work_orders".* FROM "work_orders" WHERE (created_at < '2025-04-07 19:58:00.668344' AND rascunho is true) ORDER BY "work_orders"."id" ASC LIMIT 1ドル

I have tried some changes with AI help but no success. Here is my Postgres configuration:

postgresql.conf:

listen_addresses = '*'
port = 5432
superuser_reserved_connections = 3
unix_socket_directories = '/var/run/postgresql, /tmp'
max_connections = 200
shared_buffers = 4864MB
effective_cache_size = 14592MB
maintenance_work_mem = 1216MB
checkpoint_completion_target = 0.9
wal_buffers = 16MB
default_statistics_target = 100
random_page_cost = 1.1
effective_io_concurrency = 200
work_mem = 6225kB
huge_pages = off
min_wal_size = 1GB
max_wal_size = 4GB
max_worker_processes = 10
max_parallel_workers_per_gather = 4
max_parallel_workers = 10
max_parallel_maintenance_workers = 4
max_prepared_transactions = 400

ulimit settings made in /etc/security/limits.conf:

postgres soft nofile 65535
postgres hard nofile 65535
root soft nofile 65535
root hard nofile 65535
nucleusdb soft nofile 65535
nucleusdb hard nofile 65535

Changes in the systemd service (/etc/systemd/system/postgresql.service.d/override.conf):

[Service]
LimitNOFILE=65535.

During the day I got a lot of these messages, here is a screen shot. 288 errors during 12 hours!

screen shot of the error messages

Laurenz Albe
62.1k4 gold badges57 silver badges93 bronze badges
asked Apr 8 at 21:32

2 Answers 2

0

My guess is that the "Too many open files" message was translated from a different language, and that you are hitting the limit of 1000 open files per PostgreSQL process. Try increasing the parameter max_files_per_process.

answered Apr 9 at 7:13
0

When LimitNOFILE is not enough, it is reported as Too many open files. Whereas Too many open files in system is about a separate Linux kernel limit for the entire system: fs.file-max sysctl or /proc/sys/fs/file-max procfs pseudo file.

answered Apr 9 at 18:49

Your Answer

Draft saved
Draft discarded

Sign up or log in

Sign up using Google
Sign up using Email and Password

Post as a guest

Required, but never shown

Post as a guest

Required, but never shown

By clicking "Post Your Answer", you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.