Join GitHub today
GitHub is home to over 36 million developers working together to host and review code, manage projects, and build software together.Sign up
net/http: ResponseHeaderTimeout can cause the Heap & GC to grow/increase rapidly #9104
go1.3.3 although go1.4 will have this problem as well When using the DefaultTransport, in our case it was via the ReverseProxy, the ResponseHeaderTimeout will create a timer that is never closed. The code relies on expiring. If you have a proxy under load and a timeout that is long in our case 15 minutes but even anything in the range of 2-5 minutes, the number of timers starts to overwhelm the Heap and GC. In our simple runs under load, we can generate 10k req/s. We see the heap grow from 2Mb to 90Mb all due to timers. The GC cycle starts at 2ms and grows to 120ms. Our current workaround is to avoid setting the ResponseHeaderTimeout and rely on DeadlineTimeouts. Closing the timers created persistConn.roundTrip() would also alleviated the explosion.