偶尔的OutOfMemoryError:从Gradle运行Arquillian测试时的Java堆空间

时间:2014-07-29 17:17:51

标签: java gradle out-of-memory testng jboss-arquillian

在Mac OS X(Mavericks)上从Gradle运行Arquillian测试时,我经常(但并非总是)得到以下错误(但遗憾的是,只有我设置了Gradle --debug标志)。然后构建挂起:

10:57:34.181 [QUIET] [system.out] 10:57:34.181 [QUIET] [system.out] 10:57:34,180 INFO  [org.jboss.as] (Controller Boot Thread) JBAS015874: JBoss AS 7.1.3.Final "Arges" started in 4178ms - Started 218 of 303 services (85 services are passive or on-demand)
10:57:36.583 [DEBUG] [TestEventLogger] 
10:57:36.583 [DEBUG] [TestEventLogger] Gradle test STARTED
10:57:43.501 [DEBUG] [TestEventLogger] 
10:57:43.502 [DEBUG] [TestEventLogger] Gradle test STANDARD_ERROR
10:57:43.502 [DEBUG] [TestEventLogger]     Exception in thread "management-client-thread 1-1" java.lang.OutOfMemoryError: Java heap space
10:57:43.502 [DEBUG] [TestEventLogger]      at java.util.Arrays.copyOf(Arrays.java:2271)
10:57:43.502 [DEBUG] [TestEventLogger]      at java.io.ByteArrayOutputStream.toByteArray(ByteArrayOutputStream.java:178)
10:57:43.502 [DEBUG] [TestEventLogger]      at org.jboss.as.controller.client.impl.InputStreamEntry$InMemoryEntry.initialize(InputStreamEntry.java:82)
10:57:43.503 [DEBUG] [TestEventLogger]      at org.jboss.as.controller.client.impl.AbstractModelControllerClient$ReadAttachmentInputStreamRequestHandler$1.execute(AbstractModelControllerClient.java:193)
10:57:43.503 [DEBUG] [TestEventLogger]      at org.jboss.as.protocol.mgmt.AbstractMessageHandler$2$1.doExecute(AbstractMessageHandler.java:296)
10:57:43.503 [DEBUG] [TestEventLogger]      at org.jboss.as.protocol.mgmt.AbstractMessageHandler$AsyncTaskRunner.run(AbstractMessageHandler.java:518)
10:57:43.504 [DEBUG] [TestEventLogger]      at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
10:57:43.504 [DEBUG] [TestEventLogger]      at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
10:57:43.504 [DEBUG] [TestEventLogger]      at java.lang.Thread.run(Thread.java:722)
10:57:43.504 [DEBUG] [TestEventLogger]      at org.jboss.threads.JBossThread.run(JBossThread.java:122)

我已经使用我的arquillian.xml文件中的javaVmArguments设置来提高内存。使用1024米内存偶尔计算它,我尝试了2048米和4096米,但无济于事。

<configuration>
   <property name="jbossHome">target/platform-dist/jboss-as-7.1.3.Final</property>
   <property name="serverConfig">standalone-test.xml</property>
   <property name="javaVmArguments">-Xmx2048m -XX:MaxPermSize=256m -Xdebug -Xrunjdwp:server=y,transport=dt_socket,address=8987,suspend=n -Darquillian.testing=true</property>
</configuration>

我甚至为Gradle添加了内存:

echo $GRADLE_OPTS 
-Xms1024m -Xmx2048m -XX:MaxPermSize=512m

有没有其他人遇到这个?是否有其他地方可以添加内存?

感谢。

0 个答案:

没有答案