java.lang.OutOfMemoryError: Metaspace

本文讲述了在系统迁移过程中遇到的java.lang.OutOfMemoryError:Metaspace错误,通过升级JDK版本1.8.0_60到1.8.0_192解决,提醒开发者注意迁移时的JDK检查和版本兼容问题。
摘要由CSDN通过智能技术生成

java.lang.OutOfMemoryError: Metaspace

近日做系统迁移,迁移完成后系统CPU持续负载报警,经查看日志中存在多条java.lang.OutOfMemoryError: Metaspace错误信息,具体日志如下:

Caused by: java.lang.InternalError: BMH.reinvoke=Lambda(a0:L/SpeciesData<L>,a1:L)=>{
t2:L=MethodHandleImpl.array(a1:L);
t3:L=Species_L.argL0(a0:L);
t4:L=MethodHandle.invokeBasic(t3:L,t
2:L);t4:L}
at java.lang.invoke.MethodHandleStatics.newInternalError(MethodHandleStatics.java:127) ~[?:1.8.0_60]
at java.lang.invoke.LambdaForm.compileToBytecode(LambdaForm.java:660) ~[?:1.8.0_60]
at java.lang.invoke.LambdaForm.prepare(LambdaForm.java:635) ~[?:1.8.0_60]
at java.lang.invoke.MethodHandle.<init>(MethodHandle.java:461) ~[?:1.8.0_60]
at java.lang.invoke.BoundMethodHandle.<init>(BoundMethodHandle.java:56) ~[?:1.8.0_60]
at java.lang.invoke.BoundMethodHandle$Species_L.<init>(BoundMethodHandle.java:209) ~[?:1.8.0_60]
at java.lang.invoke.BoundMethodHandle$Species_L.copyWith(BoundMethodHandle.java:226) ~[?:1.8.0_60]
at java.lang.invoke.MethodHandle.asCollector(MethodHandle.java:1002) ~[?:1.8.0_60]
at java.lang.invoke.MethodHandleImpl$AsVarargsCollector.asTypeUncached(MethodHandleImpl.java:502) ~[?:1.8.0_60]
at java.lang.invoke.MethodHandle.asType(MethodHandle.java:761) ~[?:1.8.0_60]
at java.lang.invoke.CallSite.makeUninitializedCallSite(CallSite.java:241) ~[?:1.8.0_60]
at java.lang.invoke.CallSite.<init>(CallSite.java:105) ~[?:1.8.0_60]
at java.lang.invoke.MutableCallSite.<init>(MutableCallSite.java:100) ~[?:1.8.0_60]
at jdk.internal.dynalink.support.AbstractRelinkableCallSite.<init>(AbstractRelinkableCallSite.java:104) ~[nashorn.jar:?]
at jdk.internal.dynalink.ChainedCallSite.<init>(ChainedCallSite.java:135) ~[nashorn.jar:?]
at jdk.nashorn.internal.runtime.linker.LinkerCallSite.<init>(LinkerCallSite.java:71) ~[nashorn.jar:?]
at jdk.nashorn.internal.runtime.linker.LinkerCallSite.newLinkerCallSite(LinkerCallSite.java:123) ~[nashorn.jar:?]
at jdk.nashorn.internal.runtime.linker.Bootstrap.bootstrap(Bootstrap.java:207) ~[nashorn.jar:?]
at jdk.nashorn.internal.runtime.linker.Bootstrap.createDynamicInvoker(Bootstrap.java:388) ~[nashorn.jar:?]
at jdk.nashorn.internal.runtime.linker.Bootstrap.createDynamicInvoker(Bootstrap.java:362) ~[nashorn.jar:?]
at jdk.nashorn.internal.runtime.linker.InvokeByName.<init>(InvokeByName.java:86) ~[nashorn.jar:?]
at jdk.nashorn.internal.runtime.linker.InvokeByName.<init>(InvokeByName.java:73) ~[nashorn.jar:?]
at jdk.nashorn.internal.objects.Global.<init>(Global.java:93) ~[nashorn.jar:?]
at jdk.nashorn.internal.runtime.Context.newGlobal(Context.java:1102) ~[nashorn.jar:?]
at jdk.nashorn.api.scripting.NashornScriptEngine$2.run(NashornScriptEngine.java:347) ~[nashorn.jar:?]
at jdk.nashorn.api.scripting.NashornScriptEngine$2.run(NashornScriptEngine.java:343) ~[nashorn.jar:?]
at java.security.AccessController.doPrivileged(Native Method) ~[?:1.8.0_60]
at jdk.nashorn.api.scripting.NashornScriptEngine.createNashornGlobal(NashornScriptEngine.java:343) ~[nashorn.jar:?]
at jdk.nashorn.api.scripting.NashornScriptEngine.<init>(NashornScriptEngine.java:143) ~[nashorn.jar:?]
at jdk.nashorn.api.scripting.NashornScriptEngineFactory.getScriptEngine(NashornScriptEngineFactory.java:148) ~[nashorn.jar:?]
at javax.script.ScriptEngineManager.getEngineByName(ScriptEngineManager.java:238) ~[?:1.8.0_60]
Caused by: java.lang.OutOfMemoryError: Metaspace

一筹莫展之际注意到JDK版本为1.8.0_60,而正常镜像中的JDK版本均为1.8.0_192,因此怀疑是不是JDK版本出了问题,然后重新打包编译、构建镜像上线后问题解决。

后经查证JDK1.8.0_60版本确实存在类似bug,附链接如下:
https://bugs.openjdk.java.net/browse/JDK-8066991
https://bugs.openjdk.java.net/browse/JDK-8129124
在这里插入图片描述
总结:
通过升级JDK版本解决此问题,在做系统迁移时应做好checklist,最好能结对迁移,不然不知道哪里就采坑啦!

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值