You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
permessage-deflate keeps a Deflater per session even with server_no_context_takeover #15941
Jetty version(s)
12.1.14. 12.0.x and 13.0.x have the same code.
Jetty Environment
core
HTTP version
HTTP/1.1
Java version/vendor(use: java -version)
25
OS type/version
Any
Description
With server_no_context_takeover negotiated, a session should give its deflater back to the pool after each message. It does, but then takes a new one right away.
When the last frame of a message is sent, the extension releases the deflater. Then OutgoingFlusher.onFrame clears the deflater's input, which was added in #13034 for #13029. It gets the deflater through getDeflater(), and because the old one was just released, that takes a new one from the pool. The session keeps it until its next message or until it closes.
Each deflater holds a few hundred KB of native memory, so this adds up with many idle sessions. On a bare 12.1.14 server with ~1,900 open sessions we saw ~1,900 live deflaters and about 1 GB extra RSS.
How to reproduce?
Start a 12.1.x server with a WebSocket endpoint.
Connect a few hundred clients that offer permessage-deflate with server_no_context_takeover.
Send one message from the server to each client.
Count the live deflaters with jcmd <pid> GC.class_histogram | grep 'java.util.zip.Deflater '. There is one per session. It should be only a few, because idle sessions shouldn't hold one.
The test in #15942 does the same directly against the extension and fails without the fix.
Activity
Issue jetty#15941 - use shared WebSocketComponents in deflater test
Issue jetty#15941 - simplify deflater release test
Issue jetty#15941 - simplify deflater release test
Issue jetty#15941 - use shared WebSocketComponents in deflater test
Issue jetty#15941 - release Deflater after each message without conte…
Issue #15941 - release Deflater after each message without context ta…
Merge pull request #15942 from stefanroex/fix/15941/jetty-12.1.x/perm…
Merge pull request #15943 from stefanroex/fix/15941/jetty-12.0.x/perm…
lachlan-roberts commentedon Oct 12, 2026
@stefanroex thanks for the PRs!
They have now been merged into both
12.1.xand12.0.xbranches, and will be available in the next releases of12.1.15and12.0.41.stefanroex commentedon Oct 12, 2026
Thanks for the review and the quick turnaround!