Skip to content

fix(db): a lease released after an interrupt does not touch the entry that replaced it (#1213) - #1219

Merged
ZhuchkaTriplesix merged 1 commit into
devfrom
fix/1213-lease-release-identity
Oct 9, 2026
Merged

ZhuchkaTriplesix merged 1 commit into
devfrom
fix/1213-lease-release-identity

Conversation

@ZhuchkaTriplesix

@ZhuchkaTriplesix ZhuchkaTriplesix commented Oct 9, 2026 •

Copy link
Copy Markdown
Member

Closes #1213

What was wrong

A lease kept only the pool key. After interrupt removed an entry, a lease taken before it still released by key, which found the entry created afterwards and decremented its refcount. The replacement could reach zero while in use, and the idle timer then disconnected the session under its user, with Not connected to … on the next statement.

Changes

  • In the PostgreSQL, MySQL and SQLite pools a lease holds its _PoolEntry; entries know their key.
  • _release ignores an entry that is no longer in the pool under its key, and the idle timer checks the same identity before disconnecting.
  • An assert catches a release count that goes below zero.
  • A test per pool: release of a lease from before an interrupt keeps the replacement connected, and it is disconnected only after its own last release.

Not verified locally

Tests were not run locally, per the project rule. CI runs the three new tests.

@github-actions github-actions Bot added bug Something isn't working stability Theme parser epic label: stability core Core library logic and services connections Database connections, URI parsing, pools P1 High priority / Core capability labels Oct 9, 2026
… that replaced it (#1213)

A lease kept only the pool key, so releasing a lease taken before an interrupt
decremented the entry created after it under the same key. The replacement's
refcount then reached zero while still in use, and the idle timer disconnected
the session under its user. A lease now holds its entry, and release does
nothing for an entry that is no longer in the pool. Applied to the PostgreSQL,
MySQL and SQLite pools, with a test in each.
@ZhuchkaTriplesix
ZhuchkaTriplesix force-pushed the fix/1213-lease-release-identity branch from 7bd4dd2 to 8a17e9e Compare October 9, 2026 09:14
@ZhuchkaTriplesix
ZhuchkaTriplesix merged commit f928e6d into dev Oct 9, 2026
15 checks passed
@github-actions

github-actions Bot commented Oct 9, 2026

Copy link
Copy Markdown

Grid scroll benchmark

metric base PR change
p50 12.21 ms 17.49 ms +43.2% ⚠️
p90 23.06 ms 25.47 ms +10.5% ⚠️
p99 47.39 ms 57.36 ms +21.0% ⚠️
stutters 280.00 271.00 -3.2%

Informational only (threshold 5%). Shared CI runners are noisy; re-run before trusting a single result.

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

Labels

bug Something isn't working connections Database connections, URI parsing, pools core Core library logic and services P1 High priority / Core capability stability Theme parser epic label: stability

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant