Uploaded image for project: 'Teiid'
  1. Teiid
  2. TEIID-5430

Closing Teiid JDBC connection is delayed 5 seconds

    XMLWordPrintable

Details

    • Bug
    • Resolution: Done
    • Major
    • 11.1, 8.12.15.6_4
    • 8.12.13.6_4
    • JDBC Driver
    • None
    • Hide

      1. JDBCClient connect to teiid server, and sleep before closing connection.
      2. SIGSTIOP teiid server. (kill -sigstop <PID>)
      3. JDBCClient invokes Connection#close() after sleep.
      4. You can see the behavior that the closing takes a time 5 seconds.

      Show
      1. JDBCClient connect to teiid server, and sleep before closing connection. 2. SIGSTIOP teiid server. (kill -sigstop <PID>) 3. JDBCClient invokes Connection#close() after sleep. 4. You can see the behavior that the closing takes a time 5 seconds.

    Description

      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)
      

      [2]
      https://github.com/teiid/teiid/blob/master/client/src/main/java/org/teiid/net/socket/SocketServerConnection.java#L319-L329

      	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();
      	}
      

      Attachments

        Activity

          People

            rhn-engineering-shawkins Steven Hawkins
            rhn-support-hdaicho Hiroki Daicho (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            5 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: