[讨论] 疑似JDK1.7u79类解析问题

beanLam 2017-05-10

各位高手,请教一个问题~


JVM虚拟机在重启后,立即进行第一次程序调用时,加载部分class的耗时与空闲一段时间(例如:12小时)后,第一次程序调用,加载相同class的耗时不一致。后者消耗了较长的时间。


通过jstack在这段时间内,连续抓取线程栈信息,发现线程堵在以下调用栈上面
-----------------------------------------------------------------------------------------------------------

"Svc-TP-Worker-260" prio=10 tid=0x00007fc15006a000 nid=0xe84b runnable [0x00007fc0efef7000]

   java.lang.Thread.State: RUNNABLE

        at java.lang.ClassLoader.defineClass1(Native Method)

        at java.lang.ClassLoader.defineClass(ClassLoader.java:800)

        at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:142)

        at java.net.URLClassLoader.defineClass(URLClassLoader.java:449)

        at java.net.URLClassLoader.access$100(URLClassLoader.java:71)

        at java.net.URLClassLoader$1.run(URLClassLoader.java:361)

        at java.net.URLClassLoader$1.run(URLClassLoader.java:355)

        at java.security.AccessController.doPrivileged(Native Method)

        at java.net.URLClassLoader.findClass(URLClassLoader.java:354)

        at java.lang.ClassLoader.loadClass(ClassLoader.java:425)

        - locked <0x000000074020e5a8> (a java.lang.Object)

        at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:308)

        at java.lang.ClassLoader.loadClass(ClassLoader.java:358)

        at com.ziclix.python.sql.PyConnection.classDictInit(PyConnection.java:128)

        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)

        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)

        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)

        at java.lang.reflect.Method.invoke(Method.java:606)

        at org.python.core.PyJavaType.init(PyJavaType.java:534)

        at org.python.core.PyType.createType(PyType.java:1344)

        - locked <0x0000000770432908> (a java.lang.Class for org.python.core.PyType)

        at org.python.core.PyType.addFromClass(PyType.java:1281)

        - locked <0x0000000770432908> (a java.lang.Class for org.python.core.PyType)

        at org.python.core.PyType.fromClass(PyType.java:1371)

        - locked <0x0000000770432908> (a java.lang.Class for org.python.core.PyType)

        at org.python.core.PyType.computeLinearMro(PyType.java:545)

        at org.python.core.PyJavaType.init(PyJavaType.java:222)

        at org.python.core.PyType.createType(PyType.java:1344)

        - locked <0x0000000770432908> (a java.lang.Class for org.python.core.PyType)

        at org.python.core.PyType.addFromClass(PyType.java:1281)

        - eliminated <0x0000000770432908> (a java.lang.Class for org.python.core.PyType)

        at org.python.core.PyType.fromClass(PyType.java:1371)

        - locked <0x0000000770432908> (a java.lang.Class for org.python.core.PyType)

        at org.python.core.PyObject.<init>(PyObject.java:67)

        at com.ziclix.python.sql.PyConnection.<init>(PyConnection.java:90)

        at *******.python.ziclix.ExtendedConnection.<init>(ExtendedConnection.java:38)

        at *******.svc.pyengine.holder.PyConnsHolder.getConnFromPool(PyConnsHolder.java:76)

        at *******.svc.pyengine.holder.PyConnsHolder.getConnFromPool(PyConnsHolder.java:30)

        at *******.svc.holder.ConnsHolder.getConnection(ConnsHolder.java:78)

        at afa.pymodule.AFADBPool.getConnByName(AFADBPool.java:41)

        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)

        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)

        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)

        at java.lang.reflect.Method.invoke(Method.java:606)

        at org.python.core.PyReflectedFunction.__call__(PyReflectedFunction.java:186)

        at org.python.core.PyReflectedFunction.__call__(PyReflectedFunction.java:204)

        at org.python.core.PyObject.__call__(PyObject.java:403)

        at org.python.core.PyObject.__call__(PyObject.java:407)

        at PyDB$py.PyDBExecOneSQL$10(/home/*******/workspace/share_python/tech_component/PyLib/PyDB.py:1008)

        at PyDB$py.call_function(/home/*******/workspace/share_python/tech_component/PyLib/PyDB.py)

        at org.python.core.PyTableCode.call(PyTableCode.java:165)

        at org.python.core.PyBaseCode.call(PyBaseCode.java:301)

        at org.python.core.PyFunction.function___call__(PyFunction.java:406)

        at org.python.core.PyFunction.__call__(PyFunction.java:401)

        at org.python.core.PyFunction.__call__(PyFunction.java:391)

        at B_RiskCtrl$py.B_RiskCtrl_SelTimeOutTrade$5(/home/*******/workspace/share_python/tech_component/component/B_RiskCtrl.py:344)

        at B_RiskCtrl$py.call_function(/home/*******/workspace/share_python/tech_component/component/B_RiskCtrl.py)

        at org.python.core.PyTableCode.call(PyTableCode.java:165)

        at org.python.core.PyBaseCode.call(PyBaseCode.java:301)

        at org.python.core.PyFunction.function___call__(PyFunction.java:406)

        at org.python.core.PyFunction.__call__(PyFunction.java:401)

        at org.python.core.PyFunction.__call__(PyFunction.java:391)

        at TVOUH_B0001$py.TB0001_STEP1_NODE10$10(/home/*******/workspace/projects/CMOD/apps/VOUH/trade/TVOUH_B0001.py:348)

        at TVOUH_B0001$py.call_function(/home/*******/workspace/projects/CMOD/apps/VOUH/trade/TVOUH_B0001.py)

        at org.python.core.PyTableCode.call(PyTableCode.java:165)

        at org.python.core.PyBaseCode.call(PyBaseCode.java:184)

        at org.python.core.PyFunction.__call__(PyFunction.java:380)

        at TVOUH_B0001$py.TB0001_STEP1_IMPL$18(/home/*******/workspace/projects/CMOD/apps/VOUH/trade/TVOUH_B0001.py:545)

        at TVOUH_B0001$py.call_function(/home/*******/workspace/projects/CMOD/apps/VOUH/trade/TVOUH_B0001.py)

        at org.python.core.PyTableCode.call(PyTableCode.java:165)

        at org.python.core.PyBaseCode.call(PyBaseCode.java:184)

        at org.python.core.PyFunction.__call__(PyFunction.java:380)

        at TVOUH_B0001$py.MB0001_ENTRY$68(/home/*******/workspace/projects/CMOD/apps/VOUH/trade/TVOUH_B0001.py:1713)

        at TVOUH_B0001$py.call_function(/home/*******/workspace/projects/CMOD/apps/VOUH/trade/TVOUH_B0001.py)

        at org.python.core.PyTableCode.call(PyTableCode.java:165)

        at org.python.core.PyBaseCode.call(PyBaseCode.java:149)

        at org.python.core.PyFunction.__call__(PyFunction.java:357)

        at org.python.core.PyFunction.__call__(PyFunction.java:352)

        at *******.svc.pyengine.PyEngine.run(PyEngine.java:166)

        at *******.svc.pyengine.PyEngine.execute(PyEngine.java:87)

        at *******.svc.handler.TradeHandler.handle(TradeHandler.java:45)

        at *******.svc.handler.HandlerChain.handle(HandlerChain.java:36)

        at *******.svc.threadpool.Task.run(Task.java:49)

        at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:471)

        at java.util.concurrent.FutureTask.run(FutureTask.java:262)

        at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)

        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)

 

        at java.lang.Thread.run(Thread.java:745)

