Skip to content

fix(server): stop scene lock release from getting stuck on a canceled context (REL-03) - #2371

Open
wilfredmulenga wants to merge 2 commits into
mainfrom
note-rel-03-scene-lock-context-cancel
Open

fix(server): stop scene lock release from getting stuck on a canceled context (REL-03)#2371
wilfredmulenga wants to merge 2 commits into
mainfrom
note-rel-03-scene-lock-context-cancel

Conversation

@wilfredmulenga

@wilfredmulenga wilfredmulenga commented Aug 5, 2026

Copy link
Copy Markdown
Contributor

REL-03 from the compliance scan flags that ReleaseSceneLock discards SaveLock's error and reuses the same request context the failed publish was using. If that context is already canceled (client disconnected mid upload), the SaveLock write can fail silently and the scene lock stays stuck at LockModePublishing, blocking every later mutation on that scene (layer/property/style edits, further publishes, even deletion) until the next process restart.

Detaches the context before saving the lock, bounded by a short timeout, and logs the error instead of swallowing it. Same pattern already used elsewhere in this codebase for a status write that needs to survive a canceled parent context.

Added a regression test that fails without the fix (SaveLock receiving an already-canceled context) and passes with it.

…se (REL-03)

Explains why ReleaseSceneLock keeps discarding SaveLock's error and reusing
the caller's (possibly canceled) context instead of detaching it.
Copilot AI lite review requested due to automatic review settings August 5, 2026 21:29
@github-actions github-actions Bot added the server label Aug 5, 2026

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Documents an accepted REL-03 compliance-scan risk in ReleaseSceneLock, clarifying why SaveLock errors (including context canceled) are intentionally ignored and how stuck locks are recovered on process startup.

Changes:

  • Adds a function-level comment explaining that ReleaseSceneLock reuses the caller’s context and discards SaveLock errors (REL-03).
  • Describes the rare failure mode (caller context canceled) and the operational recovery path (SceneLock.ReleaseAllLock on startup).

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread server/internal/usecase/interactor/common.go Outdated
… context

ReleaseSceneLock is deferred from publish flows using the same request
context the publish itself used. If that context was already canceled
(client disconnected mid upload), the SaveLock write failed silently and
the scene stayed locked forever, since sceneLock has no TTL and the only
other unlock path runs solely at process startup (REL-03, compliance scan).

Detach the context before saving, bounded by a short timeout, and log the
error instead of swallowing it.
@wilfredmulenga wilfredmulenga changed the title docs(server): note accepted risk of context-canceled scene lock release fix(server): stop scene lock release from getting stuck on a canceled context Aug 5, 2026
@wilfredmulenga wilfredmulenga changed the title fix(server): stop scene lock release from getting stuck on a canceled context fix(server): stop scene lock release from getting stuck on a canceled context (REL-03) Aug 17, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants