mirror of
https://github.com/prometheus/prometheus.git
synced 2025-02-02 08:31:11 -08:00
fix(main.go): avoid closing the query engine until it is guaranteed to no longer be in use.
partially reverts https://github.com/prometheus/prometheus/pull/14064 fixes https://github.com/prometheus/prometheus/issues/15232 supersedes https://github.com/prometheus/prometheus/pull/15533 reusing Engine.Close() outside of tests will require more consideration. Signed-off-by: machine424 <ayoubmrini424@gmail.com>
This commit is contained in:
parent
08c81b721a
commit
9823a93c42
|
@ -989,18 +989,12 @@ func main() {
|
|||
listeners, err := webHandler.Listeners()
|
||||
if err != nil {
|
||||
logger.Error("Unable to start web listener", "err", err)
|
||||
if err := queryEngine.Close(); err != nil {
|
||||
logger.Warn("Closing query engine failed", "err", err)
|
||||
}
|
||||
os.Exit(1)
|
||||
}
|
||||
|
||||
err = toolkit_web.Validate(*webConfig)
|
||||
if err != nil {
|
||||
logger.Error("Unable to validate web configuration file", "err", err)
|
||||
if err := queryEngine.Close(); err != nil {
|
||||
logger.Warn("Closing query engine failed", "err", err)
|
||||
}
|
||||
os.Exit(1)
|
||||
}
|
||||
|
||||
|
@ -1022,9 +1016,6 @@ func main() {
|
|||
case <-cancel:
|
||||
reloadReady.Close()
|
||||
}
|
||||
if err := queryEngine.Close(); err != nil {
|
||||
logger.Warn("Closing query engine failed", "err", err)
|
||||
}
|
||||
return nil
|
||||
},
|
||||
func(err error) {
|
||||
|
|
|
@ -436,6 +436,8 @@ func NewEngine(opts EngineOpts) *Engine {
|
|||
}
|
||||
|
||||
// Close closes ng.
|
||||
// Callers must ensure the engine is really no longer in use before calling this to avoid
|
||||
// issues failures like in https://github.com/prometheus/prometheus/issues/15232
|
||||
func (ng *Engine) Close() error {
|
||||
if ng == nil {
|
||||
return nil
|
||||
|
|
Loading…
Reference in a new issue