Skip to content
Permalink
Browse files
fix: remove receiving EOF from backend after cancel since according t…
…o protocol the server closes the connection once cancel is sent (connection reset exception is always thrown) (#1641)

quote "The server will process this [cancel] request and then close the connection. For security reasons, no direct reply is made to the cancel request message." https://www.postgresql.org/docs/current/protocol-flow.html
  • Loading branch information
mahmoudbahaa authored and davecramer committed Dec 16, 2019
1 parent aaccf43 commit 23cce8ad35d9af6e2a1cb97fac69fdc0a7f94b42
Showing with 1 addition and 2 deletions.
  1. +0 −1 pgjdbc/src/main/java/org/postgresql/core/QueryExecutorBase.java
  2. +1 −1 pgjdbc/src/test/java/org/postgresql/test/jdbc2/StatementTest.java
@@ -185,7 +185,6 @@ public void sendQueryCancel() throws SQLException {
cancelStream.sendInteger4(cancelPid);
cancelStream.sendInteger4(cancelKey);
cancelStream.flush();
cancelStream.receiveEOF();
} catch (IOException e) {
// Safe to ignore.
LOGGER.log(Level.FINEST, "Ignoring exception on cancel request:", e);
@@ -902,7 +902,7 @@ public Void call() throws Exception {
}
}

@Test(timeout = 20000)
@Test(timeout = 2000)
public void testFastCloses() throws SQLException {
ExecutorService executor = Executors.newSingleThreadExecutor();
con.createStatement().execute("SET SESSION client_min_messages = 'NOTICE'");

0 comments on commit 23cce8a

Please sign in to comment.