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

SseEventOutputImpl wrong CompletionStage composition sequence

    Details

    • Type: Bug
    • Status: Resolved (View Workflow)
    • Priority: Major
    • Resolution: Done
    • Affects Version/s: 4.5.6.Final
    • Fix Version/s: 4.5.8.Final
    • Component/s: jaxrs
    • Labels:
      None

      Description

      Wrong operation sequence in SseEventOutputImpl

      original bug - https://github.com/quarkusio/quarkus/issues/11824

       

      SseEventOutputImpl.java:292

      CompletionStage<Void> a = internalFlushResponseToClient(true);
               CompletionStage<Void> b = writeEvent(event);
               return a.thenCompose(v -> b);
      

      for correct operation and initialization order it should be like this:

      return internalFlushResponseToClient(true)
              .thenCompose(v ->  writeEvent(event));
      

       

      SseEventOutputImpl.java:233

      CompletionStage<Void> a = aos.asyncWrite(SseConstants.DOUBLE_EOL);
       CompletionStage<Void> b = aos.asyncFlush();

      should be 

      CompletionStage<Void> a = aos.asyncWrite(SseConstants.DOUBLE_EOL)
       .thenCompose(v -> aos.asyncFlush());

       

      SseEventOutputImpl.java:349

      CompletionStage<Void> a = aos.asyncWrite(bout.toByteArray());
       CompletionStage<Void> b = aos.asyncFlush();

      should be 

      return aos.asyncWrite(bout.toByteArray())
              .thenCompose(v ->  aos.asyncFlush())
      ......

        Gliffy Diagrams

          Attachments

            Activity

              People

              • Assignee:
                asoldano Alessio Soldano
                Reporter:
                a.koshkin Andrey Koshkin
              • Votes:
                0 Vote for this issue
                Watchers:
                1 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved: