Skip to content

Fix NPE when re-using ArrayByteBufferPool after it was cleared when the QueuedPool is used - #15808

Merged
lorban merged 14 commits into
jetty-12.1.xfrom
fix/12.1.x/15807-npe-in-compounded-ArrayByteBufferPool-clear
Sep 24, 2026
Merged

lorban merged 14 commits into
jetty-12.1.xfrom
fix/12.1.x/15807-npe-in-compounded-ArrayByteBufferPool-clear

Conversation

@lorban

@lorban lorban commented Sep 17, 2026

Copy link
Copy Markdown
Contributor

Fixes #15807

…dPool is used

Signed-off-by: Ludovic Orban <lorban@bitronix.be>
Signed-off-by: Ludovic Orban <lorban@bitronix.be>
Comment thread jetty-core/jetty-io/src/main/java/org/eclipse/jetty/io/internal/QueuedPool.java Outdated
… update the queueSize

Signed-off-by: Ludovic Orban <lorban@bitronix.be>
@lorban
lorban requested a review from sbordet September 18, 2026 06:50
Signed-off-by: Ludovic Orban <lorban@bitronix.be>
Signed-off-by: Ludovic Orban <lorban@bitronix.be>

private void remove(QueuedEntry<P> entry)
{
if (queue.remove(entry))

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think this is right WRT the comment in QueuedPool.terminate().
Either we change this, or change that comment if it's ok to concurrently remove entries while terminate() runs.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good catch, I've now revised remove() and terminate() to better align how they work and I added an extra test asserting they stay coherent.

Signed-off-by: Ludovic Orban <lorban@bitronix.be>
@lorban
lorban requested a review from sbordet September 18, 2026 08:34
Comment thread jetty-core/jetty-io/src/main/java/org/eclipse/jetty/io/internal/QueuedPool.java Outdated
Comment thread jetty-core/jetty-io/src/main/java/org/eclipse/jetty/io/internal/QueuedPool.java Outdated
Signed-off-by: Ludovic Orban <lorban@bitronix.be>
@sbordet
sbordet self-requested a review September 21, 2026 07:38
…e that the action can never succeed

Signed-off-by: Ludovic Orban <lorban@bitronix.be>
Signed-off-by: Ludovic Orban <lorban@bitronix.be>
…needs to be nulled to enact a state change

Signed-off-by: Ludovic Orban <lorban@bitronix.be>
…n the list

Signed-off-by: Ludovic Orban <lorban@bitronix.be>
Comment thread jetty-core/jetty-util/src/main/java/org/eclipse/jetty/util/ConcurrentPool.java Outdated
…ect one and try to remove it

Signed-off-by: Ludovic Orban <lorban@bitronix.be>
… known out-of-pool entries to avoid scanning the queue in the common case

Signed-off-by: Ludovic Orban <lorban@bitronix.be>
@lorban
lorban requested a review from sbordet September 23, 2026 10:19
Comment thread jetty-core/jetty-io/src/main/java/org/eclipse/jetty/io/internal/QueuedPool.java Outdated
…ns an empty queue per remove() call

Signed-off-by: Ludovic Orban <lorban@bitronix.be>
@lorban
lorban merged commit 0b571ef into jetty-12.1.x Sep 24, 2026
11 checks passed
@github-project-automation github-project-automation Bot moved this from 👀 In review to ✅ Done in Jetty 12.1.14 FROZEN Sep 24, 2026
@lorban
lorban deleted the fix/12.1.x/15807-npe-in-compounded-ArrayByteBufferPool-clear branch September 24, 2026 07:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Bug For general bugs on Jetty side

Projects

Status: ✅ Done

Development

Successfully merging this pull request may close these issues.

ArrayByteBufferPool.clear() leaves the bucket's secondary QueuedPool poisoned: NPE on the next acquire()

2 participants