https://github.com/spring-projects/spring-framework/issues/32249#issue-2130887143
The solution is here seems like haven't been fixed yet.
Hi, even though we have a heartbeat, some connections don't close when we have too many subscriptions at the same time. What should I do?
Comment From: bclozel
I'm sorry but this is not enough for us to help you. Can you elaborate more? Which web framework and server are you using? What kind of connections are we talking about? Are you seeing errors when the server write heart beats? How are those hearts beats being implemented? Are connections closed as described in the other issue after some time of inactivity?
Comment From: ugurberkecan
I’m using Tomcat integrated with the Spring framework, and i have a Flux SSE (Server-Sent Events) setup.
I’m sending around 1000 subscription requests, and they all successfully connect. There's no timeout set for the Flux.
When I terminate the connections from the client side (via the terminal), I can see that the unsubscribe method is being called.
Essentially, I’m using Flux like this:
return Flux.merge( bookService.createBookStream(ip), createHeartbeatStream() );
Hearbeat :
Flux.interval(Duration.ofSeconds(2))
.map(ping -> ServerSentEvent.>builder()
.event("ping")
.build());
I don't see any errors, but the number of connections keeps increasing. Even though the unsubscribe method is called for each of them, the connections still seem to hang. Additionally, I’ve noticed that the HTTP connections remain alive for up to two days.
Comment From: bclozel
The setup seems minimal then. Can you reproduce this behavior in a sample application and share it with us here? You can create an app on start.spring.io and attach it here, or share a repo on github. Thanks!
Comment From: spring-projects-issues
If you would like us to look at this issue, please provide the requested information. If the information is not provided within the next 7 days this issue will be closed.
Comment From: spring-projects-issues
Closing due to lack of requested feedback. If you would like us to look at this issue, please provide the requested information and we will re-open the issue.