Open vttranlina opened 7 months ago
I updated the thread dump when the reactor process hanging threads_report1.txt
There's no blocked thread, the reported issue requires a bit more digging. I suggest enabling debug logging for the driver so that you see at which Postgres frame the process gets locked up.
There's no blocked thread, the reported issue requires a bit more digging. I suggest enabling debug logging for the driver so that you see at which Postgres frame the process gets locked up.
I created a simple project to reproduce it: https://github.com/vttranlina/r2dbc-postgresql-test.git
I updated the re-produce code (it is more complex a bit than what I wrote in the description above)
I tried to print all debug logs, but I don't see anything that I can dig more
Bug Report
Versions
Current Behavior
When attempting to execute a DELETE statement with a RETURNING clause using Flux.from(con.createStatement(...)), the application hangs after processing a few elements in the Flux.
My statement
Table schema
Steps to reproduce
Input Code
```java public Flux> and revert to Flux::fromIterable It works The code just add `.collectList().flatMapMany(Flux::fromIterable)` ```java public Flux deleteByMailboxIdAndReturning(PostgresMailboxId mailboxId) {
AtomicInteger counter = new AtomicInteger(0);
AtomicInteger doOnNextCounter = new AtomicInteger(0);
return postgresExecutor.connection()
.flatMapMany(con -> Flux.from(con.createStatement("DELETE FROM message_mailbox WHERE mailbox_id = $1 RETURNING message_id")
.bind(0, mailboxId.asUuid())
.execute())
.flatMap(result -> result.map((row, rowMetadata) -> {
String msgIdWasDeleted = row.get(0, String.class);
System.out.println("msg was deleted(" + counter.incrementAndGet() + "): " + msgIdWasDeleted);
return msgIdWasDeleted;
}), 5,15)).collectList().flatMapMany(Flux::fromIterable)
.doOnNext(e -> {
System.out.println("____doOnNext("+doOnNextCounter.incrementAndGet()+"): " + e);
})
.map(UUID::fromString);
}
```
Then the output is
```text
msg was deleted(1): 018ecb7b-dad2-79e5-96ba-4269fb5339f6
msg was deleted(2): 018ecb7b-db69-7d8a-a475-278b2df269f2
...
msg was deleted(49): 018ecb7b-df6c-7a0a-9258-55817f6cc934
msg was deleted(50): 018ecb7b-df81-779c-be86-c7445186aaff
____doOnNext(1): 018ecb7b-dad2-79e5-96ba-4269fb5339f6
____doOnNext(2): 018ecb7b-db69-7d8a-a475-278b2df269f2
...
____doOnNext(49): 018ecb7b-df6c-7a0a-9258-55817f6cc934
____doOnNext(50): 018ecb7b-df81-779c-be86-c7445186aaff
```
Expected behavior/code
The
Flux.from(connection.createStatement(...))
should execute normally without hanging.Additional context
DELETE ... RETURNING
queries but also withSELECT
queries, although the latter is less frequently reproducible.updated: The code for reproduce is more complex: https://github.com/pgjdbc/r2dbc-postgresql/issues/650#issuecomment-2054007452