We’ve are making the same upgrade (2.8.1 -> 2.11.1) and are seeing a similar
exception when both thick and thin clients disconnect:
```
Failed to shutdown socket: null
java.nio.channels.ClosedChannelException: null
at
sun.nio.ch.SocketChannelImpl.ensureOpen(SocketChannelImpl.java:160) ~[?:?]
at
sun.nio.ch.SocketChannelImpl.shutdownOutput(SocketChannelImpl.java:930) ~[?:?]
at
sun.nio.ch.SocketAdaptor.shutdownOutput(SocketAdaptor.java:406) ~[?:?]
at
org.apache.ignite.internal.util.IgniteUtils.close(IgniteUtils.java:4231)
[ignite-core-2.11.1.jar:2.11.1]
at
org.apache.ignite.internal.util.nio.GridNioServer$AbstractNioClientWorker.closeKey(GridNioServer.java:2784)
[ignite-core-2.11.1.jar:2.11.1]
at
org.apache.ignite.internal.util.nio.GridNioServer$AbstractNioClientWorker.close(GridNioServer.java:2835)
[ignite-core-2.11.1.jar:2.11.1]
at
org.apache.ignite.internal.util.nio.GridNioServer$AbstractNioClientWorker.close(GridNioServer.java:2794)
[ignite-core-2.11.1.jar:2.11.1]
at
org.apache.ignite.internal.util.nio.GridNioServer$AbstractNioClientWorker.bodyInternal(GridNioServer.java:2157)
[ignite-core-2.11.1.jar:2.11.1]
at
org.apache.ignite.internal.util.nio.GridNioServer$AbstractNioClientWorker.body(GridNioServer.java:1910)
[ignite-core-2.11.1.jar:2.11.1]
at
org.apache.ignite.internal.util.worker.GridWorker.run(GridWorker.java:120)
[ignite-core-2.11.1.jar:2.11.1]
at java.lang.Thread.run(Thread.java:829) [?:?]
```
and
```
Failed to shutdown socket: Socket output is already shutdown
java.net.SocketException: Socket output is already shutdown at
java.net.Socket.shutdownOutput(Socket.java:1573) ~[?:?] at
org.apache.ignite.internal.util.IgniteUtils.close(IgniteUtils.java:4231)
[ignite-core-2.11.1.jar:2.11.1] at
org.apache.ignite.spi.discovery.tcp.ServerImpl$SocketReader.body(ServerImpl.java:7382)
[ignite-core-2.11.1.jar:2.11.1] at
org.apache.ignite.spi.IgniteSpiThread.run(IgniteSpiThread.java:58)
[ignite-core-2.11.1.jar:2.11.1]
```
From: Thomas Kramer <[email protected]>
Sent: Tuesday, February 1, 2022 3:04 AM
To: [email protected]
Subject: Warning Exception closing JdbcConnection
CAUTION: This email originated from outside of the organization. Do not click
links or open attachments unless you recognize the sender and know the content
is safe.
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!