This is an automated email from the ASF dual-hosted git repository. dlych pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/asterixdb.git
commit 334cf2044cd3a27c9c1fe833a3ef13e0edadbdd9 Author: Murtadha Hubail <[email protected]> AuthorDate: Fri Feb 12 22:22:59 2021 +0300 [NO ISSUE][NET] Ensure handle is closed on ssl handshake failure - user model changes: no - storage format changes: no - interface changes: no Details: - When an ssl handshake fails, close the handle to notify any waiting threads on the handle to connect. - Ensure close is called on ssl socket. Change-Id: I2bd98065f606ad43121b7f06a729fa336f1a7360 Reviewed-on: https://asterix-gerrit.ics.uci.edu/c/asterixdb/+/10005 Integration-Tests: Jenkins <[email protected]> Reviewed-by: Murtadha Hubail <[email protected]> Reviewed-by: Hussain Towaileb <[email protected]> Tested-by: Jenkins <[email protected]> --- .../org/apache/hyracks/ipc/impl/IPCConnectionManager.java | 11 +++++++++-- .../java/org/apache/hyracks/ipc/sockets/SslSocketChannel.java | 7 +++++-- 2 files changed, 14 insertions(+), 4 deletions(-) diff --git a/hyracks-fullstack/hyracks/hyracks-ipc/src/main/java/org/apache/hyracks/ipc/impl/IPCConnectionManager.java b/hyracks-fullstack/hyracks/hyracks-ipc/src/main/java/org/apache/hyracks/ipc/impl/IPCConnectionManager.java index eaae8e7..5834f26 100644 --- a/hyracks-fullstack/hyracks/hyracks-ipc/src/main/java/org/apache/hyracks/ipc/impl/IPCConnectionManager.java +++ b/hyracks-fullstack/hyracks/hyracks-ipc/src/main/java/org/apache/hyracks/ipc/impl/IPCConnectionManager.java @@ -477,8 +477,7 @@ public class IPCConnectionManager { final Object attachment = key.attachment(); if (attachment != null) { final IPCHandle handle = (IPCHandle) attachment; - handle.close(); - unregisterHandle(handle); + closeHandle(handle); } key.cancel(); } @@ -527,6 +526,7 @@ public class IPCConnectionManager { connectionEstablished(handle, channelKey, socketChannel); } } else { + closeHandle(handle); close(channelKey, socketChannel.getSocketChannel()); } } @@ -538,5 +538,12 @@ public class IPCConnectionManager { handle.setKey(channelKey); channelKey.attach(handle); } + + private void closeHandle(IPCHandle handle) { + if (handle != null) { + handle.close(); + unregisterHandle(handle); + } + } } } diff --git a/hyracks-fullstack/hyracks/hyracks-ipc/src/main/java/org/apache/hyracks/ipc/sockets/SslSocketChannel.java b/hyracks-fullstack/hyracks/hyracks-ipc/src/main/java/org/apache/hyracks/ipc/sockets/SslSocketChannel.java index 74deefe..f9bf5c7 100644 --- a/hyracks-fullstack/hyracks/hyracks-ipc/src/main/java/org/apache/hyracks/ipc/sockets/SslSocketChannel.java +++ b/hyracks-fullstack/hyracks/hyracks-ipc/src/main/java/org/apache/hyracks/ipc/sockets/SslSocketChannel.java @@ -233,8 +233,11 @@ public class SslSocketChannel implements ISocketChannel { private void handleEndOfStreamQuietly() { try { - engine.closeInbound(); - close(); + try { + engine.closeInbound(); + } finally { + close(); + } } catch (Exception e) { LOGGER.warn("failed to close socket gracefully", e); }
