gen_tcp接受链接时enfile的问题分析及解决
最近我们为了安全方面的原因,在RDS服务器上做了个代理程序把普通的MYSQL TCP连接变成了SSL链接,在测试的时候,皓庭同学发现Tsung发起了几千个TCP链接后Erlang做的SSL PROXY老是报告gen_tcp:accept返回{error, enfile}错误。针对这个问题,我展开了如下的调查: 首先man accept手册,确定enfile的原因,因为gen_tcp肯定是调用accept系统调用的: EMFILE The per-process limit of open file descriptors has been reached. ENFILE The system limit on the total number of open file