Skip to content

fix(pool): avoid formatting idle objects under lock in Pool::fmt - #494

Open
biaoma-ty wants to merge 1 commit into
apache:mainfrom
biaoma-ty:fix/pool-debug-lock-and-bounds
Open

biaoma-ty wants to merge 1 commit into
apache:mainfrom
biaoma-ty:fix/pool-debug-lock-and-bounds

Conversation

@biaoma-ty

Copy link
Copy Markdown
Contributor

Summary

  • Update fmt::Debug for pool::bounded::Pool and pool::unbounded::Pool to snapshot scalar status fields and format them after releasing the internal slots mutex, rather than formatting Mutex<PoolState<T>> (and internal Semaphore state on bounded pools) directly.
  • Remove the unnecessary M::Object: fmt::Debug / T: fmt::Debug bounds from both Pool Debug implementations and drop the unused #[derive(Debug)] on internal PoolState<T>.
  • Add regression tests verifying Pool::fmt works for non-Debug objects and never invokes user Debug implementations on idle objects.
  • Record the fix in CHANGELOG.md.

This branch has not been deployed

No deployments
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