由于Out Of Memory错误,Openshift Wildfly 10会自动重启

时间:2016-02-17 07:34:44

标签: java openshift wildfly heap-memory wildfly-10

OpenShit Prouction App由于堆空间错误每天自动重启一次,即使我没有在我的应用程序中配置消息代理,我发现activemq正在尝试通过我的日志创建新线程获取堆空间错误。

我们应该明确禁用activemq吗?

[31m01:34:12,417 ERROR [org.apache.activemq.artemis.core.client] (Thread-114 (ActiveMQ-remoting-threads-ActiveMQServerImpl::serverUUID=54cb8ef9-d17a-11e5-b538-af749189a999-28800659-992791)) AMQ214017: Caught unexpected Throwable: java.lang.OutOfMemoryError: unable to create new native thread
    at java.lang.Thread.start0(Native Method)
    at java.lang.Thread.start(Thread.java:714)
    at java.util.concurrent.ThreadPoolExecutor.addWorker(ThreadPoolExecutor.java:950)
    at java.util.concurrent.ThreadPoolExecutor.execute(ThreadPoolExecutor.java:1357)
    at org.apache.activemq.artemis.utils.OrderedExecutorFactory$OrderedExecutor.execute(OrderedExecutorFactory.java:85)
    at org.apache.activemq.artemis.core.remoting.impl.invm.InVMConnection.write(InVMConnection.java:163)
    at org.apache.activemq.artemis.core.remoting.impl.invm.InVMConnection.write(InVMConnection.java:151)
    at org.apache.activemq.artemis.core.protocol.core.impl.ChannelImpl.send(ChannelImpl.java:259)
    at org.apache.activemq.artemis.core.protocol.core.impl.ChannelImpl.send(ChannelImpl.java:201)
    at org.apache.activemq.artemis.core.protocol.core.ServerSessionPacketHandler.doConfirmAndResponse(ServerSessionPacketHandler.java:579)
    at org.apache.activemq.artemis.core.protocol.core.ServerSessionPacketHandler.access$000(ServerSessionPacketHandler.java:116)
    at org.apache.activemq.artemis.core.protocol.core.ServerSessionPacketHandler$1.done(ServerSessionPacketHandler.java:561)
    at org.apache.activemq.artemis.core.persistence.impl.journal.OperationContextImpl.executeOnCompletion(OperationContextImpl.java:161)
    at org.apache.activemq.artemis.core.persistence.impl.journal.JournalStorageManager.afterCompleteOperations(JournalStorageManager.java:666)
    at org.apache.activemq.artemis.core.protocol.core.ServerSessionPacketHandler.sendResponse(ServerSessionPacketHandler.java:546)
    at org.apache.activemq.artemis.core.protocol.core.ServerSessionPacketHandler.handlePacket(ServerSessionPacketHandler.java:531)
    at org.apache.activemq.artemis.core.protocol.core.impl.ChannelImpl.handlePacket(ChannelImpl.java:567)
    at org.apache.activemq.artemis.core.protocol.core.impl.RemotingConnectionImpl.doBufferReceived(RemotingConnectionImpl.java:349)
    at org.apache.activemq.artemis.core.protocol.core.impl.RemotingConnectionImpl.bufferReceived(RemotingConnectionImpl.java:331)
    at org.apache.activemq.artemis.core.remoting.server.impl.RemotingServiceImpl$DelegatingBufferHandler.bufferReceived(RemotingServiceImpl.java:605)
    at org.apache.activemq.artemis.core.remoting.impl.invm.InVMConnection$1.run(InVMConnection.java:171)
    at org.apache.activemq.artemis.utils.OrderedExecutorFactory$OrderedExecutor$ExecutorTask.run(OrderedExecutorFactory.java:100)
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
    at java.lang.Thread.run(Thread.java:745)

4 个答案:

答案 0 :(得分:1)

你可以看一下Wildfly openhift盒式项目开放问题的这个comment

总而言之,有些用户在使用此盒式磁带默认设置时遇到内存,性能问题。 这尤其是因为Openshift Wildfly盒式磁带默认启用了Java EE 7 Full Profile(使用自定义standalone.xml配置文件,而不是默认的wildfly独立配置中的standalone-full.xml),这在小齿轮由于其局限性。

但是许多Java EE 7用户只使用Web Profile,而不需要在他们的应用程序中实际启用所有Java EE 7 Full Profile规范。

因此,通过仅启用Java EE 7 Web配置文件功能并禁用特定于完整配置文件的功能(例如消息传递子系统),您可以使这个盒式磁带在小型设备上正常工作。

另请参阅此other comment以获取解决方案详细信息,此table列出了Java EE 7配置文件之间的差异。

答案 1 :(得分:0)

如果你是在一个小装备上运行,那就是你的问题。 WildFly 10本身就使用了相当多的内存。你应该在中型或大型装备上运行它。您还可以尝试更改JVM可用设备的内存量:https://developers.openshift.com/en/wildfly-jvm-memory.html

答案 2 :(得分:0)

尝试添加-Dactivemq.artemis.client.global.thread.pool.max.size=20

Artemis客户端使用的默认全局线程池为500,但小型齿轮的线程限制为250个线程。当我在我的Linux机器上启动8个Wildfly实例时,我遇到了类似的问题,每个用户有4096个线程。第二天总有java.lang.OutOfMemoryError:无法创建新的本机线程。我观察到artemis不断创造新的线程,直到它达到500.

答案 3 :(得分:0)

使用standalone-full.xml配置运行Wildfly时,您已启用JMS子系统。 Wildfly 10.0.0.Final有一个默认的Artemis线程池,初始化为500个线程。在将来的版本中,它将使用自定义线程池进行更改。 使用Wildfly 10.0.0.Final,对Artemis说简单的方法初始化少量线程(正如Andrsej Szywala所说)在启动时使用命令行参数,如下所示:

sh standalone.sh -c standalone-full-ha.xml -Dactivemq.artemis.client.global.thread.pool.max.size=30  

您可以在jboss论坛的帖子中阅读更多内容:

https://developer.jboss.org/thread/268397