-
Bug
-
Resolution: Done
-
Major
-
8.12.13.6_4
-
None
Teiid JDBC Driver waits 5 seconds during closing connection when the client can not reach teiid server.
If many connections are pooling by the client as a Datasource, it takes more time the closing all connections.
e.g. if the datasource has 50 connections, the close time would be 5 seconds * 50.
[1] is the stacktrace whie the connection is closing with the delay.
When closing connection, teiid JDBC waits server response by Future#get() with timeout of 5 seconds.
So, it would be waiting for the time if the socket doesn't receive any response.
[1] Stacktrace when the connection waits 5 seconds.
"main" #1 prio=5 os_prio=0 tid=0x00007f5b1c009000 nid=0x707b runnable [0x00007f5b238ac000] java.lang.Thread.State: RUNNABLE at java.net.SocketInputStream.socketRead0(Native Method) at java.net.SocketInputStream.socketRead(SocketInputStream.java:116) at java.net.SocketInputStream.read(SocketInputStream.java:171) at java.net.SocketInputStream.read(SocketInputStream.java:141) at java.io.BufferedInputStream.fill(BufferedInputStream.java:246) at java.io.BufferedInputStream.read(BufferedInputStream.java:265) - locked <0x000000071c98cad0> (a org.teiid.core.util.AccessibleBufferedInputStream) at java.io.DataInputStream.readInt(DataInputStream.java:387) at org.teiid.netty.handler.codec.serialization.ObjectDecoderInputStream.readObjectOverride(ObjectDecoderInputStream.java:97) at java.io.ObjectInputStream.readObject(ObjectInputStream.java:416) at org.teiid.net.socket.OioOjbectChannelFactory$OioObjectChannel.read(OioOjbectChannelFactory.java:117) at org.teiid.net.socket.SocketServerInstanceImpl.read(SocketServerInstanceImpl.java:308) at org.teiid.net.socket.SocketServerInstanceImpl$RemoteInvocationHandler$1.get(SocketServerInstanceImpl.java:411) at org.teiid.net.socket.SocketServerConnection.logoff(SocketServerConnection.java:331) at org.teiid.net.socket.SocketServerConnection.close(SocketServerConnection.java:306) - locked <0x000000071c51bb48> (a org.teiid.net.socket.SocketServerConnection) at org.teiid.jdbc.ConnectionImpl.close(ConnectionImpl.java:282) at ClientMain.invoke(ClientMain.java:83) at ClientMain.main(ClientMain.java:30)
private void logoff() { disconnect(); try { //make a best effort to send the logoff Future<?> writeFuture = this.serverInstance.getService(ILogon.class).logoff(); writeFuture.get(5000, TimeUnit.MILLISECONDS); } catch (Exception e) { //ignore } closeServerInstance(); }