Affects: 5.3.6

I'm using spring boot 2.4.5 with RabbitMQ as message broker and io.projectreactor.netty. I got an issue when I use convertAndSend from a scheduled job.

@Scheduled(fixedRate=1000)
public void sendServerTime() {
    LocalDateTime dateTime = LocalDateTime.now();
    DateTimeFormatter dtf = DateTimeFormatter.ofPattern("dd-MM-yyyy HH:mm:ss");
    this.template.convertAndSend(Constants.SIMPLE_BROKER_SERVER_TIME, "{\"servertime\":\"" + dateTime.format(dtf) + " EET\"}");
}

The message arrives to the clients and stops after a random time. Thank you for your help

Comment From: jbakog

I tested with spring boot 2.3.9.RELEASE and there is no issue. The problem exists from 2.4.0 up to 2.5.0-RC1

Comment From: rstoyanchev

@jbakog can you provide a reproducible scenario? If not, you can narrow it down further through log messages and/or debugging to see how far it gets. Starting with the scheduled method, then the brokerChannel, the message being sent out to the broker. Then receiving the messages on individual client sessions, on the server and passing through the clientOutboundChannel and being sent to the client through the WebSocket session.

Comment From: jbakog

Here are the only logs I see: Spring SimpMessagingTemplate.convertAndSend stops sending messages and after SENDING MESSAGE it stops logging anything else. The way to reproduce is use a spring boot 2.4.5 with RabbitMQ 3.8.16 and create a simple scheduled method to send every 1 sec the server time at /topic/time If there is anything else I can provide please tell me.

Comment From: rstoyanchev

I don't think that alone is enough to reproduce it. We have https://github.com/rstoyanchev/spring-websocket-portfolio.

Comment From: jbakog

Easily reproducible in a new project from https://start.spring.io/ -> https://github.com/jbakog/demosocket You have to configure your broker settings @ application.properties

Comment From: jbakoc1

Hey @rstoyanchev have you been able to reproduce it? I downgraded my production deployment because of this issue.

Comment From: rstoyanchev

@jbakoc1 I have tried your sample and I'm not able to reproduce the issue. I comment out virtualHost since I'm not using it, start the server, and then see this over and over until I stop the server:

Running schedule job
2021-06-02 19:33:18.755 DEBUG 419241 --- [MessageBroker-2] o.s.m.s.s.StompBrokerRelayMessageHandler : Forwarding SEND /topic/time session=_system_ text/plain;charset=UTF-8 payload={"servertime":"02-06-2021 19:33:18 EET"}
2021-06-02 19:33:18.790 TRACE 419241 --- [MessageBroker-2] o.s.messaging.simp.stomp.StompEncoder    : Encoding STOMP SEND, headers={destination=[/topic/time], content-type=[text/plain;charset=UTF-8]}

There is one thing I noticed in the sample. You have declared @EnableWebSocketMessageBroker which imports WebSocketMessageBrokerConfigurationSupport and you're also extending WebSocketMessageBrokerConfigurationSupport which means that you have duplicate configuration. Maybe your actual application isn't like this but worth mentioning.

If you suspect a regression, you can try to vary the version to see if you can narrow it down to a specific version. Another suggestion is: turn up trace logging for "org.springframework.messaging" and "org.springframework.web". Also take a thread dump when it's hanging to see where the thread is stuck on.

There is some chance this could be related to #26464 but it is not easy to reproduce. That said I've yet to reproduce this one too.

Comment From: jbakoc1

Hey @rstoyanchev yes I think it is duplicate with #26464 I am using the latest RabbitMQ 3.8.16 (default installation-configuration) java 15.0.2 (adoptjdk) Up to spring boot 2.3.11 I have no problem. From 2.4 onwards I might get the message for 0.1-10 minutes and then suddenly stops. Do you leave running enough? Thanks

Comment From: rstoyanchev

In that case I am closing this as a duplicate of #26464 which was linked to https://github.com/reactor/reactor-netty/issues/1684 as the underlying cause.