Commit 862b845
authored
Fix race condition causing IllegalStateException: Promise already completed (#6170)
See #6169
A bug in SimpleConnectionPool allows a pool waiter's promise to be completed twice under concurrent recycle + cancel with a short connect/acquire timeout.
Recycle, ConnectSuccess (secondary waiter loop), and SetConcurrency polled waiters without setting waiter.disposed=true.
Cancel therefore saw disposed=false, reported cancellation success, and failed the promise, racing with the recycle path that had already completed it.
Some portions of this content were created with the assistance of Claude Code.
Signed-off-by: Thomas Segismont <tsegismont@gmail.com>1 parent 606b1d4 commit 862b845
2 files changed
Lines changed: 47 additions & 2 deletions
File tree
- vertx-core/src
- main/java/io/vertx/core/internal/pool
- test/java/io/vertx/tests/pool
Lines changed: 7 additions & 2 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
323 | 323 | | |
324 | 324 | | |
325 | 325 | | |
326 | | - | |
| 326 | + | |
| 327 | + | |
| 328 | + | |
327 | 329 | | |
328 | 330 | | |
329 | 331 | | |
| |||
465 | 467 | | |
466 | 468 | | |
467 | 469 | | |
468 | | - | |
| 470 | + | |
| 471 | + | |
| 472 | + | |
469 | 473 | | |
470 | 474 | | |
471 | 475 | | |
| |||
731 | 735 | | |
732 | 736 | | |
733 | 737 | | |
| 738 | + | |
734 | 739 | | |
735 | 740 | | |
736 | 741 | | |
| |||
Lines changed: 40 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
876 | 876 | | |
877 | 877 | | |
878 | 878 | | |
| 879 | + | |
| 880 | + | |
| 881 | + | |
| 882 | + | |
| 883 | + | |
| 884 | + | |
| 885 | + | |
| 886 | + | |
| 887 | + | |
| 888 | + | |
| 889 | + | |
| 890 | + | |
| 891 | + | |
| 892 | + | |
| 893 | + | |
| 894 | + | |
| 895 | + | |
| 896 | + | |
| 897 | + | |
| 898 | + | |
| 899 | + | |
| 900 | + | |
| 901 | + | |
| 902 | + | |
| 903 | + | |
| 904 | + | |
| 905 | + | |
| 906 | + | |
| 907 | + | |
| 908 | + | |
| 909 | + | |
| 910 | + | |
| 911 | + | |
| 912 | + | |
| 913 | + | |
| 914 | + | |
| 915 | + | |
| 916 | + | |
| 917 | + | |
| 918 | + | |
879 | 919 | | |
880 | 920 | | |
881 | 921 | | |
| |||
0 commit comments