Address race conditions when booting a server process
This commit is contained in:
parent
daf682b991
commit
21303dc517
|
@ -127,6 +127,9 @@ func (h *Handler) TokenValid() error {
|
|||
return errors.New("jwt does not have connect permission")
|
||||
}
|
||||
|
||||
h.server.RLock()
|
||||
defer h.server.RUnlock()
|
||||
|
||||
if h.server.Uuid != j.ServerUUID {
|
||||
return errors.New("jwt server uuid mismatch")
|
||||
}
|
||||
|
@ -247,6 +250,9 @@ func (h *Handler) HandleInbound(m Message) error {
|
|||
if state == server.ProcessOfflineState {
|
||||
_ = h.server.Filesystem.HasSpaceAvailable()
|
||||
|
||||
h.server.Resources.RLock()
|
||||
defer h.server.Resources.RUnlock()
|
||||
|
||||
resources := server.ResourceUsage{
|
||||
Memory: 0,
|
||||
MemoryLimit: 0,
|
||||
|
|
|
@ -33,6 +33,9 @@ func (s *Server) UpdateDataStructure(data []byte, background bool) error {
|
|||
return errors.WithStack(err)
|
||||
}
|
||||
|
||||
s.Lock()
|
||||
defer s.Unlock()
|
||||
|
||||
// Don't explode if we're setting CPU limits to 0. Mergo sees that as an empty value
|
||||
// so it won't override the value we've passed through in the API call. However, we can
|
||||
// safely assume that we're passing through valid data structures here. I foresee this
|
||||
|
|
Loading…
Reference in New Issue
Block a user