mirror of
https://github.com/prometheus/prometheus
synced 2025-01-02 20:42:11 +00:00
Merge pull request #15723 from machine424/eng-clos
fix(main.go): avoid closing the query engine until it is guaranteed to no longer be in use.
This commit is contained in:
commit
2dfb4fdafb
@ -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 New Issue
Block a user