vert-x3 / vertx-4-migration-guide

Migration to Vert.x 4 guide
https://vert-x3.github.io/vertx-4-migration-guide/index.html
20 stars 16 forks source link

CompositeFuture.join bug #76

Closed sosilent closed 1 year ago

sosilent commented 1 year ago

Questions

as described in vertx.io

  1. The join composition waits until all futures are completed, either with a success or a failure.

CompositeFuture.join takes several futures arguments (up to 6) and returns a future that is succeeded when all the futures are succeeded, and failed when all the futures are completed and at least one of them is failed:

  1. While the all composition waits until all futures are successful (or one fails), the any composition waits for the first succeeded future.

CompositeFuture.any takes several futures arguments (up to 6) and returns a future that is succeeded when one of the futures is, and failed when all the futures are failed:

Version

4.0.3 ~ 4.3.3

Context

I created a reproducer as follows.

5 tasks are executed concurrently, and some tasks will fail randomly and at least one task succeeds. As expected:

  1. CompositeFuture.all will wait all tasks completed and return a future that is failed.
  2. CompositeFuture.any will return when one task complete and return a future that is failed.
  3. CompositeFuture.join will wait all tasks completed and return a future that is succeeded.

But the program runs not as expected, as CompositeFuture.any actually runs as CompositeFuture.join and CompositeFuture.join actually runs as CompositeFuture.any.

Do you have a reproducer?

Steps to reproduce

  1. mvn pakcage
  2. mvn exec:java