Skip to content

Evict lingering sessions when enabling read_committed_snapshot on tem…#957

Merged
SimonCropp merged 1 commit into
mainfrom
Evict-lingering-sessions-when-enabling-read_committed_snapshot-on-template
May 24, 2026
Merged

Evict lingering sessions when enabling read_committed_snapshot on tem…#957
SimonCropp merged 1 commit into
mainfrom
Evict-lingering-sessions-when-enabling-read_committed_snapshot-on-template

Conversation

@SimonCropp
Copy link
Copy Markdown
Owner

…plate

Evict lingering sessions when enabling read_committed_snapshot on template read_committed_snapshot requires exclusive access to the database. The ALTER added in #932 had no termination clause, so it waited for any session a buildTemplate/callback left open instead of evicting it, blocking until the command timeout (Execution Timeout Expired). This surfaced in consumers whose callback builds schema via an SMO ServerConnection, which holds a connection to the template open persistently. LocalDb's own EF callbacks close their connections, so CI stayed green.
Add "with rollback immediate" so the statement evicts other sessions, consistent with the surrounding single_user/detach commands. Add regression test BuildTemplateLeavesConnectionOpen: without the fix the rebuild hangs ~35s then fails; with it, passes in ~10s.

…plate

Evict lingering sessions when enabling read_committed_snapshot on template
read_committed_snapshot requires exclusive access to the database. The
ALTER added in #932 had no termination clause, so it waited for any
session a buildTemplate/callback left open instead of evicting it,
blocking until the command timeout (Execution Timeout Expired).
This surfaced in consumers whose callback builds schema via an SMO
ServerConnection, which holds a connection to the template open
persistently. LocalDb's own EF callbacks close their connections, so CI
stayed green.
Add "with rollback immediate" so the statement evicts other sessions,
consistent with the surrounding single_user/detach commands.
Add regression test BuildTemplateLeavesConnectionOpen: without the fix
the rebuild hangs ~35s then fails; with it, passes in ~10s.
@SimonCropp SimonCropp added this to the 24.1.1 milestone May 24, 2026
@SimonCropp SimonCropp merged commit 7426d23 into main May 24, 2026
4 of 6 checks passed
@SimonCropp SimonCropp deleted the Evict-lingering-sessions-when-enabling-read_committed_snapshot-on-template branch May 24, 2026 23:23
@github-actions github-actions Bot restored the Evict-lingering-sessions-when-enabling-read_committed_snapshot-on-template branch May 24, 2026 23:23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant