Py2.7/FreeBSD: maximum number of open files

T

Tobias Oberstein

I am trying to convince Python to open more than 32k files .. this is on FreeBSD.

Now I know I have to set appropriate limits .. I did:

$ sysctl kern.maxfiles
kern.maxfiles: 204800
$ sysctl kern.maxfilesperproc
kern.maxfilesperproc: 200000
$ sysctl kern.maxvnodes
kern.maxvnodes: 200000
$ ulimit
unlimited

Here is what happens with a Python freshly built from sources .. it'll tellme I can open 200k files .. but will bail out at 32k:

$ ./local/bin/python -V
Python 2.7.2
$ ./local/bin/python
Python 2.7.2 (default, Nov 14 2011, 16:41:56)
[GCC 4.2.1 20070719 [FreeBSD]] on freebsd8
Type "help", "copyright", "credits" or "license" for more information.Traceback (most recent call last):
maximum FDs (200000L, 200000L)
fds = []

while cnt < max:
f = open("/tmp/test1/test_%d" % cnt, "w")
f.write("test")
fds.append(f)
cnt += 1
if cnt % 1000 == 0:
print "opened %d files" % cnt

print "ok, created %d files" % cnt
.... f = open("/tmp/test1/test_%d" % cnt, "w")
.... f.write("test")
.... fds.append(f)
.... cnt += 1
.... if cnt % 1000 == 0:
.... print "opened %d files" % cnt
....
opened 1000 files
opened 2000 files
opened 3000 files
opened 4000 files
opened 5000 files
opened 6000 files
opened 7000 files
opened 8000 files
opened 9000 files
opened 10000 files
opened 11000 files
opened 12000 files
opened 13000 files
opened 14000 files
opened 15000 files
opened 16000 files
opened 17000 files
opened 18000 files
opened 19000 files
opened 20000 files
opened 21000 files
opened 22000 files
opened 23000 files
opened 24000 files
opened 25000 files
opened 26000 files
opened 27000 files
opened 28000 files
opened 29000 files
opened 30000 files
opened 31000 files
opened 32000 files
Traceback (most recent call last):
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,769
Messages
2,569,581
Members
45,056
Latest member
GlycogenSupporthealth

Latest Threads

Top