I faced with the problem there was exception OSError 24 ("Too many open files") raised on my mac os x in python script.
I had no idea what could caused that issue. lsof -p showed about 40-50 lines, and my ulimit was 1200 (I check that using
resource.getrlimit(resource.RLIMIT_NOFILE)
), that returned tuple (1200, 1200). So I didn't exceed limit even closely.
That my script spawned number of subprocesses and also allocated shared memory segments. Exception occurred while allocating shared memory segments. I use sysv_ipc module.
Also I knew I total allowed number of shared memory segments is enough large (128 segments), and command
ipcs -b -m
gave definitely less number (not more then 40 segments).