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

NPE in ArrayByteBufferPool.findOldestEntry() #10211

Closed
sbordet opened this issue Aug 2, 2023 · 0 comments · Fixed by #10212
Closed

NPE in ArrayByteBufferPool.findOldestEntry() #10211

sbordet opened this issue Aug 2, 2023 · 0 comments · Fixed by #10212
Assignees
Labels
Bug For general bugs on Jetty side

Comments

@sbordet
Copy link
Contributor

sbordet commented Aug 2, 2023

Jetty version(s)
10+

Description

Below the stack trace in 12, but I think the problem may happen in 10/11 too.

java.lang.NullPointerException: Cannot invoke "org.eclipse.jetty.io.ArrayByteBufferPool$Buffer.getLastNanoTime()" because the return value of "org.eclipse.jetty.util.Pool$Entry.getPooled()" is null
        at org.eclipse.jetty.io.ArrayByteBufferPool.lambda$findOldestEntry$6(ArrayByteBufferPool.java:440)
        at java.base/java.util.Comparator.lambda$comparingLong$6043328a$1(Comparator.java:515)
        at java.base/java.util.function.BinaryOperator.lambda$maxBy$1(BinaryOperator.java:74)
        at java.base/java.util.stream.ReduceOps$2ReducingSink.accept(ReduceOps.java:123)
        at java.base/java.util.Spliterators$ArraySpliterator.forEachRemaining(Spliterators.java:1006)
        at java.base/java.util.stream.AbstractPipeline.copyInto(AbstractPipeline.java:509)
        at java.base/java.util.stream.AbstractPipeline.wrapAndCopyInto(AbstractPipeline.java:499)
        at java.base/java.util.stream.ReduceOps$ReduceOp.evaluateSequential(ReduceOps.java:921)
        at java.base/java.util.stream.AbstractPipeline.evaluate(AbstractPipeline.java:234)
        at java.base/java.util.stream.ReferencePipeline.reduce(ReferencePipeline.java:662)
        at java.base/java.util.stream.ReferencePipeline.max(ReferencePipeline.java:698)
        at org.eclipse.jetty.io.ArrayByteBufferPool.findOldestEntry(ArrayByteBufferPool.java:440)
        at org.eclipse.jetty.io.ArrayByteBufferPool.evict(ArrayByteBufferPool.java:393)
        at org.eclipse.jetty.io.ArrayByteBufferPool.releaseExcessMemory(ArrayByteBufferPool.java:370)
        at org.eclipse.jetty.io.ArrayByteBufferPool.acquire(ArrayByteBufferPool.java:207)
        at org.eclipse.jetty.http2.HTTP2Connection$NetworkBuffer.<init>(HTTP2Connection.java:500)
        at org.eclipse.jetty.http2.HTTP2Connection$HTTP2Producer.acquireNetworkBuffer(HTTP2Connection.java:401)
        at org.eclipse.jetty.http2.HTTP2Connection$HTTP2Producer.produce(HTTP2Connection.java:338)
        at org.eclipse.jetty.util.thread.strategy.AdaptiveExecutionStrategy.produceTask(AdaptiveExecutionStrategy.java:512)
        at org.eclipse.jetty.util.thread.strategy.AdaptiveExecutionStrategy.tryProduce(AdaptiveExecutionStrategy.java:258)
        at org.eclipse.jetty.util.thread.strategy.AdaptiveExecutionStrategy.produce(AdaptiveExecutionStrategy.java:195)
        at org.eclipse.jetty.http2.HTTP2Connection.produce(HTTP2Connection.java:211)
        at org.eclipse.jetty.http2.HTTP2Connection.onFillable(HTTP2Connection.java:158)
        at org.eclipse.jetty.http2.HTTP2Connection$FillableCallback.succeeded(HTTP2Connection.java:449)
        at org.eclipse.jetty.io.FillInterest.fillable(FillInterest.java:100)
        at org.eclipse.jetty.io.ssl.SslConnection$SslEndPoint.onFillable(SslConnection.java:554)
        at org.eclipse.jetty.io.ssl.SslConnection.onFillable(SslConnection.java:373)
        at org.eclipse.jetty.io.ssl.SslConnection$2.succeeded(SslConnection.java:146)
        at org.eclipse.jetty.io.FillInterest.fillable(FillInterest.java:100)
        at org.eclipse.jetty.io.SelectableChannelEndPoint$1.run(SelectableChannelEndPoint.java:53)
        at org.eclipse.jetty.util.thread.strategy.AdaptiveExecutionStrategy.runTask(AdaptiveExecutionStrategy.java:478)
        at org.eclipse.jetty.util.thread.strategy.AdaptiveExecutionStrategy.consumeTask(AdaptiveExecutionStrategy.java:441)
        at org.eclipse.jetty.util.thread.strategy.AdaptiveExecutionStrategy.tryProduce(AdaptiveExecutionStrategy.java:293)
        at org.eclipse.jetty.util.thread.strategy.AdaptiveExecutionStrategy.run(AdaptiveExecutionStrategy.java:201)
        at org.eclipse.jetty.util.thread.ReservedThreadExecutor$ReservedThread.run(ReservedThreadExecutor.java:410)
        at org.eclipse.jetty.util.thread.QueuedThreadPool.runJob(QueuedThreadPool.java:969)
        at org.eclipse.jetty.util.thread.QueuedThreadPool$Runner.doRunJob(QueuedThreadPool.java:1194)
        at org.eclipse.jetty.util.thread.QueuedThreadPool$Runner.run(QueuedThreadPool.java:1149)
        at java.base/java.lang.Thread.run(Thread.java:1623)
@sbordet sbordet added the Bug For general bugs on Jetty side label Aug 2, 2023
@sbordet sbordet self-assigned this Aug 2, 2023
sbordet added a commit that referenced this issue Aug 2, 2023
Fixed algorithm to check for oldest entry to avoid NPE.
Added comments for clarity.

Signed-off-by: Simone Bordet <[email protected]>
@sbordet sbordet linked a pull request Aug 2, 2023 that will close this issue
sbordet added a commit that referenced this issue Aug 2, 2023
* Fixes #10211 - NPE in ArrayByteBufferPool.findOldestEntry()

Fixed algorithm to check for oldest entry to avoid NPE.
Added comments for clarity.

Signed-off-by: Simone Bordet <[email protected]>
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
None yet
Development

Successfully merging a pull request may close this issue.

1 participant