Skip to Content
avatar image
Former Member

JDBC deadlock on DriverSapDB.connect

Hi,

Today i get a JDBC dealock that i must shutdown and restart my application, i get the follow stack when investiganting the problem:

"http-80-exec-15" daemon prio=10 tid=0x0000000056fa8800 nid=0x4860 runnable [0x000000004292f000..0x0000000042930c90]
   java.lang.Thread.State: RUNNABLE
	at java.net.SocketInputStream.socketRead0(Native Method)
	at java.net.SocketInputStream.read(SocketInputStream.java:129)
	at com.sap.dbtech.rte.comm.BasicSocketComm.receiveData(BasicSocketComm.java:577)
	at com.sap.dbtech.rte.comm.BasicSocketComm.receive(BasicSocketComm.java:666)
	at com.sap.dbtech.rte.comm.JdbcCommunication.execute(JdbcCommunication.java:41)
	at com.sap.dbtech.jdbc.ConnectionSapDB.execute(ConnectionSapDB.java:536)
	- locked <0x00002aaafff16398> (a com.sap.dbtech.jdbc.ConnectionSapDB)
	at com.sap.dbtech.jdbc.ConnectionSapDB.execute(ConnectionSapDB.java:461)
	at com.sap.dbtech.jdbc.ConnectionSapDB.doConnect(ConnectionSapDB.java:398)
	at com.sap.dbtech.jdbc.ConnectionSapDB.<init>(ConnectionSapDB.java:109)
	at com.sap.dbtech.jdbc.DriverSapDB.connect(DriverSapDB.java:222)
	- locked <0x00002aaac64a7f48> (a com.sap.dbtech.jdbc.DriverSapDB)
	at java.sql.DriverManager.getConnection(DriverManager.java:582)
	at java.sql.DriverManager.getConnection(DriverManager.java:185)
        ...

"http-80-exec-122" daemon prio=10 tid=0x0000000059065800 nid=0x4bac waiting for monitor entry [0x000000004a6ac000..0x000000004a6add90]
   java.lang.Thread.State: BLOCKED (on object monitor)
	at com.sap.dbtech.jdbc.DriverSapDB.connect(DriverSapDB.java:197)
	- waiting to lock <0x00002aaac64a7f48> (a com.sap.dbtech.jdbc.DriverSapDB)
	at com.sap.dbtech.jdbcext.DataSourceSapDBBase.openPhysicalConnection(DataSourceSapDBBase.java:333)
	at com.sap.dbtech.jdbcext.DataSourceSapDB.getConnection(DataSourceSapDB.java:40)
        ...

This is only one thread have many more but with same Stack.

JDBC version is 7.6.03.07

JVM version is:

java version "1.6.0_06"

Java(TM) SE Runtime Environment (build 1.6.0_06-b02)

Java HotSpot(TM) 64-Bit Server VM (build 10.0-b22, mixed mode)

any idea how to avoid this?

KR Clóvis.

Edited by: Clovis Wichoski on May 28, 2008 1:30 PM

Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

4 Answers

  • Best Answer
    avatar image
    Former Member
    May 29, 2008 at 06:44 AM

    Hi,

    from the backtrace you can see that the threads block while reading from the socket. This means that the application is waiting for an answer from the database kernel. So I guess there is something happened in the kernel that causes the deadlock. You should have a look at the database message/error file for entries at the point of time where the deadlock happened.

    Regards,

    Marco

    Add comment
    10|10000 characters needed characters exceeded

    • Former Member

      Hi Marco,

      i checked error logs on database server and dont have any problem at database server, i dont understand because the com.sap.dbtech.jdbc.DriverSapDB must be locked to get new connections, appears that the driver have a singleton object and just return one connection per time, is this right? there is a way for us to see the JDBC sources?

      thanks

      Clóvis

  • avatar image
    Former Member
    May 28, 2008 at 12:28 PM

    Hai ,

    I think u r application u have two request are trying at a time so generally deadlock will arise

    to overcome this u can go for Wait and Notify methods .

    regards ,

    venkat

    Add comment
    10|10000 characters needed characters exceeded

  • avatar image
    Former Member
    May 29, 2008 at 07:14 AM

    Hai ,

    Here Error is showing Blocked for Waiting for monitor . thats what iam saying that u can go for Wait , Notify Methods , Or U ca go for Interthread communication U can Achievce this Right ,

    Regards ,

    Venkat

    Add comment
    10|10000 characters needed characters exceeded

    • Former Member

      Hi, Venkat

      i dont understand what you explain, can you show me what is the right thing to do what you say?

      thanks

      Clóvis

  • avatar image
    Former Member
    Jun 06, 2008 at 01:17 PM

    Hi,

    i found some interesting message from Alexander Schröder in follow archive:

    http://www.mail-archive.com/maxdb AT lists.mysql.com/msg03533.html

    cut:

    Hello,
    
    you might want to look at LOCKSTATISTICS whether there are row locks
    and the DELETE wants to have a tab exclusive lock on that table.
    
    If a lot of rows needs to be locked, MaxDB may decided to lock
    the complete table, which of course may wait if there are other 
    row locks by other sessions on that table. You may increase the
    MAXLOCKS database parameter, to increase the number of possible
    individual row locks.
    
    Regards
    
    Alexander Schröder
    SAP DB, SAP Labs Berlin

    that post appears to have the same scenario that i have here, then there is a way to log when a table is locked by complete? and because what if just one table is locked, no other JDBC connection can be made? for example, to query another table? appears that we have a "Connection lock" and dont a "Table lock".

    anyone can help with this?

    best regards.

    Clóvis

    Add comment
    10|10000 characters needed characters exceeded