Skip to content

Commit

Permalink
fix: remove receiving EOF from backend after cancel since according t…
Browse files Browse the repository at this point in the history
…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 23cce8a
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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'");
Expand Down

0 comments on commit 23cce8a

Please sign in to comment.