Inconsistency in SseEmitter.onCompletion()
behavior between Spring 6.2.3 and 6.2.5
#34762
Labels
in: web
Issues in web modules (web, webmvc, webflux, websocket)
type: regression
A bug that is also a regression
Milestone
Summary
There is an inconsistency in the invocation behaviour of the
SseEmitter.onCompletion()
callback between Spring Framework versions 6.2.3 and 6.2.5. Previously, callingemitter.complete()
would immediately trigger the callback registered viaonCompletion()
. However, starting with Spring Framework 6.2.5 (used in Spring Boot 3.4), this callback no longer appears to execute aftercomplete()
method is invoqued.Current Behaviour
When using Spring Boot 3.4 (with Spring Framework 6.2.5), calling
emitter.complete()
does not cause an immediate invocation of theonCompletion()
callback. This behaviour differs from that in Spring Boot 3.3 (with Spring Framework 6.2.3), whereemitter.complete()
immediately triggered the callback.Expected behaviour
The expected behaviour is that calling
emitter.complete()
should trigger theonCompletion()
callback immediately, just as it did in Spring Boot 3.3 (Spring Framework 6.2.3).Steps to Reproduce
You can reproduce the issue with the following setup:
complete()
.Additional Notes
The code to reproduce this behaviour is available in the [spring-sse-emitter GitHub repository https://github.com/jrpedrianes/spring-sse-emitter.
This behavioural change appears to be related to 503 status code after completing SseEmitter in onTimeout #34426 in the Spring Framework repository.
The text was updated successfully, but these errors were encountered: