-
Couldn't load subscription status.
- Fork 38.8k
Closed
Labels
in: webIssues in web modules (web, webmvc, webflux, websocket)Issues in web modules (web, webmvc, webflux, websocket)type: bugA general bugA general bug
Milestone
Description
Tomasz Nurkiewicz opened SPR-13223 and commented
When the same message is sent via ResponseBodyEmitter before initialization, subsequent messages are dropped because uses ResponseBodyEmitter#initHandlerCache map keys to store events.
Problematic code (using SseEmitter):
@RequestMapping("/sse")
public SseEmitter sse() throws IOException, InterruptedException {
final SseEmitter emitter = new SseEmitter();
emitter.send("A");
emitter.send("B");
emitter.send("C");
emitter.complete();
return emitter;
}
The response is:
data:A
BC
while it should be:
data:A
data:B
data:C
The reason is that both data: and \n\n are dropped as duplicates. Pull request with test case and fix comes shortly.
Affects: 4.2 RC2
Issue Links:
- SseEmitter is not thread safe [SPR-13224] #17815 SseEmitter is not thread safe
Referenced from: commits bdb6348
Metadata
Metadata
Assignees
Labels
in: webIssues in web modules (web, webmvc, webflux, websocket)Issues in web modules (web, webmvc, webflux, websocket)type: bugA general bugA general bug