Skip to content

Fix inverted logic for boolean last#36650

Open
mguiking wants to merge 1 commit intospring-projects:mainfrom
mguiking:main
Open

Fix inverted logic for boolean last#36650
mguiking wants to merge 1 commit intospring-projects:mainfrom
mguiking:main

Conversation

@mguiking
Copy link
Copy Markdown

sendPartialBinary's last parameter controls the WebSocket FIN bit — true means "this is the final fragment." Spring sets it to iterator.hasNext() which is inverted: for a single-buffer binary message, last becomes false, so Jetty leaves the connection in a fragmented state (FIN=0). The next send (e.g. a text message) then fails.

Signed-off-by: Max Guiking <32510398+mguiking@users.noreply.github.com>
@spring-projects-issues spring-projects-issues added the status: waiting-for-triage An issue we've not yet triaged or decided on label Apr 13, 2026
@bclozel bclozel added the in: messaging Issues in messaging modules (jms, messaging) label Apr 13, 2026
Copy link
Copy Markdown
Contributor

@DhruvTheDev1 DhruvTheDev1 left a comment

Choose a reason for hiding this comment

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

Hi, nice catch on the inverted logic here - by changing it to !iteratior.hasNext() flips the logic so the final buffer signals the end of the message (FIN = 1). Without this the last buffer was signalling more data was to come. Maybe adding a test case can help prove the fix works.

@DhruvTheDev1
Copy link
Copy Markdown
Contributor

I noticed there isn't a dedicated unit test for this webflux module yet maybe adding it to the existing WebSocketIntegrationTests.java or creating a new JettyWebSocketSessionTests in the adapter folder?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

in: messaging Issues in messaging modules (jms, messaging) status: waiting-for-triage An issue we've not yet triaged or decided on

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants