I Have 2 projects with Spring Boot as back and Angular a front. Both are doing SSE.
After having migrating both projects from 2.3.4 to 2.3.5 my front SSE no more works.
I trided to move from Tomcat to Jetty, it doesn't change anything. I have also tried with Chrome and Firefox, i have the same behavior.
I have tried to analyse requests :
- On 2.3.4, i have one long request every 30 second.
- With 2.3.5, i have multiple requests that instantly ends. The front do retry and after 3 retry (it can be more or less) the connection works. Then the connection is closed 27 second later (it seems to be time to the first connection + 30s). On the server side it seems that multiple connection are created for the same client. On client side, after each retry i have an "error" event and with the connection that seems working i never receive any message event.
Comment From: wilkinsona
Thanks for the report. We're not aware of any problems with SSE in Spring Boot 2.3.5 and, unfortunately, I don't think we'll be able to diagnose your problem from the above description alone. To help us to investigate, please spend some time providing a complete yet minimal sample that reproduces the problem. You can share it with us by pushing it to a separate repository on GitHub or by zipping it up and attaching it to this issue.
Comment From: wilkinsona
A quick search in the Spring Framework issue tracker suggests that this may be a duplicate of https://github.com/spring-projects/spring-framework/issues/25987. @ochezeau, could you please try the workaround that @rstoyanchev suggests in that issue and see if it restores the previous behaviour. The workaround is the following bean:
@Bean
public Jackson2ObjectMapperBuilderCustomizer om() {
return builder -> builder.featuresToDisable(JsonGenerator.Feature.AUTO_CLOSE_TARGET);
}
Comment From: ochezeau
I have tried the fix on my project and it works fine.
I had tried looking in the springframework bug tracker ... sorry
Thanks a lot for your help.
Comment From: wilkinsona
Great stuff. Thanks for trying the workaround and for letting us know it fixed your problem.