Skip to content

Commit a7e2b61

Browse files
committed
PgCodec tries to fail a command in progress by firing a failure message through the Netty pipeline. This raise issues when there is a read in progress with reentrancy, while this issue should be also addressed in vertx core, proceeding this way means caring about the channel read/readComplete status to eventually emit a readComplete to respect the Netty inbound message protocol.
Instead we can simply fail the handler associated with the codec yielding the same result.
1 parent 54f164b commit a7e2b61

File tree

2 files changed

+5
-4
lines changed

2 files changed

+5
-4
lines changed

vertx-pg-client/src/main/java/io/vertx/pgclient/impl/codec/PgCodec.java

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@
1818

1919
import io.netty.channel.ChannelHandlerContext;
2020
import io.netty.channel.CombinedChannelDuplexHandler;
21+
import io.vertx.core.Completable;
2122
import io.vertx.sqlclient.ClosedConnectionException;
2223
import io.vertx.sqlclient.internal.command.CommandBase;
2324
import io.vertx.sqlclient.internal.command.CommandResponse;
@@ -82,9 +83,10 @@ private void fail(Throwable cause) {
8283
}
8384

8485
private void fail(PgCommandCodec<?, ?> codec, Throwable cause) {
85-
CommandResponse<Object> failure = CommandResponse.failure(cause);
86-
failure.cmd = (CommandBase) codec.cmd;
87-
chctx.fireChannelRead(failure);
86+
Completable<?> handler = codec.cmd.handler;
87+
if (handler != null) {
88+
handler.complete(null, cause);
89+
}
8890
}
8991

9092
@Override

vertx-pg-client/src/test/java/io/vertx/tests/pgclient/CloseConnectionTest.java

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,6 @@ private void testCloseConnection(TestContext ctx, Runnable test) {
7676
}
7777

7878
@Test
79-
@Ignore("Ignored due to https://github.com/eclipse-vertx/vertx-sql-client/issues/1506")
8079
public void testTransactionInProgressShouldFail(TestContext ctx) {
8180
ProxyServer proxy = ProxyServer.create(vertx, options.getPort(), options.getHost());
8281
proxy.proxyHandler(conn -> {

0 commit comments

Comments
 (0)