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
GIVEN SELECT all records (e.g. good amount of records e.g. 1000) from table A
THEN Execute other queries (just push the query to the event loop) would hang
Actual behavior
the next queries should not hang
Steps to reproduce the problem
Sample test to reproduce the hang issue (100% hang):
@TestvoidselectABigRecordsThenExecuteOtherQueriesShouldNotHang() {
// Setup DSLContextSettingsjooqSettings = newSettings()
.withRenderFormatted(true)
.withStatementType(StatementType.PREPARED_STATEMENT);
Connectionr2dbcConnection = postgresExtension.getConnection().block();
DSLContextdslContext = DSL.using(r2dbcConnection, SQLDialect.POSTGRES, jooqSettings);
// Create `users` tableTable<Record> USER_TABLE = DSL.table("users");
Field<String> USERNAME = DSL.field("username", SQLDataType.VARCHAR(255).notNull());
Field<String> PASSWORD = DSL.field("password", SQLDataType.VARCHAR);
Mono.from(dslContext.createTableIfNotExists(USER_TABLE)
.column(USERNAME)
.column(PASSWORD)
.constraints(DSL.primaryKey(USERNAME)))
.block();
// Insert 1000 usersFlux.range(1, 1000)
.flatMap(counter -> Mono.from(dslContext.insertInto(USER_TABLE)
.set(USERNAME, counter.toString())
.set(PASSWORD, "password")))
.collectList()
.block();
// Create `mailboxes` tableTable<Record> MAILBOX_TABLE = DSL.table("mailboxes");
Field<String> MAILBOX_ID = DSL.field("mailbox_id", SQLDataType.VARCHAR(255).notNull());
Mono.from(dslContext.createTableIfNotExists(MAILBOX_TABLE)
.column(MAILBOX_ID)
.constraints(DSL.primaryKey(MAILBOX_ID)))
.block();
// insert 1 dummy record into mailboxes tableMono.from(dslContext.insertInto(MAILBOX_TABLE)
.set(MAILBOX_ID, "whatever"))
.block();
System.out.println("finished provisioning data");
// list all the users then query in the same `users` table as well -> this would hang foreverassertThat(Flux.from(dslContext.selectFrom(USER_TABLE))
.map(record -> record.get(USERNAME))
.flatMap(username -> Mono.from(dslContext.selectFrom(USER_TABLE)
.where(USERNAME.eq(username), PASSWORD.eq("password"))),
1)
.collectList()
.block())
.hasSize(1000);
// list all the users then query another `mailboxes` table -> this would hang foreverassertThat(Flux.from(dslContext.selectFrom(USER_TABLE))
.map(record -> record.get(USERNAME))
.concatMap(any -> Mono.from(dslContext.selectOne()
.from(MAILBOX_TABLE)))
.collectList()
.block())
.hasSize(1000);
}
Notes:
if initially SELECT not big e.g. 1000 records but just a few records e.g. 5, then the following queries would not hang.
adding .collectList().flatMapIterable(Function.identity()) to the initial SELECT would avoid hanging
jOOQ Version
3.19.6
Database product and version
PostgreSQL 16.1
Java Version
java 21
JDBC / R2DBC driver name and version (include name if unofficial driver)
r2dbc-postgresql 1.0.4.RELEASE
The text was updated successfully, but these errors were encountered:
jooq reactive bug: SELECT many records then query something else would hang
This is a temporary fix in the meantime waiting for the jooq fix.
Bear in mind that `.collectList` lot of elements could impact performance.
Arsnael
pushed a commit
to apache/james-project
that referenced
this issue
Apr 9, 2024
jooq reactive bug: SELECT many records then query something else would hang
This is a temporary fix in the meantime waiting for the jooq fix.
Bear in mind that `.collectList` lot of elements could impact performance.
vttranlina
pushed a commit
to vttranlina/james-project
that referenced
this issue
Apr 14, 2024
jooq reactive bug: SELECT many records then query something else would hang
This is a temporary fix in the meantime waiting for the jooq fix.
Bear in mind that `.collectList` lot of elements could impact performance.
vttranlina
pushed a commit
to vttranlina/james-project
that referenced
this issue
Apr 16, 2024
jooq reactive bug: SELECT many records then query something else would hang
This is a temporary fix in the meantime waiting for the jooq fix.
Bear in mind that `.collectList` lot of elements could impact performance.
Expected behavior
GIVEN SELECT all records (e.g. good amount of records e.g. 1000) from table A
THEN Execute other queries (just push the query to the event loop) would hang
Actual behavior
the next queries should not hang
Steps to reproduce the problem
Sample test to reproduce the hang issue (100% hang):
Notes:
.collectList().flatMapIterable(Function.identity())
to the initial SELECT would avoid hangingjOOQ Version
3.19.6
Database product and version
PostgreSQL 16.1
Java Version
java 21
JDBC / R2DBC driver name and version (include name if unofficial driver)
r2dbc-postgresql 1.0.4.RELEASE
The text was updated successfully, but these errors were encountered: