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

Cannot invoke "org.eclipse.jetty.io.RetainableByteBuffer.getByteBuffer()" because "buffer" is null #12790

Open
lukaszn-rtbhouse opened this issue Feb 12, 2025 · 2 comments · May be fixed by #12799
Assignees
Labels
Bug For general bugs on Jetty side

Comments

@lukaszn-rtbhouse
Copy link

Jetty version(s)

12.0.16

Jetty Environment

ee8

Java version/vendor (use: java -version)

openjdk version "22.0.2" 2024-07-16
OpenJDK Runtime Environment Temurin-22.0.2+9 (build 22.0.2+9)
OpenJDK 64-Bit Server VM Temurin-22.0.2+9 (build 22.0.2+9, mixed mode, sharing)

OS type/version

Linux 6.1.0-1015-oem #15-Ubuntu SMP PREEMPT_DYNAMIC Fri Jun 16 09:51:49 UTC 2023 x86_64 x86_64 x86_64 GNU/Linux

Description

We register a consistent rate of NPEs on multiple servers running jetty since at least Dec 2024. They surface when serializing JSON responses with Jackson. The response size is < 3kB.

Caused by: java.lang.NullPointerException: Cannot invoke "org.eclipse.jetty.io.RetainableByteBuffer.getByteBuffer()" because "buffer" is null
        at org.eclipse.jetty.io.ArrayByteBufferPool.release(ArrayByteBufferPool.java:281)
        at org.eclipse.jetty.io.ArrayByteBufferPool$Buffer.release(ArrayByteBufferPool.java:653)
        at org.eclipse.jetty.io.ArrayByteBufferPool.removeAndRelease(ArrayByteBufferPool.java:244)
        at org.eclipse.jetty.ee8.nested.HttpOutput.lockedReleaseBuffer(HttpOutput.java:599)
        at org.eclipse.jetty.ee8.nested.HttpOutput.onWriteComplete(HttpOutput.java:310)
        at org.eclipse.jetty.ee8.nested.HttpOutput.close(HttpOutput.java:573)
        at org.eclipse.jetty.io.WriteThroughWriter.close(WriteThroughWriter.java:103)
        at org.eclipse.jetty.ee8.nested.ResponseWriter.close(ResponseWriter.java:136)
        ...

Caused by: java.lang.NullPointerException: Cannot invoke "org.eclipse.jetty.io.RetainableByteBuffer.getByteBuffer()" because "buffer" is null
        at org.eclipse.jetty.io.ArrayByteBufferPool.release(ArrayByteBufferPool.java:281)
        at org.eclipse.jetty.io.ArrayByteBufferPool$Buffer.release(ArrayByteBufferPool.java:653)
        at org.eclipse.jetty.io.ArrayByteBufferPool.removeAndRelease(ArrayByteBufferPool.java:244)
        at org.eclipse.jetty.ee8.nested.HttpOutput.lockedReleaseBuffer(HttpOutput.java:599)
        at org.eclipse.jetty.ee8.nested.HttpOutput.onWriteComplete(HttpOutput.java:310)
        at org.eclipse.jetty.ee8.nested.HttpOutput.write(HttpOutput.java:781)
        at java.base/java.io.ByteArrayOutputStream.writeTo(ByteArrayOutputStream.java:170)
        at org.eclipse.jetty.io.WriteThroughWriter$Utf8Writer.append(WriteThroughWriter.java:335)
        at org.eclipse.jetty.io.WriteThroughWriter.write(WriteThroughWriter.java:133)
        at org.eclipse.jetty.ee8.nested.ResponseWriter.write(ResponseWriter.java:174)
        ...

How to reproduce?

Not sure yet. Flagging the issue in case somebody with context about Jetty can help pin down the problem.

@lukaszn-rtbhouse lukaszn-rtbhouse added the Bug For general bugs on Jetty side label Feb 12, 2025
@lorban
Copy link
Contributor

lorban commented Feb 17, 2025

This looks similar to #12623

lorban added a commit that referenced this issue Feb 17, 2025
Signed-off-by: Ludovic Orban <[email protected]>
@lorban
Copy link
Contributor

lorban commented Feb 17, 2025

It looks like ArrayByteBufferPool.removeAndRelease() is broken when the RetainableByteBuffer instance comes from QueuedPool, I could reproduce the problem here: #12799

We should be able to fix that shortly.

lorban added a commit that referenced this issue Feb 17, 2025
Signed-off-by: Ludovic Orban <[email protected]>
@lorban lorban self-assigned this Feb 17, 2025
@lorban lorban moved this to 👀 In review in Jetty 12.0.18 Feb 17, 2025
@lorban lorban moved this from 👀 In review to 🏗 In progress in Jetty 12.0.18 Feb 17, 2025
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: 🏗 In progress
2 participants