Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixes #12289 - Improve ConcurrentPool concurrency. #12290

Merged
merged 3 commits into from
Sep 20, 2024

Conversation

sbordet
Copy link
Contributor

@sbordet sbordet commented Sep 18, 2024

A call to sweep(), although protected by the lock for concurrent calls to reserve(), may be concurrent with remove(Entry).

remove(Entry) in turn calls entries.remove(Object), so that the concurrent iteration in sweep() over entries fails with an ArrayIndexOutOfBoundsException.

Now using the bulk entries.removeIf(Predicate) method in sweep(), so that sweeping is atomic with respect to entries.remove(Object).

A call to `sweep()`, although protected by the lock for concurrent calls to `reserve()`, may be concurrent with `remove(Entry)`.

`remove(Entry)` in turn calls `entries.remove(Object)`, so that the concurrent iteration in `sweep()` over `entries` fails with an `ArrayIndexOutOfBoundsException`.

Now using the bulk `entries.removeIf(Predicate)` method in `sweep()`, so that sweeping is atomic with respect to `entries.remove(Object)`.

Signed-off-by: Simone Bordet <[email protected]>
@sbordet sbordet added the Sponsored This issue affects a user with a commercial support agreement label Sep 18, 2024
@sbordet sbordet linked an issue Sep 18, 2024 that may be closed by this pull request
… that may be concurrent with removals.

Signed-off-by: Simone Bordet <[email protected]>
Signed-off-by: Simone Bordet <[email protected]>
@sbordet sbordet requested a review from lorban September 20, 2024 12:16
@sbordet sbordet merged commit 115ee1c into jetty-12.0.x Sep 20, 2024
6 of 10 checks passed
@sbordet sbordet deleted the fix/jetty-12.0.x/12289/improve-concurrentpool branch September 20, 2024 13:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Sponsored This issue affects a user with a commercial support agreement
Projects
Status: ✅ Done
Development

Successfully merging this pull request may close these issues.

Improve ConcurrentPool concurrency
2 participants