-
Bug
-
Resolution: Done
-
Major
-
4.5.3.Final
-
None
-
None
Before the servlet dispatched the sse GET method in one thread like below code example, sse event sending to SseEventSink with POST method is already started in another thread.
@GET @Produces(MediaType.SERVER_SENT_EVENTS) public void getEvents(@Context SseEventSink eventSink) this.eventSink = eventSink; } @POST public void send(String message) { .... sseSink.send(sseEvent); }
The sequence like this:
- GET is called
- The user's get endpoint method is called and returns
- HTTP header OK for GET is flushed
- POST is called
- The user's post endpoint method is called and tries to write to the SSE sink
- When this GET method isn't dispatched completely (it doesn't reach this line:
https://github.com/resteasy/Resteasy/blob/master/resteasy-core/src/main/java/org/jboss/resteasy/plugins/server/servlet/ServletContainerDispatcher.java#L270),
server tries to write the event to SseSInk, and It breaks.
1353510:12:48,696 ERROR [io.undertow.request] (default task-3) UT005080: HttpServerExchange cannot have both async IO resumed and dispatch() called in the same cycle 1353610:12:48,704 ERROR [io.undertow.request] (default task-3) UT005071: Undertow request failed HttpServerExchange{ GET /SseAPITest/apitest/events}: java.lang.IllegalStateException: UT000002: The response has already been started
- is cloned by
-
RESTEASY-2621 Concurrency issue in sse events GET and send
- Open