[GH-ISSUE #2462] frps: http: Accept error: accept tcp [::]: accept4: too many open files; retrying in 1s #1956

Closed
opened 2026-05-05 13:15:28 -06:00 by gitea-mirror · 1 comment
Owner

Originally created by @peterwillcn on GitHub (Jun 26, 2021).
Original GitHub issue: https://github.com/fatedier/frp/issues/2462

frps[1906]: 2021/06/26 22:17:08 http: Accept error: accept tcp [::]: accept4: too many open files; retrying in 1s

I am not sure if Go tools exist to help with problems like this. There is problably some connection leak in the code.

A common leak that can happen is forgetting to call resp.Body.Close() after having consumed the payload of http.Response.

Idle connections could be another possible cause. According to HTTP package doc:

By default, Transport caches connections for future re-use. This may leave many open connections when accessing many hosts. This behavior can be managed using Transport's CloseIdleConnections method and the MaxIdleConnsPerHost and DisableKeepAlives fields.

If that's the case, you could try to call explicitely CloseIdleConnections on your Transport handle, or to reduce MaxIdleConnsPerHost value.

Originally created by @peterwillcn on GitHub (Jun 26, 2021). Original GitHub issue: https://github.com/fatedier/frp/issues/2462 ``` frps[1906]: 2021/06/26 22:17:08 http: Accept error: accept tcp [::]: accept4: too many open files; retrying in 1s ``` I am not sure if Go tools exist to help with problems like this. There is problably some connection leak in the code. A common leak that can happen is forgetting to call ```resp.Body.Close()``` after having consumed the payload of ```http.Response```. Idle connections could be another possible cause. According to HTTP package doc: > By default, Transport caches connections for future re-use. This may leave many open connections when accessing many hosts. This behavior can be managed using Transport's CloseIdleConnections method and the MaxIdleConnsPerHost and DisableKeepAlives fields. If that's the case, you could try to call explicitely ```CloseIdleConnections``` on your ```Transport``` handle, or to reduce ```MaxIdleConnsPerHost``` value.
Author
Owner

@fatedier commented on GitHub (Jul 8, 2021):

You'd better optimize your system config about open files limit first.

If there still something wrong, you can paste network infos by netstat or ss on linux.

<!-- gh-comment-id:876080671 --> @fatedier commented on GitHub (Jul 8, 2021): You'd better optimize your system config about open files limit first. If there still something wrong, you can paste network infos by `netstat` or `ss` on linux.
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference: github-starred/frp#1956
No description provided.