File descriptors inherited by restore_command

From: David Steele <david(at)pgmasters(dot)net>
To: Pg Hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: File descriptors inherited by restore_command
Date: 2019-06-21 13:37:59
Message-ID: 7936c364-f7e6-5f1b-2b6e-243b40e8525c@pgmasters.net
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Hackers,

While investigating "Too many open files" errors reported in our
parallel restore_command I noticed that the restore_command can inherit
quite a lot of fds from the recovery process. This limits the number of
fds available in the restore_command depending on the setting of system
nofile and Postgres max_files_per_process.

I was wondering if we should consider closing these fds before calling
restore_command? It seems like we could do this by forking first or by
setting FD_CLOEXEC using fcntl() or O_CLOEXEC on open() where available.

Thoughts on this? Is this something we want to change or should I just
recommend that users set nofile and max_files_per_process appropriately?

Regards,
--
-David
david(at)pgmasters(dot)net

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Tom Lane 2019-06-21 13:45:32 Re: File descriptors inherited by restore_command
Previous Message Mahesh S 2019-06-21 13:28:19 Google Season of Docs