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.
|
- [#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.
|
- [#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.
|
- [#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]
|
## 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{})
|
closing := make(chan struct{})
|
||||||
if notifier, ok := w.(http.CloseNotifier); ok {
|
if notifier, ok := w.(http.CloseNotifier); ok {
|
||||||
notify := notifier.CloseNotify()
|
notify := notifier.CloseNotify()
|
||||||
|
done := make(chan struct{})
|
||||||
|
defer close(done)
|
||||||
go func() {
|
go func() {
|
||||||
<-notify
|
// Wait for either the request to finish
|
||||||
close(closing)
|
// or for the client to disconnect
|
||||||
|
select {
|
||||||
|
case <-done:
|
||||||
|
case <-notify:
|
||||||
|
close(closing)
|
||||||
|
}
|
||||||
}()
|
}()
|
||||||
} else {
|
} else {
|
||||||
defer close(closing)
|
defer close(closing)
|
||||||
|
|
Loading…
Reference in New Issue