diff --git a/CHANGELOG.md b/CHANGELOG.md index 6115fb0fc..4547c357e 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -16,6 +16,8 @@ Canonical reference for changes, improvements, and bugfixes for Boundary. could be written to stdout along with a message that they could not successfully be evented instead of being written to the event log ([PR](https://github.com/hashicorp/boundary/pull/2544)) +* workers: Fixed a panic that can happen in certain situations + ([PR](https://github.com/hashicorp/boundary/pull/2553)) ## 0.11.0 (2022/09/27) diff --git a/internal/daemon/worker/session/session.go b/internal/daemon/worker/session/session.go index 1f8e34042..7562f7b4a 100644 --- a/internal/daemon/worker/session/session.go +++ b/internal/daemon/worker/session/session.go @@ -313,6 +313,8 @@ func (s *sess) RequestConnectConnection(ctx context.Context, info *pbs.ConnectCo // // The returned slice are connection ids that were closed. func (s *sess) CancelOpenLocalConnections() []string { + s.lock.RLock() + defer s.lock.RUnlock() var closedIds []string for k, v := range s.connInfoMap { if v.Status != pbs.CONNECTIONSTATUS_CONNECTIONSTATUS_CLOSED { @@ -336,6 +338,8 @@ func (s *sess) CancelOpenLocalConnections() []string { // // The returned slice is the connection ids which were closed. func (s *sess) CancelAllLocalConnections() []string { + s.lock.RLock() + defer s.lock.RUnlock() var closedIds []string for k, v := range s.connInfoMap { v.connCtxCancelFunc()