简体   繁体   English

在oracle.jdbc.driver.T4CConnection上找到锁定的对象

[英]Locked object found on oracle.jdbc.driver.T4CConnection

I am using JMC to perform application profiling and I did not see any locked/thread contention as shown in the screenshot below. 我正在使用JMC执行应用程序性能分析,但没有看到任何锁定/线程争用,如下面的屏幕快照所示。

在此处输入图片说明 在此处输入图片说明 在此处输入图片说明 I ran the SQL below (every few secs) also did not return any result. 我在下面(每隔几秒钟)运行了SQL,也没有返回任何结果。

select 
   (select username from v$session where sid=a.sid) blocker,
   a.sid,
   ' is blocking ',
   (select username from v$session where sid=b.sid) blockee,
   b.sid
from 
   v$lock a, 
   v$lock b
where 
   a.block = 1
and 
   b.request > 0
and 
   a.id1 = b.id1
and 
   a.id2 = b.id2;

What could be the caused of a lock database connection? 数据库连接锁定可能是什么原因? Could it be database record/table locks? 可能是数据库记录/表锁吗?

Below is the thread dump which I have extracted during the execution of my program when it seems to be running forever. 下面是我似乎永远运行的程序执行期间提取的线程转储。

   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:170)
    at java.net.SocketInputStream.read(SocketInputStream.java:141)
    at oracle.net.ns.Packet.receive(Packet.java:283)
    at oracle.net.ns.DataPacket.receive(DataPacket.java:103)
    at oracle.net.ns.NetInputStream.getNextPacket(NetInputStream.java:230)
    at oracle.net.ns.NetInputStream.read(NetInputStream.java:175)
    at oracle.net.ns.NetInputStream.read(NetInputStream.java:100)
    at oracle.net.ns.NetInputStream.read(NetInputStream.java:85)
    at oracle.jdbc.driver.T4CSocketInputStreamWrapper.readNextPacket(T4CSocketInputStreamWrapper.java:123)
    at oracle.jdbc.driver.T4CSocketInputStreamWrapper.read(T4CSocketInputStreamWrapper.java:79)
    at oracle.jdbc.driver.T4CMAREngine.unmarshalUB1(T4CMAREngine.java:1122)
    at oracle.jdbc.driver.T4CMAREngine.unmarshalSB1(T4CMAREngine.java:1099)
    at oracle.jdbc.driver.T4CTTIfun.receive(T4CTTIfun.java:288)
    at oracle.jdbc.driver.T4CTTIfun.doRPC(T4CTTIfun.java:191)
    at oracle.jdbc.driver.T4C8Oall.doOALL(T4C8Oall.java:523)
    at oracle.jdbc.driver.T4CPreparedStatement.doOall8(T4CPreparedStatement.java:207)
    at oracle.jdbc.driver.T4CPreparedStatement.executeForDescribe(T4CPreparedStatement.java:863)
    at oracle.jdbc.driver.OracleStatement.executeMaybeDescribe(OracleStatement.java:1153)
    at oracle.jdbc.driver.OracleStatement.doExecuteWithTimeout(OracleStatement.java:1275)
    at oracle.jdbc.driver.OraclePreparedStatement.executeInternal(OraclePreparedStatement.java:3576)
    at oracle.jdbc.driver.OraclePreparedStatement.executeQuery(OraclePreparedStatement.java:3620)
    - locked <0x00000007af3423c0> (a oracle.jdbc.driver.T4CConnection)

You're confusing database locks with Java locks here. 您在这里将数据库锁与Java锁混淆了。 JMC only shows you the locks inside your Java program (synchronized blocks, waits etc), it knows nothing about what's going on inside your DB. JMC仅向您显示Java程序内部的锁(同步块,等待等),而对DB内部的情况一无所知。 Your SQL-query only shows the locks on the DB level (table locks, row locks etc) and knows nothing about the locks inside your Java program. 您的SQL查询仅显示数据库级别的锁(表锁,行锁等),而对Java程序内部的锁一无所知。 Those are absolutely different areas and absolutely different locks. 那是绝对不同的区域,绝对不同的锁。

What you have here is a dump of a thread that holds a lock on the object of type T4CConnection with the address 0x7af3423c0 . 你在这里什么是持有型的对象上的锁的线程转储T4CConnection与地址0x7af3423c0 It only means that this thread is in the process of executing a code inside some synchronized(connection) block. 这仅意味着该线程正在执行某个synchronized(connection)块中的代码。 That's all. 就这样。 The thread is not blocked by other threads (otherwise its state wouldn't be RUNNABLE , it would be WAITING or BLOCKED ). 该线程不会被其他线程阻塞(否则其状态将不是RUNNABLE ,它将是WAITINGBLOCKED )。 It's running and reading something from a network socket (probably, the response from the DB). 它正在运行并从网络套接字读取内容(可能是来自数据库的响应)。

Such behaviour is absolutely normal. 这种行为是绝对正常的。 The DB driver does synchronization on the connection instance while it's in the process of executing an SQL-query to not allow other threads to use it in parallel. 数据库驱动程序在执行SQL查询的过程中会在连接实例上进行同步,以不允许其他线程并行使用它。

There's nothing you should worry about on this screenshot and in this thread dump. 在此屏幕截图和此线程转储中,您无需担心。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 java.io.NotSerializableException-oracle.jdbc.driver.T4CConnection - java.io.NotSerializableException - oracle.jdbc.driver.T4CConnection 使用解包的oracle.jdbc.driver.T4CConnection的HikariCP连接泄漏 - HikariCP Connection Leak using unwrapped oracle.jdbc.driver.T4CConnection java.lang.ClassCastException:oracle.jdbc.driver.T4CConnection无法转换为com.arjuna.ats.internal.arjuna.recovery.Connection - java.lang.ClassCastException: oracle.jdbc.driver.T4CConnection cannot be cast to com.arjuna.ats.internal.arjuna.recovery.Connection oracle.jdbc.driver.T4CConnection.getSchema()异常 - oracle.jdbc.driver.T4CConnection.getSchema() exception Oracle 驱动程序错误 oracle.jdbc.driver.T4CConnection.isValid(I)Z - Oracle Driver Error oracle.jdbc.driver.T4CConnection.isValid(I)Z 无法将JAVA / Oracle-weblogic.jdbc.wrapper.poolconnection_oracle_jdbc_driver_t4cconnection强制转换为oracle.jdbc.driver.oracleconnection - JAVA/Oracle-weblogic.jdbc.wrapper.poolconnection_oracle_jdbc_driver_t4cconnection cannot be cast to oracle.jdbc.driver.oracleconnection Maven编译和运行时错误java.lang.AbstractMethodError:Tomcat 8 Server上的oracle.jdbc.driver.T4CConnection.isValid(I)Z - Maven compilation and run time error java.lang.AbstractMethodError: oracle.jdbc.driver.T4CConnection.isValid(I)Z on Tomcat 8 Server 表类型的调用过程。 创建结构时发生异常:java.lang.AbstractMethodError:oracle.jdbc.driver.T4CConnection.createStruct - Call procedure with a table type. Exception while create Struct: java.lang.AbstractMethodError: oracle.jdbc.driver.T4CConnection.createStruct 找不到Oracle JDBC驱动程序 - Oracle JDBC driver not found 没有找到适合“jdbc:oracle:thin:@**** “oracle/jdbc/driver/OracleDriver”的驱动程序; - No suitable driver found for "jdbc:oracle:thin:@**** "oracle/jdbc/driver/OracleDriver";
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM