From ddca766827fb9ef2cd93de63713edb79a47b95eb Mon Sep 17 00:00:00 2001 From: Bradley Laney Date: Thu, 3 Oct 2024 15:17:52 -0400 Subject: [PATCH] fix: correct expToWebhookConfig cache locking (#10014) There is a write under a read lock, causing the master to crash in integration tests with `fatal error: concurrent map writes`. --- master/internal/webhooks/postgres_webhook.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/master/internal/webhooks/postgres_webhook.go b/master/internal/webhooks/postgres_webhook.go index 7555a3878d6..0fcad3f9762 100644 --- a/master/internal/webhooks/postgres_webhook.go +++ b/master/internal/webhooks/postgres_webhook.go @@ -148,8 +148,8 @@ func (l *WebhookManager) getWebhookConfig(ctx context.Context, expID *int) (*exp return nil, nil } - l.mu.RLock() - defer l.mu.RUnlock() + l.mu.Lock() + defer l.mu.Unlock() if config, ok := l.expToWebhookConfig[*expID]; ok { return config, nil