我在JBoss EAP 7.0.0中部署WAR时遇到问题。这场战争基于Spring应用程序。
在部署和删除WAR 3或4次后,我收到OutOfMemoryError异常:
17:02:37,643 ERROR [stderr] (Thread-223) Exception in thread "Thread-223" java.lang.OutOfMemoryError: Java heap space
17:02:37,645 ERROR [stderr] (Thread-223) at io.netty.util.internal.PlatformDependent.allocateUninitializedArray(PlatformDependent.java:189)
17:02:37,645 ERROR [stderr] (Thread-223) at io.netty.buffer.PoolArena$HeapArena.newByteArray(PoolArena.java:676)
17:02:37,645 ERROR [stderr] (Thread-223) at io.netty.buffer.PoolArena$HeapArena.newChunk(PoolArena.java:686)
17:02:37,646 ERROR [stderr] (Thread-223) at io.netty.buffer.PoolArena.allocateNormal(PoolArena.java:244)
17:02:37,646 ERROR [stderr] (Thread-223) at io.netty.buffer.PoolArena.allocate(PoolArena.java:226)
17:02:37,646 ERROR [stderr] (Thread-223) at io.netty.buffer.PoolArena.allocate(PoolArena.java:146)
17:02:37,646 ERROR [stderr] (Thread-223) at io.netty.buffer.PooledByteBufAllocator.newHeapBuffer(PooledByteBufAllocator.java:307)
17:02:37,647 ERROR [stderr] (Thread-223) at io.netty.buffer.AbstractByteBufAllocator.heapBuffer(AbstractByteBufAllocator.java:162)
17:02:37,647 ERROR [stderr] (Thread-223) at io.netty.buffer.AbstractByteBufAllocator.heapBuffer(AbstractByteBufAllocator.java:153)
17:02:37,647 ERROR [stderr] (Thread-223) at io.netty.buffer.AbstractByteBufAllocator.ioBuffer(AbstractByteBufAllocator.java:135)
17:02:37,648 ERROR [stderr] (Thread-223) at io.netty.channel.DefaultMaxMessagesRecvByteBufAllocator$MaxMessageHandle.allocate(DefaultMaxMessagesRecvByteBufAllocator.java:80)
17:02:37,648 ERROR [stderr] (Thread-223) at io.netty.channel.nio.AbstractNioByteChannel$NioByteUnsafe.read(AbstractNioByteChannel.java:122)
17:02:37,648 ERROR [stderr] (Thread-223) at io.netty.channel.nio.NioEventLoop.processSelectedKey(NioEventLoop.java:644)
17:02:37,648 ERROR [stderr] (Thread-223) at io.netty.channel.nio.NioEventLoop.processSelectedKeysPlain(NioEventLoop.java:544)
17:02:37,649 ERROR [stderr] (Thread-223) at io.netty.channel.nio.NioEventLoop.processSelectedKeys(NioEventLoop.java:498)
17:02:37,649 ERROR [stderr] (Thread-223) at io.netty.channel.nio.NioEventLoop.run(NioEventLoop.java:458)
17:02:37,649 ERROR [stderr] (Thread-223) at io.netty.util.concurrent.SingleThreadEventExecutor$5.run(SingleThreadEventExecutor.java:858)
17:02:37,649 ERROR [stderr] (Thread-223) at java.lang.Thread.run(Thread.java:748)
17:04:30,709 ERROR [stderr] (MyThread_ViewsDtoGeneration) Exception in thread "MyThread_ViewsDtoGeneration" java.lang.OutOfMemoryError: GC overhead limit exceeded
17:04:30,711 ERROR [stderr] (MyThread_ViewsDtoGeneration) at java.util.Arrays.copyOfRange(Arrays.java:3664)
17:04:30,711 ERROR [stderr] (MyThread_ViewsDtoGeneration) at java.lang.String.<init>(String.java:207)
17:04:30,711 ERROR [stderr] (MyThread_ViewsDtoGeneration) at java.lang.StringBuilder.toString(StringBuilder.java:407)
17:04:30,712 ERROR [stderr] (MyThread_ViewsDtoGeneration) at org.hibernate.dialect.Dialect.applyLocksToSql(Dialect.java:1439)
17:04:30,712 ERROR [stderr] (MyThread_ViewsDtoGeneration) at org.hibernate.loader.plan.exec.query.internal.SelectStatementBuilder.toStatementString(SelectStatementBuilder.java:222)
17:04:30,712 ERROR [stderr] (MyThread_ViewsDtoGeneration) at org.hibernate.loader.plan.exec.internal.AbstractLoadQueryDetails.generate(AbstractLoadQueryDetails.java:183)
17:04:30,712 ERROR [stderr] (MyThread_ViewsDtoGeneration) at org.hibernate.loader.plan.exec.internal.EntityLoadQueryDetails.<init>(EntityLoadQueryDetails.java:90)
17:04:30,712 ERROR [stderr] (MyThread_ViewsDtoGeneration) at org.hibernate.loader.plan.exec.internal.BatchingLoadQueryDetailsFactory.makeEntityLoadQueryDetails(BatchingLoadQueryDetailsFactory.java:61)
...
我使用VisualVM来分析服务器中发生了什么,我意识到每个部署中加载的Classes数量都增加了(没关系)但是当我删除应用程序时它没有减少。
此外,线程数似乎每次增加,但从未减少部署期间创建的相同数量的线程。
我真的不知道发生了什么。我在Tomcat 8.5.24中测试相同的应用程序,我从来没有得到这个错误,这让我觉得错误不在我的应用程序中,但谁知道......
有什么想法吗?谢谢!