Skip to content

ResponseBodyEmitter skips same messages during initialization [SPR-13223] #17814

@spring-projects-issues

Description

@spring-projects-issues

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:

Referenced from: commits bdb6348

Metadata

Metadata

Assignees

Labels

in: webIssues in web modules (web, webmvc, webflux, websocket)type: bugA general bug

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions