Skip to content

fix(deployable): pin EnsureUploaded lock connection - #90

Open
theophanemayaud wants to merge 1 commit into
mainfrom
codex/pin-ensure-uploaded-connection
Open

fix(deployable): pin EnsureUploaded lock connection#90
theophanemayaud wants to merge 1 commit into
mainfrom
codex/pin-ensure-uploaded-connection

Conversation

@theophanemayaud

Copy link
Copy Markdown

Context

EnsureUploaded acquires a session-owned SQL Server application lock through *sql.DB and later releases it through another pool operation. database/sql can execute those calls on different physical sessions, causing SQL Server error 1223 (lock ... is not currently held) and leaving the original session responsible for the lock.

Changes

  • pin one *sql.Conn across lock acquisition, schema existence checking, upload, and lock release
  • reuse the pinned connection while retaining upload impersonation and transaction boundaries
  • release the lock with a non-cancelled cleanup context and return release failures instead of discarding them
  • add a SQL Server integration test that verifies schema creation runs on the session owning the application lock

The lock mode, timeout, schema/cache behavior, and public API remain unchanged.

@theophanemayaud theophanemayaud added bug Something isn't working go Pull requests that update Go code labels Jul 29, 2026
@theophanemayaud theophanemayaud self-assigned this Jul 29, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working go Pull requests that update Go code

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant