Hi,
I am switching from 2.8.1 to 2.12.0 and encounter an issue when closing
thin JDBC connection. This is my test case:
/ public static void main(String[] args) throws Exception//
// {//
// try (Ignite ignite = Ignition.start())//
// {//
// System.out.println("Connected...");//
// Thread.sleep(2000);//
//
//Class.forName("org.apache.ignite.IgniteJdbcThinDriver");//
// Connection jdbcConnection =
DriverManager.getConnection("jdbc:ignite:thin://localhost");//
// jdbcConnection.close();//
//
// System.out.println("JDBC connection closed...");//
// Thread.sleep(2000);//
// }//
// }/
On closing the jdbcConnection I can see a warning exception:
/01-02-2022 10:12:50.774 [ 80] WARN
ClientListenerProcessor Failed to shutdown socket
java.nio.channels.ClosedChannelException: null
at
sun.nio.ch.SocketChannelImpl.ensureOpen(SocketChannelImpl.java:165) ~[?:?]
at
sun.nio.ch.SocketChannelImpl.shutdownOutput(SocketChannelImpl.java:1006)
~[?:?]
at sun.nio.ch.SocketAdaptor.shutdownOutput(SocketAdaptor.java:395)
~[?:?]
at
org.apache.ignite.internal.util.IgniteUtils.close(IgniteUtils.java:4248)
[ignite-core-2.12.0.jar:2.12.0]
at
org.apache.ignite.internal.util.nio.GridNioServer$AbstractNioClientWorker.closeKey(GridNioServer.java:2784)
[ignite-core-2.12.0.jar:2.12.0]
at
org.apache.ignite.internal.util.nio.GridNioServer$AbstractNioClientWorker.close(GridNioServer.java:2835)
[ignite-core-2.12.0.jar:2.12.0]
at
org.apache.ignite.internal.util.nio.GridNioServer$AbstractNioClientWorker.close(GridNioServer.java:2794)
[ignite-core-2.12.0.jar:2.12.0]
at
org.apache.ignite.internal.util.nio.GridNioServer$AbstractNioClientWorker.bodyInternal(GridNioServer.java:2316)
[ignite-core-2.12.0.jar:2.12.0]
at
org.apache.ignite.internal.util.nio.GridNioServer$AbstractNioClientWorker.body(GridNioServer.java:1910)
[ignite-core-2.12.0.jar:2.12.0]
at
org.apache.ignite.internal.util.worker.GridWorker.run(GridWorker.java:125)
[ignite-core-2.12.0.jar:2.12.0]
at java.lang.Thread.run(Thread.java:832) [?:?]/
This seems to happen in IgniteUtils.java function on sock.shutdownOutput():
/ public static void close(@Nullable Socket sock, @Nullable
IgniteLogger log) {
if (sock == null)
return;
try {
// Avoid tls 1.3 incompatibility
https://bugs.openjdk.java.net/browse/JDK-8208526
sock.shutdownOutput();
sock.shutdownInput();
}
catch (ClosedChannelException | SocketException ex) {
LT.warn(log, "Failed to shutdown socket", ex);
}
catch (Exception e) {
warn(log, "Failed to shutdown socket: " + e.getMessage(), e);
}
try {
sock.close();
}
catch (ClosedChannelException | SocketException ex) {
LT.warn(log, "Failed to close socket", ex);
}
catch (Exception e) {
warn(log, "Failed to close socket: " + e.getMessage(), e);
}
}
/
Because of the exception on shutdownOutput() it skips the call to
shutdownInput(). Is this OK? Can the warning message be ignored? Should
it be a warning actually without stack trace?
I don't see this issue happening with Ignite 2.8.1, btw.
Thanks!