Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-8029164

Race condition in CompletableFuture.thenCompose with asynchronous task

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Closed
    • Priority: P3
    • Resolution: Fixed
    • Affects Version/s: 8
    • Fix Version/s: 8
    • Component/s: core-libs

      Backports

        Description

        When composing completable futures using thenCompose a race condition is possible if:

        1) the composing future completes before or during the call to thenCompose; and
        2) the composing function returns a CompletedFuture that is executed asynchronously and does not complete during the call to thenCompose.

        Under such conditions the composed future's result will be null and the result produced by the composing function's CompletableFuture will be discarded when it completes.

          Attachments

            Issue Links

              Activity

                People

                Assignee:
                psandoz Paul Sandoz
                Reporter:
                psandoz Paul Sandoz
                Votes:
                0 Vote for this issue
                Watchers:
                3 Start watching this issue

                  Dates

                  Created:
                  Updated:
                  Resolved: