7回复
3年前
Unsafe.defineClass挂起-反射速度慢
https://heapdump.cn/question/258925
这个链接一样的问题
在Java 8 / SpringBoot / Tomcat 8.5 Web应用程序中观察到运行时间极长的请求(> 30s)。而且卡顿时间会随程序运行时间变久。但是大部分请求的响应还是正常的。卡顿发生时的cpu负载增长到100%,过几分钟后会自己降下来。
Threaddumps显示Unsafe.defineClass正在挂起:
"http-nio-8080-exec-9" #254 daemon prio=5 os_prio=0 tid=0x00007f8a98b4f000 nid=0x2258 runnable [0x00007f89fb0b0000]
java.lang.Thread.State: RUNNABLE
at sun.misc.Unsafe.defineClass(Native Method)
at sun.reflect.ClassDefiner.defineClass(ClassDefiner.java:63)
at sun.reflect.MethodAccessorGenerator$1.run(MethodAccessorGenerator.java:399)
at sun.reflect.MethodAccessorGenerator$1.run(MethodAccessorGenerator.java:394)
at java.security.AccessController.doPrivileged(Native Method)
at sun.reflect.MethodAccessorGenerator.generate(MethodAccessorGenerator.java:393)
at sun.reflect.MethodAccessorGenerator.generateMethod(MethodAccessorGenerator.java:75)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:53)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at org.springframework.beans.BeanUtils.copyProperties(BeanUtils.java:618)
at org.springframework.beans.BeanUtils.copyProperties(BeanUtils.java:538)
at com.haigui.stateaction.action_impl.DisputeSubmit.insertDisputeInfo(DisputeSubmit.java:128)
pstack 输出的调用栈如下
1833 阅读