Skip to content

fix(core): preserve object pool disposal after overflow#435

Merged
yordis merged 1 commit into
masterfrom
yordis/fix-object-pool-overflow-disposal
Jul 14, 2026
Merged

fix(core): preserve object pool disposal after overflow#435
yordis merged 1 commit into
masterfrom
yordis/fix-object-pool-overflow-disposal

Conversation

@yordis

@yordis yordis commented Jul 13, 2026

Copy link
Copy Markdown
Member
  • prevent overflow attempts from leaving the pool in a permanently leased state
  • keep disposal callbacks reliable when callers return all leased objects after an overflow

Signed-off-by: Yordis Prieto <yordis.prieto@gmail.com>
@cursor

cursor Bot commented Jul 13, 2026

Copy link
Copy Markdown

PR Summary

Low Risk
Small, targeted change to ObjectPool lease accounting plus tests; low blast radius but touches shared infrastructure used for readers and scavenge backends.

Overview
Fixes ObjectPool<T>.Get() so a failed lease when the pool is at maxCount no longer leaves shutdown stuck: after rolling back the lease counter, it now invokes OnPoolDisposed() when the count reaches zero while the pool is already marked for disposal.

Adds ObjectPoolTests covering growth to the cap, reuse on Return, and full disposal of all leased items after an overflow Get, whether MarkForDisposal runs before or after returns.

Reviewed by Cursor Bugbot for commit baa51c9. Bugbot is set up for automated code reviews on this repo. Configure here.

@coderabbitai

coderabbitai Bot commented Jul 13, 2026

Copy link
Copy Markdown

Warning

Review limit reached

@yordis, you've reached your PR review limit, so we couldn't start this review.

Next review available in: 20 minutes

Enable usage-based reviews in Billing to review now. Otherwise, wait until the next included review is available.
You're only billed for reviews past your plan's rate limits ($0.25/file).

How can I continue?

After more reviews become available, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews.

How do review limits work?

CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability.

For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window.

Please refer docs for additional details.

Review details
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 7a92f539-0c0f-47e3-80e0-4f81c6df3c29

📥 Commits

Reviewing files that changed from the base of the PR and between a4326df and baa51c9.

📒 Files selected for processing (2)
  • src/EventStore.Core.XUnit.Tests/DataStructures/ObjectPoolTests.cs
  • src/EventStore.Core/DataStructures/ObjectPool.cs
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch yordis/fix-object-pool-overflow-disposal

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@yordis yordis merged commit b3941a3 into master Jul 14, 2026
21 checks passed
@yordis yordis deleted the yordis/fix-object-pool-overflow-disposal branch July 14, 2026 00:58
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