diff --git a/CHANGELOG.md b/CHANGELOG.md index 75fcf806fd..7256f5657b 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -28,6 +28,7 @@ - [#9230](https://github.com/influxdata/influxdb/pull/9230): Remove extraneous newlines from the log. - [#9226](https://github.com/influxdata/influxdb/issues/9226): Allow lone boolean literals in a condition expression. - [#9235](https://github.com/influxdata/influxdb/pull/9235): Improve performance when writes exceed `max-values-per-tag` or `max-series`. +- [#9216](https://github.com/influxdata/influxdb/issues/9216): Prevent a panic when a query simultaneously finishes and is killed at the same time. ## v1.4.3 [unreleased] diff --git a/query/query_executor.go b/query/query_executor.go index 885566a260..08ae6b673c 100644 --- a/query/query_executor.go +++ b/query/query_executor.go @@ -508,6 +508,8 @@ func (q *QueryTask) monitor(fn QueryMonitorFunc) { func (q *QueryTask) close() { q.mu.Lock() if q.status != KilledTask { + // Set the status to killed to prevent closing the channel twice. + q.status = KilledTask close(q.closing) } q.mu.Unlock()