[Python-Dev] "Too many open files" errors on "x86 FreeBSD 7.2 3.x" buildbot

Jeroen Ruigrok van der Werven asmodai at in-nomine.org
Mon Nov 8 13:23:33 CET 2010

-On [20101108 00:36], David Bolen (db3l.net at gmail.com) wrote:
>Victor Stinner <victor.stinner at haypocalc.com> writes:
>Well, I think the SYSV semaphores are either less limited or at least
>more adjustable.  They've certainly been around longer in FreeBSD.
>The POSIX semaphore support is not enabled by default in FreeBSD 7, so
>I added loader.conf stuff to load them (as part of issue7272).

It is enabled by default on FreeBSD 8 at least.
Looking through the repository it seems 7-STABLE has it enabled by default
as well in the GENERIC kernel (the standard one it boots with after its
first install). It seems this was added for 7.3 and onward. So 7.2 and
before need an "options P1003_1B_SEMAPHORES" added to their kernel at least.
The SYSV options are already present in the entire 7.x line.

>> It looks like it is possible to tune semaphore limits on FreeBSD, without 
>> recompiling the kernel, by using boot loader option (kern.ipc.sem* options). 
>> But ask the FreeBSD user to tune its boot loader options to use the 
>> concurrent.futures module is not pratical :-)

PostgreSQL installations via ports as well as its documentation instruct the
FreeBSD user to tweak kern.ipc settings.

>Yeah, I guess the key question is if changing the limit is just needed
>to get around an artifact of the test process (which I'm willing to do
>for the buildbot), or if it would be needed to be able to use the
>regular modules in practice.  If the latter, I doubt too many users
>are going to jump through such hoops, particularly if it needs a
>kernel rebuild, so we may need to make other choices in terms of
>support under FreeBSD.

Almost every FreeBSD user I know of compiles a new kernel. It's just one of
those BSD things that every user goes through.

>I'm also not entirely sure just what is the limiting factor.  I think
>the kern.ipc.sem* options are for the SYSV semaphores, not POSIX, though
>some of them do have a similar limit.  Some are adjustable by sysctl,
>others by loader.conf.

kern.ipc is about System V IPC. As you indicate later on, p1003_1b is the
POSIX related IPC sysctl tree.
The three semaphore settings semmni, semmns, and semmnu are only tweakable
via loader.conf.

>The references I found were talking about a limit set explicitly
>(#define SEM_MAX) in the kernel source (uipc_sem.c) which exports its
>value (at least in 7.2) via the sysctl p1003_1b.sem_nsems_max, which
>is read-only.  I got the impression they weren't adjustable even in
>loader.conf, but haven't actually tried it yet myself.
>It may be different in 8.x, but one email thread I found indicated
>that the changes proposed to make the POSIX limits adjustable didn't
>make the 8.1 cut (current release), though might make it in the next
>8.x release.

After checking the repository I saw that there were MFCs (Merge From
Current, backport) to 8-STABLE prior to the 8.1 release for dynamic

On my 8.1 machine:

nexus% sudo sysctl -w p1003_1b.sem_nsems_max=31
p1003_1b.sem_nsems_max: 30 -> 32

7.x is hardlocked at the moment unless someone manually edits the file to up
the SEM_MAX define. The same goes for FreeBSD 8.0.

Jeroen Ruigrok van der Werven <asmodai(-at-)in-nomine.org> / asmodai
イェルーン ラウフロック ヴァン デル ウェルヴェン
http://www.in-nomine.org/ | http://www.rangaku.org/ | GPG: 2EAC625B
Nothing yet from nothing ever came...

More information about the Python-Dev mailing list