jetty.project icon indicating copy to clipboard operation
jetty.project copied to clipboard

Change in WebSocket behavior between 12.1.3 and 12.1.4

Open tipsy opened this issue 3 weeks ago • 3 comments

Jetty version(s) 12.1.4

Jetty Environment ee10

Java version/vendor (use: java -version) 17/21 (probably any)

OS type/version windows-latest, macos-14 (aarch64), macos-13 (x86-64), ubuntu-latest

Description Something changed with pinging behavior between 12.1.3 and 12.1.4, causing my ping test to fail: https://github.com/javalin/javalin/pull/2507

How to reproduce? I haven't had time to look at this yet, will investigate if you're not able to find the issue.

What my code does is call session.sendPing(applicationData ?: ByteBuffer.allocate(0), Callback.NOOP) inside an executor.

tipsy avatar Nov 30 '25 21:11 tipsy

Looking at your PR, it seems to be related to "disabling pings". Can you detail what is the intent of the test that fails?

sbordet avatar Dec 01 '25 21:12 sbordet

@tipsy This PR was merged in 12.1.4 https://github.com/jetty/jetty.project/pull/13643, which changed that ByteBuffers are now consumed when sending with WebSocket.

I would verify this behavior in regards to your test case, for example in this case session.sendPing(applicationData, ...) the applicationData buffer will be consumed once the message is sent.

lachlan-roberts avatar Dec 02 '25 04:12 lachlan-roberts

@sbordet Looking at your PR, it seems to be related to "disabling pings". Can you detail what is the intent of the test that fails?

It was two tests to enable and disable pings. It's a simple feature that just sends pings at a given interval.

@lachlan-roberts @tipsy This PR was merged in 12.1.4 https://github.com/jetty/jetty.project/pull/13643, which changed that ByteBuffers are now consumed when sending with WebSocket.

Thanks, our issue came from passing applicationData into an executor and reusing it. I fixed it by simply providing a fresh ByteBuffer for each ping. You should probably add a note to https://github.com/jetty/jetty.project/releases/tag/jetty-12.1.4 to highlight this potential issue.

tipsy avatar Dec 03 '25 16:12 tipsy