ZeroNet icon indicating copy to clipboard operation
ZeroNet copied to clipboard

Err: OSError: [Errno 24] Too many open files

Open MoreJ opened this issue 9 years ago • 7 comments

I'm on Mac OSX and have tried the commonly suggested fixes (ulimit and all that). Happens seemingly randomly. It makes using ZeroNet frustrating to use at times.

MoreJ avatar Aug 09 '16 07:08 MoreJ

have you tried to starting it with zeronet.py --max_files_opened 10240 ?

HelloZeroNet avatar Aug 09 '16 10:08 HelloZeroNet

Yup. Didn't help. I also tried sudo sysctl -w kern.maxfiles=20480 and sudo sysctl -w kern.maxfilesperproc=18000 neither of which helped. I ended up rebooting my computer and I haven't gotten the error since then.

MoreJ avatar Aug 09 '16 10:08 MoreJ

If you start zeronet using --debug then you have some more detailed http://127.0.0.1:43110/Stats page. Please paste the first ~10 lines of the "Objects in memory" section and also the number in the "Sockets (*):" section

HelloZeroNet avatar Aug 09 '16 12:08 HelloZeroNet

Objects in memory (types: 145, total: 100606, 39930.37kb):
- 32919.0kb = 43141 x <type 'dict'>
- 1157.1kb = 16456 x <type 'builtin_function_or_method'>
- 472.8kb = 7564 x <type 'method-wrapper'>
- 638.1kb = 5445 x <type 'function'>
- 413.7kb = 3782 x <class 'Peer.PeerHashfield.PeerHashfield'>
- 688.3kb = 3671 x <class 'Peer.Peer.Peer'>
- 1441.8kb = 3047 x <type 'frame'>
- 185.4kb = 2629 x <type 'tuple'>
- 277.4kb = 2605 x <type 'list'>
- 102.9kb = 1317 x <type 'instancemethod'>

Sockets (8):

As I mentioned, I haven't gotten the error since I've rebooted. Keep that in mind.

Edit: I just got the error again. 'Objects in memory' is about the same. Sockets shot up to 260.

MoreJ avatar Aug 09 '16 12:08 MoreJ

Please try to save this file: https://gist.githubusercontent.com/HelloZeroNet/d9bf888693e66a573815/raw/aeb189142e0be33b0253af5ddb8c241c49a95ce9/test_max.py and drag to a terminal. It tests how many files can a python process open.

HelloZeroNet avatar Aug 09 '16 17:08 HelloZeroNet

Max open files without changing settings: 253
Current RLIMIT_NOFILE limit: 256 9223372036854775807 Changing to 2048...
Max open files after changing settings: 2045

I found this script on a similar issue posted, and last time I ran it the 'max open files after changing settings' didn't change before (when I was having the error frequently). As of now, those above results again came while I'm not getting the error frequently.

MoreJ avatar Aug 09 '16 21:08 MoreJ

Similar issue: https://github.com/HelloZeroNet/ZeroNet/issues/634#issuecomment-435661233 Check the links in that comment, it worked for me on Linux (not tried OSX), but it should be similar.

slrslr avatar Jun 13 '25 14:06 slrslr