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

Extra empty line a["\n"] messages from ActiveMQ STOMP broker #23713

Closed
seenimurugan opened this issue Sep 25, 2019 · 4 comments
Closed

Extra empty line a["\n"] messages from ActiveMQ STOMP broker #23713

seenimurugan opened this issue Sep 25, 2019 · 4 comments
Assignees
Labels
in: messaging Issues in messaging modules (jms, messaging) type: bug A general bug type: enhancement A general enhancement
Milestone

Comments

@seenimurugan
Copy link

seenimurugan commented Sep 25, 2019

version::

spring-boot-starter-parent - version: 2.1.8.RELEASE
spring-boot-starter-websocket - as above

issue:
Client receives extra/un-necessary message(a["\n"] or empty line) for each message sent from external broker via brokerrelay

@spring-projects-issues spring-projects-issues added the status: waiting-for-triage An issue we've not yet triaged or decided on label Sep 25, 2019
@rstoyanchev
Copy link
Contributor

Are you sure about this conclusion? AbstractMessageChannel is a very generic component that skips the send if an interceptor returns null from preSend and this is not in any way related the STOMP broker is in use. The a["\n"] messages that you're seeing with the external broker are probably heartbeat messages.

@rstoyanchev rstoyanchev added the status: waiting-for-feedback We need additional information before we can continue label Sep 26, 2019
@seenimurugan
Copy link
Author

seenimurugan commented Sep 26, 2019

@rstoyanchev I double checked and the issue is with the message itself not with the preSend method i guess. If I send a simple string as payload in the convertAndSend method then it does not produce this noise. But if I use any object as string(using Jackson or gson converter) as payload then it sends the additional line. Please find the below link to test this issue.
Git hub url

Also the noise is not a["\n"] in my sample application but it is empty message. But with my original application the payload is very big so it sends a["\n"] as additional message with every message.

@spring-projects-issues spring-projects-issues added status: feedback-provided Feedback has been provided and removed status: waiting-for-feedback We need additional information before we can continue labels Sep 26, 2019
@seenimurugan
Copy link
Author

Screenshot 2019-09-26 at 11 43 45

@seenimurugan seenimurugan changed the title Websocket - returning null value from the preSend method in ChannelInterceptor sends a["\n"] as message to the client Websocket - Sending String Object using Jackson mapper add additional message( empty line or a["\n"]) to the client Sep 26, 2019
@seenimurugan seenimurugan changed the title Websocket - Sending String Object using Jackson mapper add additional message( empty line or a["\n"]) to the client Websocket - Sending String Object using Jackson mapper add additional message( empty line or a["\n"]) to the client with external broker Sep 26, 2019
@rstoyanchev
Copy link
Contributor

Thanks for providing the sample.

ActiveMQ appears to be sending extra new lines at the end of STOMP frames, i.e. after the terminating \0 byte (NULL octet). I don't know what the logic of when it does that but it is allowed by the spec, from section 2.1:

The NULL octet can be optionally followed by multiple EOLs.

The current logic does skip empty new lines at the start of a frame but if they arrive in the same chunk as the message, it ends up (incorrectly) interpreting that as a heartbeat.

@rstoyanchev rstoyanchev self-assigned this Jan 15, 2020
@rstoyanchev rstoyanchev added in: messaging Issues in messaging modules (jms, messaging) type: bug A general bug type: enhancement A general enhancement and removed status: feedback-provided Feedback has been provided status: waiting-for-triage An issue we've not yet triaged or decided on labels Jan 15, 2020
@rstoyanchev rstoyanchev added this to the 5.2.4 milestone Jan 15, 2020
@rstoyanchev rstoyanchev changed the title Websocket - Sending String Object using Jackson mapper add additional message( empty line or a["\n"]) to the client with external broker Extra empty line a["\n"] messages from ActiveMQ STOMP broker Jan 15, 2020
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) type: bug A general bug type: enhancement A general enhancement
Projects
None yet
Development

No branches or pull requests

3 participants