Ranch acceptor reducing accept rate: out of file descriptors

Hi,

I have a phoenix api setup but i’ve been seeing Ranch acceptor error and im not sure if this is also causing the process to die out eventually. Is there a way to debug? Just want to ask if anyone else got this problem.I already extended the file descriptor on the ubuntu box and rebooted.

Thanks! =)

I got something similar Getting :emfile even thou ulimit is set and ERL_MAX_PORTS set to 65536

1 Like

http://ferd.github.io/recon/recon.html library is very useful for debugging these kind of errors. I usually start with the process that owns the resource which will give some hints about which library/module is leaking and debug from there.

1 Like

thanks guys! will have to try it out. sorry for the late response. I think i was pulled off to work on other things and havent gotten back to it.

cheers!

I’m seeing this error on MacOS Monterey (12.3). I’ve already increased the maxfiles limit (the links to the plist files in that article are broken, but digging around in their repo shows that they were like those in this gist) and restarted, and launchctl limit maxfiles shows

maxfiles    524288         524288

… but I’m hitting this limit at somewhere less than 1,000.

According to this issue thread from 2017:

This is not a bug in Cowboy (or Ranch), Ranch just shows a message when the OS refuses to give more file descriptors.

But so far IDK why the OS would refuse with these limits in place.

What does ulimit on Mac returns? I recall the Mac APIs not really changing the limits.

Yes, ulimit -n was the remaining issue. Setting ulimit -n 524288 in my .zshrc lets me make a lot of socket connections. :tada:

I’m pretty sure I also saw errors when the launchctl limit was not high enough, but these are harder to reproduce.