Java 由于内存不足错误,Openshift Wildfly 10会自动重新启动

Java 由于内存不足错误,Openshift Wildfly 10会自动重新启动,java,openshift,wildfly,heap-memory,wildfly-10,Java,Openshift,Wildfly,Heap Memory,Wildfly 10,由于堆空间错误,OpenShit Production应用程序每天都会自动重新启动一次,尽管我还没有在应用程序中配置message broker,但我发现activemq正在尝试创建新线程,并通过日志获取堆空间错误 我们应该显式禁用activemq吗 [31m01:34:12,417 ERROR [org.apache.activemq.artemis.core.client] (Thread-114 (ActiveMQ-remoting-threads-ActiveMQServerImpl::

由于堆空间错误,OpenShit Production应用程序每天都会自动重新启动一次,尽管我还没有在应用程序中配置message broker,但我发现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)

如果你在一个小齿轮上运行,那就是你的问题。WildFly 10本身使用了相当多的内存。你应该在中型或大型齿轮上运行。您还可以尝试更改JVM可用的齿轮上的内存量:

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


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

使用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论坛帖子中阅读更多内容:


您可以在Wildfly openshift盒式磁带项目中查看此问题

总而言之,一些用户在使用此盒带默认设置时遇到内存、性能问题。 这尤其是由于Openshift Wildfly cartridge在默认情况下启用Java EE 7完整配置文件(使用自定义standalone.xml配置文件,而不是默认Wildfly standalone配置中的standalone-Full.xml),由于其局限性,该配置文件在小型设备上无法正常工作

但是很多JavaEE7用户只使用Web概要文件,实际上不需要在他们的应用程序中启用所有JavaEE7完整概要文件规范

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


有关解决方案的详细信息,请参见此部分,其中列出了Java EE 7配置文件之间的差异。

JVM内存不足的地方绝对不是内存泄漏的地方。就在油箱干涸的地方。或者您是否看到在多次重启时重复发生这种情况?根据最近一周的日志,我每天都会发现一次,logI更愿意以某种方式报告这种情况,因为这可能仍然只是一个更大问题的象征,关闭它并忽略它并不能保证稳定性。我已经发现Wildfly 10放在里面很神奇,它是一周前才发布的。我不认为生产已经准备好了。你能再详细说明一下为什么要这样做吗?这是干什么用的?这是什么?