Skip to content

Extended Events commands leave one reconnected store connection checked out per pipeline #10658

Description

@andreasjordan

Deferred from PR #10635, whose description names it "deliberately left for a follow-up" — recording it so the follow-up has a tracker.

Behavior

PR #10635 closes the cloned connection behind the XEStore that Get-DbaXESession creates, which removed the bulk of the Extended Events connection leak. A smaller, separate mechanism remains: the emitted session objects keep a functional Store note property, and when a downstream command uses that store (piped Start-DbaXESession, Stop-DbaXESession, ...), SFC transparently reconnects it from the pool — and that reopened connection stays checked out, once per pipeline, until the process exits.

Measured in the lab (SQL03\SQL2019, isolated runner measurements of the family test files, after #10635): Start-DbaXESession still leaves 7 sleeping sessions (down from 15), Remove-DbaXESession 2 (from 6), ConvertTo-DbaXESession 3 (from 7). The residue is this reconnect mechanism.

Fix shape

Consumer-side disconnects: each command that operates through a piped object's store closes the store connection when it reopened it — several commands (Start-, Stop-, Remove-, ConvertTo-DbaXESession, the Watch/Export family), each with its own before/after measurement, following the counting-test pattern established in #10633#10635. Needs care that a store used repeatedly within one command is not churned open/closed per operation.

Related: the sleeping-connection inventory that found the family (first -CheckSleepingConnections full lab run, 2026-08-28) and the ownership pattern from #10554.

This issue was created by Claude and reviewed by Andreas Jordan.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions