Original address: https://zhuanlan.zhihu.com/p/22474724
The author's conclusion is not well written, I say two sentences.
Conclusion: Docker swarm itself has a function called Settcpusertimeout, which calls the Conn. The File () method converts the TCP fd into blocking and does not close the corresponding FD. Equivalent to setting the Tcpusertimeout parameter each time, and then read the FD, will produce a new thread. Because the old thread is reading FD, and FD is set to blocking, then Golang's run time had to open a new one. Workaround: Do not use swarm this method, or submit to upstream let swarm fixed off, or call setsockoptint ... Curious gossip about what tcp_user_timeout is: According to RFC 5482, this option is used to communicate the TCP time-out to the peer. Incidentally, the RFC for TCP timeouts also includes: [RFC0793] [RFC1122]. Previously, TCP had a similar timeout option for TCP Keepalive. However, TCP keepalive is an option that is not recommended to open. Because the Committee felt that it would waste bandwidth and cause unnecessary network outages. Frankly speaking, TCP is a set of timers composed of a state machine, the designer is expected to interrupt the middle circuit, re-routing and other changes, will not affect the TCP state at both ends. Cond
"The problem of a Go program system thread Skyrocket" conclusion