go语言 Accept error: accept tcp [::]:5551: too many open files;

在使用go语言请求服务器的时候,在一个for循环内使用http.post所引起的错误是:Accept error: accept tcp [::]:5551: too many open files; retrying in 1s ,起初觉得是mysql数据库的连接数太小,调整链接数以后,当for循环大于1000时,这个Accept error: accept tcp [::]:5551: too many open files; retrying in 1s异常还会出现,通过检查代码,把http.post换成htpp.NewRequest("POST"),异常不会出现。 结论以下: 在一个for循环以内,若是是直接http.post那么,这个http.post所使用的资源尚未释放,下一次的http.post请求已经开始,形成资源没法快速释放,最终抛出异常
相关文章
相关标签/搜索