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

STOMP Connection Closes Due to Missing Heartbeats Despite Frontend Showing Ping-Pongs #43362

Closed
abhishek0499 opened this issue Dec 3, 2024 · 1 comment
Labels
for: external-project For an external project and not something we can fix status: duplicate A duplicate of another issue

Comments

@abhishek0499
Copy link

I’m experiencing a connection issue with WebSocket STOMP in Spring Boot using ActiveMQ Artemis. Despite proper heartbeat configurations, the broker closes the connection with the following error:
AMQ229014: Did not receive data from /192.0.2.1:46748 within the 20000ms connection TTL.

Setup

  • Frontend: SockJS and Stomp.js, showing regular ping/pong exchanges in the browser console.
  • Backend: Spring Boot using StompBrokerRelayMessageHandler with custom ReactorNettyTcpClient for broker connections. Relevant configuration:
public void configureMessageBroker(MessageBrokerRegistry config) {
    int sendInterval = 10000; // Send interval in milliseconds
    int receiveInterval = (int) (sendInterval * heartBeatReceiveScale);
    config.setApplicationDestinationPrefixes("/app");
    config.enableStompBrokerRelay("/topic", "/queue")
            .setUserDestinationBroadcast("/topic/random")
            .setUserRegistryBroadcast("/topic/simp-user-registry")
            .setTcpClient(createTcpClient())
            .setSystemLogin(username)
            .setSystemPasscode(password)
            .setClientLogin(username)
            .setClientPasscode(password)
            .setSystemHeartbeatSendInterval(sendInterval) // Set heartbeat send interval
            .setSystemHeartbeatReceiveInterval(receiveInterval);
}

Logs confirm a CONNECTED frame with heart-beat=[10000, 10000].

Observations

  • Frontend pings/pongs appear consistent.
  • Backend logs indicate heartbeats are sent and received.
  • Connection closes after the TTL timeout (20 seconds).

Questions

  • How can I verify heartbeats are properly received by the broker?
  • Are additional Spring Boot or Artemis configurations required to prevent disconnections?

Steps to Reproduce

  • Configure WebSocket STOMP with a broker using the above setup.
  • Send/receive heartbeats with the specified intervals.
  • Observe connection closure in logs despite consistent heartbeats.

Additional Context
Backend logs:
DEBUG StompBrokerRelayMessageHandler : Received CONNECTED heart-beat=[10000, 10000] session=itwv0lto DEBUG StompBrokerRelayMessageHandler : Forwarding SEND /topic/simp-user-registry session=_system_

@spring-projects-issues spring-projects-issues added the status: waiting-for-triage An issue we've not yet triaged label Dec 3, 2024
@wilkinsona
Copy link
Member

Duplicates spring-projects/spring-framework#34009. @abhishek0499 please respect the maintainers' time by not opening the same issue in multiple repositories.

@wilkinsona wilkinsona closed this as not planned Won't fix, can't repro, duplicate, stale Dec 3, 2024
@wilkinsona wilkinsona added status: duplicate A duplicate of another issue for: external-project For an external project and not something we can fix and removed status: waiting-for-triage An issue we've not yet triaged labels Dec 3, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
for: external-project For an external project and not something we can fix status: duplicate A duplicate of another issue
Projects
None yet
Development

No branches or pull requests

3 participants