Proposal for pkg-message for python 3.x ports

Konstantin Belousov kostikbel at gmail.com
Tue May 9 19:13:21 UTC 2017


On Tue, May 09, 2017 at 07:23:38PM +0200, pmhausen wrote:
> Dear python port maintainers,
> 
> I discovered an odd performance problem with python 3.6 on servers with
> large amounts of memory.
> 
> You can find all the details in a thread of the help at python.org
> mailinglist with subject
> 
> "Python bug? Closing *all* file descriptors on fork() instead of only open ones?"
> 
> Unfortunately I cannot get at the list archives. Otherwise I would have sent
> you a direct link.
> 
> Short version: since python 3.3 (if my google-fu worked) python tries to
> close all open file descriptors in the child after fork(). Since there is
> no standard POSIX compliant way to do this for *open* descriptors only,
> it tries to use /dev/fd on FreeBSD and if that is not available it closes
> *all* descriptors (resulting in ERR#9 for the majority). On a 64 bit FreeBSD
> 11 system with 128 GB of RAM the auto-tuned kern.maxfilesperproc
> is between 3 and 4 million. That's a heck of a lot of system calls for each
> fork() ;-)
> 
> I suggest adding a hint to mount fdescfs and add it to /etc/fstab in the
> pkg-message for the affected python ports.

We have closefrom(2), which is semi-portable, in the sense that it is
available not only on FreeBSD.


More information about the freebsd-python mailing list