Hi, On Linux, if I compile and run this simple program:
package main import ( "fmt" "net/http" "time" ) type x struct{} func (x) ServeHTTP(w http.ResponseWriter, r *http.Request) { w.Write([]byte("aaaa")) } func main() { sp := &http.Server{ ReadHeaderTimeout: 5 * time.Second, ReadTimeout: 5 * time.Second, WriteTimeout: 5 * time.Second, IdleTimeout: 30 * time.Second, Addr: ":8080", Handler: x{}, } fmt.Println(sp.ListenAndServe()) } After a while I start to see constant CPU activity (1% to 7%) even when the server is idle. If I run "sudo strace -f -c -p <pid>" I get constant very fast calls like: [pid 131277] 23:42:16 nanosleep({tv_sec=0, tv_nsec=10000000}, NULL) = 0 [pid 131277] 23:42:16 nanosleep({tv_sec=0, tv_nsec=10000000}, NULL) = 0 [pid 131277] 23:42:16 nanosleep({tv_sec=0, tv_nsec=10000000}, NULL) = 0 [pid 131277] 23:42:16 nanosleep({tv_sec=0, tv_nsec=10000000}, NULL) = 0 [pid 131277] 23:42:16 nanosleep({tv_sec=0, tv_nsec=10000000}, NULL) = 0 .... It never stops. Sometimes the CPU goes to 100% for a while and then go back down to 1%.. This happens only in one or two cores. This doesn't happen with Go 1.16. I have been checking all versions and it starts in Go 1.17 If I run the program with go run instead of compiling and running the binary, I can't reproduce it. Sometimes it starts after a couple of http calls and sometimes I do a few "wrk -d2 http://localhost:8080" calls to trigger it (wrk is a web stress tool). But as soon as it starts making the nanosleep calls, it doesn't stop, no matter how long the server is iddle. If I remove the timeout values or set them to a short period, like one second for example, I am also not able to reproduce it. But with longer values it happens very quickly. I am surprised of not seing it reported. Do you know what can be going on? Thank you! -- You received this message because you are subscribed to the Google Groups "golang-nuts" group. To unsubscribe from this group and stop receiving emails from it, send an email to golang-nuts+unsubscr...@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/golang-nuts/02755312-8e26-460b-a81e-7cf83e95e7a1n%40googlegroups.com.