Uploaded image for project: 'RESTEasy'
  1. RESTEasy
  2. RESTEASY-2585

Concurrency issue in sse events GET and send

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Done
    • Icon: Major Major
    • 4.5.5.Final
    • 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:

      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
      

            rhn-engineering-ema Jim Ma
            rhn-engineering-ema Jim Ma
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

              Created:
              Updated:
              Resolved: