1

即使我没有在我的应用程序中配置消息代理,由于堆空间错误,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

4 回答 4

1

您可以查看有关 Wildfly openshift 墨盒项目未解决问题的评论。

总而言之,一些用户在使用此墨盒默认设置时遇到了内存、性能问题。这尤其是因为 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 配置文件功能并禁用完整配置文件特定的功能,例如消息传递子系统,您可以使此插件在小型设备上正常工作。

另请参阅此其他评论以了解解决方案详细信息以及列出 Java EE 7 配置文件之间差异的此表。

于 2016-07-05T16:12:20.657 回答
0

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

于 2016-02-17T15:47:03.277 回答
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

于 2016-07-05T14:46:37.297 回答
0

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

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

于 2016-03-24T14:55:02.817 回答