Robert Jaros
09/12/2019, 6:08 PMDELETE
operation with spring-r2dbc
and coroutines, by using such code inside a suspending function:
databaseClient.execute("DELETE FROM tab WHERE field = :field").bind("field", 5).then().awaitFirstOrNull()
Spring Boot gives me the following exception in logs:
2019-09-12 19:52:05,849 [reactor-tcp-epoll-3] ERROR i.r.p.client.ReactorNettyClient - Connection Error
io.netty.util.IllegalReferenceCountException: refCnt: 0
at io.netty.buffer.AbstractByteBuf.ensureAccessible(AbstractByteBuf.java:1464)
at io.netty.buffer.CompositeByteBuf.discardReadComponents(CompositeByteBuf.java:1733)
at io.r2dbc.postgresql.message.backend.BackendMessageEnvelopeDecoder.lambda$apply$0(BackendMessageEnvelopeDecoder.java:69)
at reactor.core.publisher.FluxCreate.subscribe(FluxCreate.java:94)
at reactor.core.publisher.Flux.subscribe(Flux.java:8127)
It looks like some kind of resource leak warning, because my code is running fine and SQL statement is executed correctly.
If I run:
databaseClient.delete().from("tab").matching(where("field").`is`(5)).then().awaitFirstOrNull()
there is no exception. And there are no problems with other kind of queries (SELECT, INSERT, UPDATE).
Is this my bug? Or is this probably a bug in spring boot
or spring-r2dbc
?sdeleuze
09/13/2019, 8:01 AMthen().awaitFirstOrNull()
instead of the provide extensions?sdeleuze
09/13/2019, 8:01 AMRobert Jaros
09/13/2019, 8:07 AMthen().awaitFirstOrNull()
to execute the statement and suspend until it is done?
I'm using:
Spring Boot 2.2.0.BUILD-SNAPSHOT
Spring Data R2DBC 1.0.0.BUILD-SNAPSHOT
r2dbc-postgresql 0.8.0.BUILD-SNAPSHOT
(the only combination that works for me at the moment)sdeleuze
09/13/2019, 8:10 AM.fetch().awaitOneOrNull
maybesdeleuze
09/13/2019, 8:11 AMsdeleuze
09/13/2019, 8:11 AMsdeleuze
09/13/2019, 8:11 AMRobert Jaros
09/13/2019, 8:26 AMRobert Jaros
09/13/2019, 8:33 AMRobert Jaros
09/13/2019, 8:38 AMsdeleuze
09/13/2019, 8:57 AM