Skip to content

Commit 30a57dd

Browse files
lauranetoclaude
andauthored
Content Publishing: Fix deadlocks by acquiring WriteLock at outer scope (#21105)
fix: add write lock at outer scope to prevent deadlocks in content publishing Acquire a write lock on ContentTree at the start of PublishAsync to prevent deadlocks. Previously, inner scopes would acquire read locks first (via repository operations), then attempt to upgrade to write locks, causing deadlocks when multiple transactions tried this simultaneously. By acquiring the write lock at the outer scope, we ensure consistent lock ordering and prevent the deadlock scenario. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-authored-by: Claude Opus 4.5 <[email protected]>
1 parent 3fa053a commit 30a57dd

File tree

1 file changed

+1
-0
lines changed

1 file changed

+1
-0
lines changed

src/Umbraco.Core/Services/ContentPublishingService.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -110,6 +110,7 @@ private async Task<Attempt<ContentPublishingResult, ContentPublishingOperationSt
110110
Guid userKey)
111111
{
112112
using ICoreScope scope = _coreScopeProvider.CreateCoreScope();
113+
scope.WriteLock(Constants.Locks.ContentTree);
113114
IContent? content = _contentService.GetById(key);
114115
if (content is null)
115116
{

0 commit comments

Comments
 (0)