File descriptors inherited by restore_command - Mailing list pgsql-hackers

From David Steele
Subject File descriptors inherited by restore_command
Date
Msg-id 7936c364-f7e6-5f1b-2b6e-243b40e8525c@pgmasters.net
Whole thread Raw
Responses Re: File descriptors inherited by restore_command
List 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@pgmasters.net



pgsql-hackers by date:

Previous
From: Mahesh S
Date:
Subject: Google Season of Docs
Next
From: Tom Lane
Date:
Subject: Re: File descriptors inherited by restore_command