reactor线程阻塞引起故障

  • 大致线程模型:

reactor线程阻塞引起故障_第1张图片


  • jstack打印JVM堆栈,可以看到reactor线程阻塞了,导致它对应的前端连接无法使用。阻塞在了oracle驱动rollback动作,这里其实是因为oracle驱动为了保证串行请求响应而在底层加了锁,而这个通道被慢语句塞住了,所以reactor线程都塞了。
"$_NIOREACTOR-7-RW" prio=10 tid=0x00007f069856f000 nid=0xde1 waiting for monitor entry [0x00007f0677011000]
   java.lang.Thread.State: BLOCKED (on object monitor)
    at oracle.jdbc.driver.PhysicalConnection.rollback(PhysicalConnection.java:1167)
    - waiting to lock <0x000000068086fbc0> (a oracle.jdbc.driver.T4CConnection)


"$_NIOREACTOR-4-RW" prio=10 tid=0x00007f069851e000 nid=0xddd waiting for monitor entry [0x00007f0677415000]
   java.lang.Thread.State: BLOCKED (on object monitor)
    at oracle.jdbc.driver.PhysicalConnection.rollback(PhysicalConnection.java:1167)
    - waiting to lock <0x000000068083cf80> (a oracle.jdbc.driver.T4CConnection)


"$_NIOREACTOR-0-RW" prio=10 tid=0x00007f06984b2000 nid=0xdd9 waiting for monitor entry [0x00007f0677819000]
   java.lang.Thread.State: BLOCKED (on object monitor)
    at oracle.jdbc.driver.PhysicalConnection.rollback(PhysicalConnection.java:1167)
    - waiting to lock <0x000000068081c5f0> (a oracle.jdbc.driver.T4CConnection)

reactor线程阻塞引起故障_第2张图片


  • 解决方案,异步化
    reactor线程阻塞引起故障_第3张图片

========广告时间========

鄙人的新书《Tomcat内核设计剖析》已经在京东销售了,有需要的朋友可以到 https://item.jd.com/12185360.html 进行预定。感谢各位朋友。

为什么写《Tomcat内核设计剖析》

=========================

欢迎关注:

这里写图片描述

你可能感兴趣的:(reactor,线程模型,阻塞,jstack,oracle)