spring-framework icon indicating copy to clipboard operation
spring-framework copied to clipboard

Connections are hanging up

Open ugurberkecan opened this issue 1 year ago • 4 comments
trafficstars

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?

ugurberkecan avatar Oct 09 '24 09:10 ugurberkecan

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?

bclozel avatar Oct 09 '24 09:10 bclozel

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.<List<BookService>>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.

ugurberkecan avatar Oct 09 '24 11:10 ugurberkecan

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!

bclozel avatar Oct 09 '24 11:10 bclozel

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.

spring-projects-issues avatar Oct 16 '24 11:10 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.

spring-projects-issues avatar Oct 23 '24 11:10 spring-projects-issues