Merge pull request #6413 from aaronknister/http_goroutine_leak
Prevent goroutine leak from persistent http connectionspull/6414/head
commit
5a53fc5d0d
|
@ -27,6 +27,7 @@
|
|||
- [#6383](https://github.com/influxdata/influxdb/pull/6383): Recover from a panic during query execution.
|
||||
- [#3369](https://github.com/influxdata/influxdb/issues/3369): Detect when a timer literal will overflow or underflow the query engine.
|
||||
- [#6398](https://github.com/influxdata/influxdb/issues/6398): Fix CREATE RETENTION POLICY parsing so it doesn't consume tokens it shouldn't.
|
||||
- [#6413](https://github.com/influxdata/influxdb/pull/6413): Prevent goroutine leak from persistent http connections. Thanks @aaronknister.
|
||||
|
||||
## v0.12.1 [2016-04-08]
|
||||
|
||||
|
|
|
@ -294,9 +294,16 @@ func (h *Handler) serveQuery(w http.ResponseWriter, r *http.Request, user *meta.
|
|||
closing := make(chan struct{})
|
||||
if notifier, ok := w.(http.CloseNotifier); ok {
|
||||
notify := notifier.CloseNotify()
|
||||
done := make(chan struct{})
|
||||
defer close(done)
|
||||
go func() {
|
||||
<-notify
|
||||
close(closing)
|
||||
// Wait for either the request to finish
|
||||
// or for the client to disconnect
|
||||
select {
|
||||
case <-done:
|
||||
case <-notify:
|
||||
close(closing)
|
||||
}
|
||||
}()
|
||||
} else {
|
||||
defer close(closing)
|
||||
|
|
Loading…
Reference in New Issue