[erlang-questions] system_limit and enfile errors when acceptiing/opening connections

Artak Avetisyan artak@REDACTED
Mon Aug 11 14:36:09 CEST 2008

Dear All

We have encountered a strange problem on our erlang-driven web-service, 
which uses yaws for accepting connections from outer world and http 
module to send requests to the back office.
After several hours of operation the http:request fails with {error, 
system_limit} and consequently yaws web server shuts down yaws: Failed 
to accept - terminating: {error,enfile}
We are running Erlang R12 on FreeBSD 6.2-RELEASE, the kern.maxfiles  
limit is  8072 , and kern.maxfileperproc is 7264 per process, while 
fstat | grep beam | wc shows 1200 (way to low to get emfile or enfile 
anyway), however the web-service runs normally after a reboot.

Is that possible that that {error, enfile} is generated by the beam 
process itself as a result of {error, system_limit} problem, and is not 
relayed form the underlying OS?

we didn't specify the ERL_MAX_PORTS environment variable, and  the 
length(erlang:ports()) was  something around 8000 , while the 
documentation said that the default max port number is 1024. Seems quite 
strange to me. Later, when experimenting i have set the ERL_MAX_PORTS to 
0, and still erlang:ports() returned > 0 entries, while i expected 
system_limit error from the first connection opened.

I feel that i am missing something badly, and will appreciate any help.

Best regards,
Artak Avetisyan
Yerevan, Republic of Armenia

More information about the erlang-questions mailing list