Skip to content

Concurrent reactive queries return the result to the wrong caller #1095

@alessandrolulli

Description

@alessandrolulli

Dear,

version:
quarkus: 3.21.0
smallrye-mutiny-vertx-sql-client: 3.18.1

We are using io.vertx.pgclient reactive. When executing multiple queries to the same pool concurrently sometimes the RowSet is returned to the wrong caller (i.e. we perform a query and we receive the result of another query).

This is the snippet of the code:
`
public Uni<List> getStatusChangeCount(long agentId) {
StringBuilder queryBuilder = new StringBuilder("SELECT device_id, count FROM table_with_count_1 WHERE agent_id = $1");
List params = new ArrayList<>();
params.add(agentId);

    String query = queryBuilder.toString();
    logger.debugf("Query: %s", query);

    return client
            .preparedQuery(query)
            .execute(Tuple.from(params))
            .map(rows -> {
                List<DeviceCountOutDto> events = new ArrayList<>();
                for (Row row : rows) {
                    DeviceCountOutDto event = new DeviceCountOutDto(
                            row.getLong("device_id"),
                            row.getInteger("count")
                    );
                    events.add(event);
                }
                return events;
            });
}

`

The client is:
@Inject @ReactiveDataSource("timescale") private Pool client;

We have another method executing another query with 3 columns and we get the following errors:
[20250423 12:10:51 DEBUG (AbstractResteasyReactiveContext.java:328) de302c86-dac2-4289-8b33-4769117f8785] - Attempting to handle unrecoverable exception: io.vertx.pgclient.PgException: ERROR: bind message has 3 result formats but query has 2 columns (08P01) [20250423 12:10:51 DEBUG (null:-1) de302c86-dac2-4289-8b33-4769117f8785] - RoutingContext failure (500): io.vertx.pgclient.PgException: ERROR: bind message has 3 result formats but query has 2 columns (08P01)

We are calling the two methods from two different REST API calls simoultaneously and sometimes we have this error and other times no errors.

Could you please help us understand why the execute method sometimes return the wrong RowSet?
Thanks

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions