java.lang.OutOfMemoryError:Java堆空间

发布于 2024-11-08 21:21:03 字数 2711 浏览 0 评论 0原文

我的应用程序部署在集群环境上。最近,服务器出现以下堆栈跟踪故障。它似乎不是来自代码。一直运行正常,直到最近出现这个错误。服务器没有进行重大更改。有人可以建议吗?

java.lang.OutOfMemoryError: Java heap space
    at java.lang.AbstractStringBuilder.<init>(AbstractStringBuilder.java:44)
    at java.lang.StringBuilder.<init>(StringBuilder.java:69)
    at java.io.ObjectStreamClass$FieldReflectorKey.<init>(ObjectStreamClass.java:2106)
    at java.io.ObjectStreamClass.getReflector(ObjectStreamClass.java:2039)
    at java.io.ObjectStreamClass.initNonProxy(ObjectStreamClass.java:586)
    at java.io.ObjectInputStream.readNonProxyDesc(ObjectInputStream.java:1552)
    at java.io.ObjectInputStream.readClassDesc(ObjectInputStream.java:1466)
    at java.io.ObjectInputStream.readArray(ObjectInputStream.java:1591)
    at java.io.ObjectInputStream.readObject0(ObjectInputStream.java:1299)
    at java.io.ObjectInputStream.readObject(ObjectInputStream.java:348)
    at weblogic.utils.io.ChunkedObjectInputStream.readObject(ChunkedObjectInputStream.java:195)
    at weblogic.rjvm.MsgAbbrevInputStream.readObject(MsgAbbrevInputStream.java:565)
    at weblogic.utils.io.ChunkedObjectInputStream.readObject(ChunkedObjectInputStream.java:191)
    at weblogic.rmi.internal.dgc.DGCServerImpl_WLSkel.invoke(Unknown Source)
    at weblogic.rmi.internal.BasicServerRef.invoke(BasicServerRef.java:589)
    at weblogic.rmi.internal.BasicServerRef$1.run(BasicServerRef.java:479)
    at weblogic.security.acl.internal.AuthenticatedSubject.doAs(AuthenticatedSubject.java:363)
    at weblogic.security.service.SecurityManager.runAs(Unknown Source)
    at weblogic.rmi.internal.BasicServerRef.handleRequest(BasicServerRef.java:475)
    at weblogic.rmi.internal.BasicServerRef.access$300(BasicServerRef.java:59)
    at weblogic.rmi.internal.BasicServerRef$BasicExecuteRequest.run(BasicServerRef.java:1016)
    at weblogic.work.SelfTuningWorkManagerImpl.schedule(SelfTuningWorkManagerImpl.java:126)
    at weblogic.rmi.internal.BasicServerRef.dispatch(BasicServerRef.java:321)
    at weblogic.rmi.internal.BasicServerRef.dispatch(BasicServerRef.java:918)
    at weblogic.rjvm.RJVMImpl.dispatchRequest(RJVMImpl.java:1084)
    at weblogic.rjvm.RJVMImpl.dispatch(RJVMImpl.java:1001)
    at weblogic.rjvm.ConnectionManagerServer.handleRJVM(ConnectionManagerServer.java:240)
    at weblogic.rjvm.ConnectionManager.dispatch(ConnectionManager.java:877)
    at weblogic.rjvm.MsgAbbrevJVMConnection.dispatch(MsgAbbrevJVMConnection.java:446)
    at weblogic.rjvm.t3.MuxableSocketT3.dispatch(MuxableSocketT3.java:368)
    at weblogic.socket.AbstractMuxableSocket.dispatch(AbstractMuxableSocket.java:383)
    at weblogic.socket.SocketMuxer.readReadySocketOnce(SocketMuxer.java:872)

My application is deployed on a cluster environment. Recently the server went down with the following stacktrace. It doesn't seem to be coming from the code. It was running all right until recently when this error pop up. No major changes were made to the server. Can someone advise?

java.lang.OutOfMemoryError: Java heap space
    at java.lang.AbstractStringBuilder.<init>(AbstractStringBuilder.java:44)
    at java.lang.StringBuilder.<init>(StringBuilder.java:69)
    at java.io.ObjectStreamClass$FieldReflectorKey.<init>(ObjectStreamClass.java:2106)
    at java.io.ObjectStreamClass.getReflector(ObjectStreamClass.java:2039)
    at java.io.ObjectStreamClass.initNonProxy(ObjectStreamClass.java:586)
    at java.io.ObjectInputStream.readNonProxyDesc(ObjectInputStream.java:1552)
    at java.io.ObjectInputStream.readClassDesc(ObjectInputStream.java:1466)
    at java.io.ObjectInputStream.readArray(ObjectInputStream.java:1591)
    at java.io.ObjectInputStream.readObject0(ObjectInputStream.java:1299)
    at java.io.ObjectInputStream.readObject(ObjectInputStream.java:348)
    at weblogic.utils.io.ChunkedObjectInputStream.readObject(ChunkedObjectInputStream.java:195)
    at weblogic.rjvm.MsgAbbrevInputStream.readObject(MsgAbbrevInputStream.java:565)
    at weblogic.utils.io.ChunkedObjectInputStream.readObject(ChunkedObjectInputStream.java:191)
    at weblogic.rmi.internal.dgc.DGCServerImpl_WLSkel.invoke(Unknown Source)
    at weblogic.rmi.internal.BasicServerRef.invoke(BasicServerRef.java:589)
    at weblogic.rmi.internal.BasicServerRef$1.run(BasicServerRef.java:479)
    at weblogic.security.acl.internal.AuthenticatedSubject.doAs(AuthenticatedSubject.java:363)
    at weblogic.security.service.SecurityManager.runAs(Unknown Source)
    at weblogic.rmi.internal.BasicServerRef.handleRequest(BasicServerRef.java:475)
    at weblogic.rmi.internal.BasicServerRef.access$300(BasicServerRef.java:59)
    at weblogic.rmi.internal.BasicServerRef$BasicExecuteRequest.run(BasicServerRef.java:1016)
    at weblogic.work.SelfTuningWorkManagerImpl.schedule(SelfTuningWorkManagerImpl.java:126)
    at weblogic.rmi.internal.BasicServerRef.dispatch(BasicServerRef.java:321)
    at weblogic.rmi.internal.BasicServerRef.dispatch(BasicServerRef.java:918)
    at weblogic.rjvm.RJVMImpl.dispatchRequest(RJVMImpl.java:1084)
    at weblogic.rjvm.RJVMImpl.dispatch(RJVMImpl.java:1001)
    at weblogic.rjvm.ConnectionManagerServer.handleRJVM(ConnectionManagerServer.java:240)
    at weblogic.rjvm.ConnectionManager.dispatch(ConnectionManager.java:877)
    at weblogic.rjvm.MsgAbbrevJVMConnection.dispatch(MsgAbbrevJVMConnection.java:446)
    at weblogic.rjvm.t3.MuxableSocketT3.dispatch(MuxableSocketT3.java:368)
    at weblogic.socket.AbstractMuxableSocket.dispatch(AbstractMuxableSocket.java:383)
    at weblogic.socket.SocketMuxer.readReadySocketOnce(SocketMuxer.java:872)

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(5

自演自醉 2024-11-15 21:21:03

您的内存不足,这表明存在以下情况之一:

  • 您需要为进程提供更多内存(使用 -Xmx java 命令行选项);或者
  • 你有内存泄漏

如果没有更多信息,很难说是哪种情况。 OutOfMemoryError 的堆栈跟踪很少有用,因为它仅显示堆耗尽的点;它没有告诉你为什么堆被填满。

You are running out of memory, which suggests one of the following:

  • you need to give your process more memory (with the -Xmx java command line option); or
  • you have a memory leak

Without more information, it's hard to say which is the case. The stack trace for an OutOfMemoryError is rarely useful, as it only shows the point at which heap was exhausted; it doesn't show you why your heap is being filled up.

橙幽之幻 2024-11-15 21:21:03

Simon Nickerson 的答案是正确的

只是补充一下,您的堆栈跟踪从 weblogic.socket.SocketMuxer.readReadySocketOnce 开始,它是接受传入请求的内部 weblogic 类。所以这意味着服务器没有足够的内存来接受请求。

The answer by Simon Nickerson is correct

Just to add, your stack trace begins from weblogic.socket.SocketMuxer.readReadySocketOnce which is the internal weblogic class that accepts incoming requests. So this means the server is not having enough memory to accept requests also.

此岸叶落 2024-11-15 21:21:03

您使用的是 JRockit JVM 吗?如果是的话,您可以使用 JRockit Mission Control 并监视 Java 堆的使用情况。您还可以使用 JRockit Flight Recorder 记录 JVM 事件以进行离线分析。这里有一个关于此问题的 Oracle 网络广播:http://www.vimeo.com/22109838。您可以跳到 4:54,这是 JRockit、WLDF 和 JRF 概述开始的地方。

请记住,当堆已满时,NEXT 操作会因 OutOfMemory 异常而失败,因此此堆栈跟踪可能不会指示失败的任何原因。这只是表明当此代码运行时没有足够的堆,而不是此代码导致堆填满。

** 编辑...

显然,在执行此特定操作时,服务器内存不足。问题是……为什么?此堆栈跟踪不会告诉您原因,它只是表明当时发生的任何事情都无法完成,因为当时没有足够的可用内存。这并不意味着它是问题的原因。

当然,您可以添加更多内存,但这可能无法解决问题 - 它可能只会需要更长的时间才能出现。

Are you using the JRockit JVM? If you are you can use JRockit Mission Control and monitor the Java heap usage. You can also use the JRockit Flight Recorder to record JVM events for offline analysis. There is an Oracle webcast on this here: http://www.vimeo.com/22109838. You can skip to 4:54 which is where the overview of JRockit, WLDF and JRF starts.

Keep in mind that when the heap is full it is the NEXT operation that fails with the OutOfMemory Exception, and therefore this stack trace may not indicate any cause of the failure. This simply indicates that when this code ran there wasn't enough heap, not that this code caused the heap to fill up.

** Edits...

Clearly the server is out of memory - at the time of this specific operation. The question is... why? This stack trace doesn't tell you -why- it just indicates that whatever was happening at the time could not complete because there was not enough memory available at that time. This does not mean that it is the cause of the problem.

Sure, you can add more memory but that may not fix the problem - it may only take longer for it to appear.

╭ゆ眷念 2024-11-15 21:21:03

设置catalina.sh/bat
查找设置 JAVA_OPTS=%JAVA_OPTS%
无论你的 RAM 是多少 - 调整但不要提供超过一半的 RAM
设置 JAVA_OPTS=%JAVA_OPTS% %LOGGING_CONFIG% -server -Xms512M -Xmx512M -XX:MaxPermSize=256M

set catalina.sh/bat
find set JAVA_OPTS=%JAVA_OPTS%
what ever your RAM - adjust but don't give above half of RAM
set JAVA_OPTS=%JAVA_OPTS% %LOGGING_CONFIG% -server -Xms512M -Xmx512M -XX:MaxPermSize=256M

铁憨憨 2024-11-15 21:21:03

这意味着 JVM 已用完分配给它的所有内存。您可以使用 -Xms 和 -Xmx 命令行参数更改分配给 JVM 使用的内存量。检查 根本原因在这里

Java中的OutOfMemoryError是java.lang.VirtualMachineError的子类,当JVM在堆中内存不足时抛出java.lang.OutOfMemoryError。 Java 中的 OutOfMemoryError 可能会在堆中随时出现,主要是当您尝试创建对象并且堆中没有足够的空间来分配该对象时

It means that the JVM has run out of all the memory that has been allocated to it. You can change the amount of memory allocated for use by your JVM using the -Xms and -Xmx command line parameters.check the root cause here

OutOfMemoryError in Java is a subclass of java.lang.VirtualMachineError and JVM throws java.lang.OutOfMemoryError when it ran out of memory in heap. OutOfMemoryError in Java can come any time in heap mostly while you try to create an object and there is not enough space in heap to allocate that object

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文