diff --git a/CHANGELOG.md b/CHANGELOG.md index d680e4d7a4..d50f842b42 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -8,6 +8,7 @@ ### Bugfixes - [#2181](https://github.com/influxdb/influxdb/pull/2181): Fix panic on "SHOW DIAGNOSTICS". - [#2170](https://github.com/influxdb/influxdb/pull/2170): Make sure queries on missing tags return 200 status. +- [#2197](https://github.com/influxdb/influxdb/pull/2197): Lock server during Open(). ## v0.9.0-rc20 [2015-04-04] diff --git a/server.go b/server.go index b25044e0cc..a5a0b5542d 100644 --- a/server.go +++ b/server.go @@ -172,6 +172,9 @@ func (s *Server) metaPath() string { // Open initializes the server from a given path. func (s *Server) Open(path string, client MessagingClient) error { + s.mu.Lock() + defer s.mu.Unlock() + // Ensure the server isn't already open and there's a path provided. if s.opened() { return ErrServerOpen @@ -224,7 +227,7 @@ func (s *Server) Open(path string, client MessagingClient) error { return nil } -// opened returns true when the server is open. +// opened returns true when the server is open. Must be called under lock. func (s *Server) opened() bool { return s.path != "" } // Close shuts down the server.