Skip to content

Invalid default reconnect interval #1512

@pmlopes

Description

@pmlopes
Apr 17, 2025 9:58:03 PM io.vertx.core.impl.ContextImpl
SEVERE: Unhandled exception
java.lang.IllegalArgumentException: Cannot schedule a timer with delay < 1 ms
        at io.vertx.core.impl.VertxImpl.scheduleTimeout(VertxImpl.java:672)
        at io.vertx.core.impl.VertxImpl.scheduleTimeout(VertxImpl.java:698)
        at io.vertx.core.impl.VertxImpl.setTimer(VertxImpl.java:441)
        at io.vertx.sqlclient.impl.ConnectionFactoryBase.lambda$doConnectWithRetry$3(ConnectionFactoryBase.java:78)
        at io.vertx.core.impl.future.FutureImpl.lambda$onComplete$2(FutureImpl.java:159)
        at io.vertx.core.impl.future.FutureBase.emitResult(FutureBase.java:65)

Using this config:

    // Database connection options
    final PgConnectOptions dboptions = new PgConnectOptions()
        .setCachePreparedStatements(true)
        .setReconnectAttempts(5)
        .setHost(config.getString("dbhost"))
        .setPort(config.getInteger("dbport", 5432))
        .setUser(config.getString("dbuser"))
        .setPassword(config.getString("dbpass"))
        .setDatabase(config.getString("dbname"));

    // Set the trust store options
    if (config.containsKey("dbsslmode")) {
      dboptions.setSslMode(SslMode.of(config.getString("dbsslmode")));
    }

    // Set the trust store options
    if (config.containsKey("dbtruststore")) {
      dboptions.setSslOptions(new ClientSSLOptions()
          .setTrustOptions(new PemTrustOptions()
              .addCertPath(config.getString("dbtruststore"))));
    }

    // Pool options
    final PoolOptions poolOptions = new PoolOptions()
        .setMaxSize(5);

From a user perspective it feels strange that the retry does an illegal scheduling -1 (when the DB server is down).

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions