-
Notifications
You must be signed in to change notification settings - Fork 336
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
java.lang.OutOfMemoryError: Java heap space when publishing large surefire reports #467
Comments
Have you got an example that can reproduce this? |
I don't think that this is something that any program can prevent: if you feed a too large input into a parser, then at some point the parser will occupy too much memory. The only solution to this problem is to increase the heap size of your Maven step. |
@timja I couldn't get a working minimal example using pipeline {
agent {label "rhel7"}
stages {
stage('Generate surefire report') {
steps {
sh """
mkdir -p target/surefire-reports
echo '<?xml version="1.0" encoding="UTF-8"?>
<testsuite xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="https://maven.apache.org/surefire/maven-surefire-plugin/xsd/surefire-test-report-3.0.xsd" version="3.0" name="junit-oom-test" time="171.077" tests="1" errors="0" skipped="0" failures="0">
<testcase name="runCucumber" classname="junit-oom-test" time="171.075">
<system-out><![CDATA[' > target/surefire-reports/surefire-report.xml
base64 /dev/urandom | head -c 1000000000 >> target/surefire-reports/surefire-report.xml
echo '
]]></system-out>
</testcase>
</testsuite>' >> target/surefire-reports/surefire-report.xml
"""
}
}
}
post {
always {
junit 'target/**/*.xml'
}
}
} @uhafner That depends on the way the parser works. If the parser works in a streaming fashion, it should also be able to deal with large files. I understand, however, that in this case, it is difficult to prevent a OOM, since the report contains one big string in a single XML node ("system-output"). Reducing the amount of logging on our end would help, but this is not always acceptable, unfortunately. |
I was facing this problem due to a very large number of files to find in the workspace, I was able to workaround it by running a shell command to find all my TEST*.xml file and copying them into a single folder and running junit against that. |
related issue enhancement? #478 |
Jenkins and plugins versions report
Environment
What Operating System are you using (both controller, and any agents involved in the problem)?
RHEL 7
Reproduction steps
Expected Results
A successful run with the test results attached
Actual Results
A "successful" run. However, when looking into the console logs, we see this stacktrace:
Anything else?
Note that the pipeline-maven-plugin catches all exceptions and logs these to the console. Therefore, the build reports successful, while in reality, there could be failed tests and the junitPublisher has failed.
The text was updated successfully, but these errors were encountered: