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

SseEventOutputImpl wrong CompletionStage composition sequence

    XMLWordPrintable

Details

    • Bug
    • Resolution: Done
    • Major
    • 4.5.8.Final
    • 4.5.6.Final
    • jaxrs
    • 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())
      ......

      Attachments

        Activity

          People

            rhn-support-asoldano Alessio Soldano
            a.koshkin Andrey Koshkin (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: