[ 
https://issues.apache.org/jira/browse/IGNITE-12032?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16928286#comment-16928286
 ] 

Lev Agafonov commented on IGNITE-12032:
---------------------------------------

Denis, thank you for helping me :)

I go deeper and could also reproduce exactly same stack trace against JDBC thin 
client.

The test:
{code:java}
import java.sql._
import org.scalatest.{FunSuite, Matchers}

class JdbcTest extends FunSuite with Matchers {

  test("Jdbc incorrect session close test") {
    val igniteHost = "*.*.*.*"
    val ignitePort = "10800"

    Class.forName("org.apache.ignite.IgniteJdbcThinDriver")
    val t = new Thread() {
      override def run() = {
        val conn = 
DriverManager.getConnection(s"jdbc:ignite:thin://${igniteHost}:${ignitePort}")
        //conn.close()
      }
    }
    t.start()
    Thread.sleep(100)
    t.interrupt()
  }
}{code}
The stack trace:

 
{code:java}
[12-Sep-2019 
09:18:13][ERROR][grid-nio-worker-client-listener-0-#29][ClientListenerProcessor]
 Failed to process selector key [ses=GridSelectorNioSessionImpl 
[worker=ByteBufferNioClientWorker [readBuf=java.nio.HeapByteBuffer[pos=0 
lim=8192 cap=8192], super=AbstractNioClientWorker [idx=0, bytesRcvd=0, 
bytesSent=0, bytesRcvd0=0, bytesSent0=0, select=true, super=GridWorker 
[name=grid-nio-worker-client-listener-0, igniteInstanceName=null, 
finished=false, heartbeatTs=1568269092688, hashCode=1630725146, 
interrupted=false, runner=grid-nio-worker-client-listener-0-#29]]], 
writeBuf=null, readBuf=null, inRecovery=null, outRecovery=null, 
closeSocket=true, super=GridNioSessionImpl [locAddr=/*.*.*.*:10800, 
rmtAddr=/*.*.*.*:59186, createTime=1568269092688, closeTime=0, bytesSent=0, 
bytesRcvd=0, bytesSent0=0, bytesRcvd0=0, sndSchedTime=1568269092688, 
lastSndTime=1568269092688, lastRcvTime=1568269092688, readsPaused=false, 
filterChain=FilterChain[filters=[GridNioAsyncNotifyFilter, GridNioCodecFilter 
[parser=ClientListenerBufferedParser, directMode=false]], accepted=true, 
markedForClose=false]]]
java.io.IOException: An existing connection was forcibly closed by the remote 
host
        at sun.nio.ch.SocketDispatcher.read0(Native Method)
        at sun.nio.ch.SocketDispatcher.read(SocketDispatcher.java:43)
        at sun.nio.ch.IOUtil.readIntoNativeBuffer(IOUtil.java:223)
        at sun.nio.ch.IOUtil.read(IOUtil.java:197)
        at sun.nio.ch.SocketChannelImpl.read(SocketChannelImpl.java:380)
        at 
org.apache.ignite.internal.util.nio.GridNioServer$ByteBufferNioClientWorker.processRead(GridNioServer.java:1120)
        at 
org.apache.ignite.internal.util.nio.GridNioServer$AbstractNioClientWorker.processSelectedKeysOptimized(GridNioServer.java:2407)
        at 
org.apache.ignite.internal.util.nio.GridNioServer$AbstractNioClientWorker.bodyInternal(GridNioServer.java:2174)
        at 
org.apache.ignite.internal.util.nio.GridNioServer$AbstractNioClientWorker.body(GridNioServer.java:1815)
        at 
org.apache.ignite.internal.util.worker.GridWorker.run(GridWorker.java:120)
        at java.lang.Thread.run(Thread.java:748)
[12-Sep-2019 09:18:13][WARN 
][grid-nio-worker-client-listener-0-#29][ClientListenerProcessor] Closing NIO 
session because of unhandled exception [cls=class 
o.a.i.i.util.nio.GridNioException, msg=An existing connection was forcibly 
closed by the remote host]
{code}
 

So, my suggestion that this kind of problem doesn't related to Odbc module, but 
to Core one.

If I do call conn.close() method - no errors are thrown in both JDBC and ODBC 
connections.

I think it will be good enough to make a small patch, making things more clear 
by changing current WARN message:

"Closing NIO session because of unhandled exception"

to something like 

"Network connection lost, closing NIO connection. Please, check database 
connection is closed in safe manner, by calling connection.close() method"

 

> Server node prints exception when ODBC driver disconnects
> ---------------------------------------------------------
>
>                 Key: IGNITE-12032
>                 URL: https://issues.apache.org/jira/browse/IGNITE-12032
>             Project: Ignite
>          Issue Type: Bug
>          Components: odbc
>    Affects Versions: 2.7.5
>            Reporter: Evgenii Zhuravlev
>            Priority: Major
>              Labels: newbie, usability
>             Fix For: 2.8
>
>
> Whenever a process using ODBC clients is finished, it's printing in the 
> node logs this exception: 
> {code:java}
> *[07:45:19,559][SEVERE][grid-nio-worker-client-listener-1-#30][ClientListenerProcessor]
>  
> Failed to process selector key [s 
> es=GridSelectorNioSessionImpl [worker=ByteBufferNioClientWorker 
> [readBuf=java.nio.HeapByteBuffer[pos=0 lim=8192 cap=8192 
> ], super=AbstractNioClientWorker [idx=1, bytesRcvd=0, bytesSent=0, 
> bytesRcvd0=0, bytesSent0=0, select=true, super=GridWo 
> rker [name=grid-nio-worker-client-listener-1, igniteInstanceName=null, 
> finished=false, heartbeatTs=1564289118230, hashCo 
> de=1829856117, interrupted=false, 
> runner=grid-nio-worker-client-listener-1-#30]]], writeBuf=null, 
> readBuf=null, inRecove 
> ry=null, outRecovery=null, super=GridNioSessionImpl 
> [locAddr=/0:0:0:0:0:0:0:1:10800, rmtAddr=/0:0:0:0:0:0:0:1:63697, cre 
> ateTime=1564289116225, closeTime=0, bytesSent=1346, bytesRcvd=588, 
> bytesSent0=0, bytesRcvd0=0, sndSchedTime=156428911623 
> 5, lastSndTime=1564289116235, lastRcvTime=1564289116235, readsPaused=false, 
> filterChain=FilterChain[filters=[GridNioAsyn 
> cNotifyFilter, GridNioCodecFilter [parser=ClientListenerBufferedParser, 
> directMode=false]], accepted=true, markedForClos 
> e=false]]] 
> java.io.IOException: An existing connection was forcibly closed by the 
> remote host 
>         at sun.nio.ch.SocketDispatcher.read0(Native Method) 
>         at sun.nio.ch.SocketDispatcher.read(SocketDispatcher.java:43) 
>         at sun.nio.ch.IOUtil.readIntoNativeBuffer(IOUtil.java:223) 
>         at sun.nio.ch.IOUtil.read(IOUtil.java:197) 
>         at sun.nio.ch.SocketChannelImpl.read(SocketChannelImpl.java:380) 
>         at 
> org.apache.ignite.internal.util.nio.GridNioServer$ByteBufferNioClientWorker.processRead(GridNioServer.java:11
>  
> 04) 
>         at 
> org.apache.ignite.internal.util.nio.GridNioServer$AbstractNioClientWorker.processSelectedKeysOptimized(GridNi
>  
> oServer.java:2389) 
>         at 
> org.apache.ignite.internal.util.nio.GridNioServer$AbstractNioClientWorker.bodyInternal(GridNioServer.java:215
>  
> 6) 
>         at 
> org.apache.ignite.internal.util.nio.GridNioServer$AbstractNioClientWorker.body(GridNioServer.java:1797)
>  
>         at 
> org.apache.ignite.internal.util.worker.GridWorker.run(GridWorker.java:120) 
>         at java.lang.Thread.run(Thread.java:748)* 
> {code}
> It's absolutely normal behavior when ODBC client disconnects from the node, 
> so, we shouldn't print exception in the log. We should replace it with 
> something like INFO message about ODBC client disconnection.
> Thread from user list: 
> http://apache-ignite-users.70518.x6.nabble.com/exceptions-in-Ignite-node-when-a-thin-client-process-ends-td28970.html



--
This message was sent by Atlassian Jira
(v8.3.2#803003)

Reply via email to