Bamboo JUnit Parser Error: GC overhead limit exceeded
Asked by Marc Zych:

I'm getting this error when running the JUnit Parser task in Bamboo Cloud:

```
simple 02-Aug-2016 10:50:56 Starting task 'Parse test results' of type 'com.atlassian.bamboo.plugins.testresultparser:task.testresultparser.junit'simple 02-Aug-2016 10:50:56 Parsing test results under /home/bamboo/bamboo-agent-home/xml-data/build-dir/ZOOX-TEST-JOB1...error 02-Aug-2016 10:51:17 Error occurred while running Task 'Parse test results(3)' of type com.atlassian.bamboo.plugins.testresultparser:task.testresultparser.junit.error 02-Aug-2016 10:51:17 java.lang.OutOfMemoryError: GC overhead limit exceedederror 02-Aug-2016 10:51:17 at java.lang.StringCoding$StringEncoder.encode(StringCoding.java:300)error 02-Aug-2016 10:51:17 at java.lang.StringCoding.encode(StringCoding.java:344)error 02-Aug-2016 10:51:17 at java.lang.String.getBytes(String.java:918)error 02-Aug-2016 10:51:17 at java.io.UnixFileSystem.list(Native Method)error 02-Aug-2016 10:51:17 at java.io.File.list(File.java:1122)error 02-Aug-2016 10:51:17 at org.apache.tools.ant.DirectoryScanner.scandir(DirectoryScanner.java:1257)error 02-Aug-2016 10:51:17 at org.apache.tools.ant.DirectoryScanner.scandir(DirectoryScanner.java:1287)error 02-Aug-2016 10:51:17 at org.apache.tools.ant.DirectoryScanner.scandir(DirectoryScanner.java:1287)error 02-Aug-2016 10:51:17 at org.apache.tools.ant.DirectoryScanner.scandir(DirectoryScanner.java:1287)error 02-Aug-2016 10:51:17 at org.apache.tools.ant.DirectoryScanner.scandir(DirectoryScanner.java:1287)error 02-Aug-2016 10:51:17 at org.apache.tools.ant.DirectoryScanner.scandir(DirectoryScanner.java:1287)error 02-Aug-2016 10:51:17 at org.apache.tools.ant.DirectoryScanner.scandir(DirectoryScanner.java:1287)error 02-Aug-2016 10:51:17 at org.apache.tools.ant.DirectoryScanner.scandir(DirectoryScanner.java:1287)error 02-Aug-2016 10:51:17 at org.apache.tools.ant.DirectoryScanner.scandir(DirectoryScanner.java:1287)error 02-Aug-2016 10:51:17 at org.apache.tools.ant.DirectoryScanner.scandir(DirectoryScanner.java:1287)error 02-Aug-2016 10:51:17 at org.apache.tools.ant.DirectoryScanner.scandir(DirectoryScanner.java:1287)error 02-Aug-2016 10:51:17 at org.apache.tools.ant.DirectoryScanner.scandir(DirectoryScanner.java:1287)error 02-Aug-2016 10:51:17 at org.apache.tools.ant.DirectoryScanner.scandir(DirectoryScanner.java:1287)error 02-Aug-2016 10:51:17 at org.apache.tools.ant.DirectoryScanner.scandir(DirectoryScanner.java:1287)error 02-Aug-2016 10:51:17 at org.apache.tools.ant.DirectoryScanner.scandir(DirectoryScanner.java:1287)error 02-Aug-2016 10:51:17 at org.apache.tools.ant.DirectoryScanner.scandir(DirectoryScanner.java:1211)error 02-Aug-2016 10:51:17 at org.apache.tools.ant.DirectoryScanner.checkIncludePatterns(DirectoryScanner.java:1030)error 02-Aug-2016 10:51:17 at org.apache.tools.ant.DirectoryScanner.scan(DirectoryScanner.java:909)error 02-Aug-2016 10:51:17 at org.apache.tools.ant.types.AbstractFileSet.getDirectoryScanner(AbstractFileSet.java:499)error 02-Aug-2016 10:51:17 at com.atlassian.bamboo.utils.FileVisitor.visitAllFilesThatMatchAPattern(FileVisitor.java:108)error 02-Aug-2016 10:51:17 at com.atlassian.bamboo.utils.FileVisitor.visitFilesThatMatch(FileVisitor.java:76)error 02-Aug-2016 10:51:17 at com.atlassian.bamboo.build.test.TestCollationServiceImpl.collateTestResults(TestCollationServiceImpl.java:175)error 02-Aug-2016 10:51:17 at com.atlassian.bamboo.build.test.TestCollationServiceImpl.collateTestResults(TestCollationServiceImpl.java:62)error 02-Aug-2016 10:51:17 at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)error 02-Aug-2016 10:51:17 at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)error 02-Aug-2016 10:51:17 at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)error 02-Aug-2016 10:51:17 at java.lang.reflect.Method.invoke(Method.java:498)
```

It's been working fine for the last several months but I think that my project has gotten big enough that it's triggering memory problems now. There is a single glob ({{\*\*}}) in the directories to search for.


Answers:
author: Krystian Brazulewicz
body: @Marc Zych I think this issue qualifies as a bug in Bamboo. Please create a bug report in our issue tracker (<https://jira.atlassian.com/projects/BAM/issues>)


author: Marcin Oles
body: Hi Marc,

I think this problem can be addressed by narrowing the search scope of JUnit Parser task. If you know anything about the report files and their location, use that knowledge when defining the test results path pattern.

As an example, instead of using \*\*, you may try to use a value similar to this:

```
**/target/group-*/**/surefire-reports/*.xml
```

(In this case we knew that test reports will be stored in "target/group-\<groupName\>/tomcat\<version\>/surefire-reports", so we could specify such path.) Even the following change might improve the situation:

```
**/target/**/*.xml
```

or

```
**/*.xml
```

comments: author: Marc Zych
body: Hi Marcin,

Thank you for the suggestion. However, I wasn't very precise with my statement - I meant to say that the search path contains `**` but isn't exactly `**`. It is something like this:

```
dir/dir/**/test.xml
```

I don't think that I can narrow that down much more.


author: Marc Zych
body: Are there any other workarounds, @Marcin Oles? It'd be really great if I could reenable this task to get rich test reporting!


Tags: cloud