You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
SqlConnectionPool.execute() does not cancel the connection-timeout timer when acquire fails → IllegalStateException: Result is already complete #1706
When the database is unreachable and a query is executed through the pool (Pool#query(...).execute() / preparedQuery), the caller correctly receives the connection error. However, once the pool connection timeout elapses, Vert.x reports an uncaught exception:
java.lang.IllegalStateException: Result is already complete
at io.vertx.core.Promise.fail(Promise.java:90)
at io.vertx.sqlclient.impl.pool.SqlConnectionPool.lambda$execute$3(SqlConnectionPool.java:216)
at io.vertx.core.impl.VertxImpl$InternalTimerHandler.handle(...)
...
In SqlConnectionPool.execute(ContextInternal, CommandBase<R>, long timeout):
If timeout > 0, a timer is registered that calls res.fail(POOL_QUERY_TIMEOUT_EXCEPTION).
The timer is only cancelled in the success branch of p.future().compose(lease -> ...).
In the failure branch (t -> { dequeueAndReject(...); return Future.failedFuture(t); }) the timer is not cancelled; onComplete then calls res.fail(ar.cause()).
When the timer later fires, res.fail(...) is invoked on an already completed promise → IllegalStateException.
This is deterministic: every acquire failure that happens before the timeout expires produces the exception exactly timeout ms later.
Steps to reproduce
Create a Pool with PoolOptions#setConnectionTimeout(2) (seconds) pointing to an unreachable host/port (or a stopped PostgreSQL container).
Execute a query via the pool; it fails with the connection error (expected).
Wait ~3 seconds without further requests.
Observe the uncaught IllegalStateException from the timer handler.
Activity
Cancel pool connection timeout timer when acquisition fails
Cancel pool connection timeout timer when acquisition fails
Cancel pool connection timeout timer when acquisition fails (#1712)
Cancel pool connection timeout timer when acquisition fails (#1713)
tsegismont commentedon Oct 8, 2026
Fixed by #1713
Cancel pool connection timeout timer when acquisition fails (#1712) (#…