-
Notifications
You must be signed in to change notification settings - Fork 13k
Open
Labels
bug on dependency libraryIndicates a bug on dependency libraryIndicates a bug on dependency library
Description
About the Bug...
-
I have checked that this issue has not already been reported.
-
I have confirmed this bug exists on the latest version of MyBatis.
-
I have confirmed this bug reproduces without 3rd party extensions (e.g. mybatis-plus).
Database Version
OceanBase
JDBC Driver Version
oceanbase-client-2.4.11
Issue Description
Fix: Reduce thread blocking by double null check instead of synchronizing on Method object #521
We observed severe thread blocking issues in production: 980+ threads were blocked at OgnlRuntime.invokeMethod with the state BLOCKED (on object monitor), waiting to lock java.lang.reflect.Method objects.
# 980 threads blocked
"default-17571" #91915 prio=5 os_prio=0 tid=0x00007f7b7c05d800 nid=0x167f9 waiting for monitor entry [0x00007f757f772000]
java.lang.Thread.State: BLOCKED (on object monitor)
at org.apache.ibatis.ognl.OgnlRuntime.invokeMethod(OgnlRuntime.java:1151)
- waiting to lock <0x00000004a55aaf48> (a java.lang.reflect.Method)
at org.apache.ibatis.ognl.OgnlRuntime.getMethodValue(OgnlRuntime.java:2146)
at org.apache.ibatis.ognl.ObjectPropertyAccessor.getPossibleProperty(ObjectPropertyAccessor.java:66)
at org.apache.ibatis.ognl.ObjectPropertyAccessor.getProperty(ObjectPropertyAccessor.java:160)
at org.apache.ibatis.ognl.OgnlRuntime.getProperty(OgnlRuntime.java:3356)
...
# got method lock thread
"HSFBizProcessor-DEFAULT-6-thread-5179" #90650 daemon prio=10 os_prio=0 tid=0x00007f794c319000 nid=0x16214 waiting for monitor entry [0x00007f758366e000]
java.lang.Thread.State: BLOCKED (on object monitor)
at org.apache.ibatis.ognl.OgnlRuntime.invokeMethod(OgnlRuntime.java:1151)
- locked <0x00000004a55aaf48> (a java.lang.reflect.Method)
at org.apache.ibatis.ognl.OgnlRuntime.getMethodValue(OgnlRuntime.java:2146)
at org.apache.ibatis.ognl.ObjectPropertyAccessor.getPossibleProperty(ObjectPropertyAccessor.java:66)
at org.apache.ibatis.ognl.ObjectPropertyAccessor.getProperty(ObjectPropertyAccessor.java:160)
at org.apache.ibatis.ognl.OgnlRuntime.getProperty(OgnlRuntime.java:3356)
...
Root cause:
- Direct synchronization on
Methodobjects leads to heavy thread contention — all threads competing to execute method access checks must wait for the sameMethodmonitor, which severely degrades system concurrency and performance.
About your report...
-
I did not use images 🖼️ for showing text information (code, error, etc.).
-
I checked the Preview and my report looks awesome! 👍
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
bug on dependency libraryIndicates a bug on dependency libraryIndicates a bug on dependency library