-----------------------------------------------------------------------------------------------------------

 

在这个时间段内,同时抓取本地线程栈信息如下:

-----------------------------------------------------------------------------------------------------------

----------------- 59905 -----------------

0x00007fe7423c343d      _ZN8JvmtiEnv21GetThreadLocalStorageEP8_jobjectPPv + 0x22d

0x00007fe72aee93ff      tryToAcquireReentrancyToken + 0x2f

0x00007fe72aee7f48      transformClassFile + 0x48

0x00007fe72aee4e06      eventHandlerClassFileLoadHook + 0x96

0x00007fe7423d76bf      _ZN11JvmtiExport25post_class_file_load_hookEP6Symbol6HandleS2_PPhS4_S4_Pi + 0x63f

0x00007fe7420ea501      _ZN15ClassFileParser14parseClassFileEP6Symbol6HandleS2_11KlassHandleP13GrowableArrayIS2_ER13TempNewSymbolbP6Thread + 0x1e1

0x00007fe742606ea2      _ZN16SystemDictionary19resolve_from_streamEP6Symbol6HandleS2_P15ClassFileStreambP6Thread + 0x152

0x00007fe74236a0d5      _ZL23jvm_define_class_commonP7JNIEnv_PKcP8_jobjectPKaiS4_S2_hP6Thread + 0x335

0x00007fe74236a3d2      JVM_DefineClassWithSource + 0xc2

0x00007fe7417b628f      Java_java_lang_ClassLoader_defineClass1 + 0x25f

0x00007fe739012d98      * java.lang.ClassLoader.defineClass1(java.lang.String, byte[], int, int, java.security.ProtectionDomain, java.lang.String) bci:0 (Interpreted frame)

0x00007fe739006233      * java.lang.ClassLoader.defineClass(java.lang.String, byte[], int, int, java.security.ProtectionDomain) bci:30 line:800 (Interpreted frame)

0x00007fe739006233      * java.security.SecureClassLoader.defineClass(java.lang.String, byte[], int, int, java.security.CodeSource) bci:12 line:142 (Interpreted frame)

0x00007fe739006233      * java.net.URLClassLoader.defineClass(java.lang.String, sun.misc.Resource) bci:220 line:449 (Interpreted frame)

----------------- 60121 -----------------

-----------------------------------------------------------------------------------------------------------

 

有没有人碰见过这问题??求解。

 

glmylove 2019-09-17
找到原因了吗?我们现在也遇到这样的问题
Global site tag (gtag.js) - Google Analytics