Jenkins run Error: Failed to execute goal org.apache.maven.plugins:maven-surefire-plugin:2.18.1:test (default-test) on Project Lego

Source: Internet
Author: User
Tags xms

Cause: I want to 4,000 data loop request Search interface, check the return value, and then run on Jenkins above the error: Maven-surefire-plugin execution test failed, but run 70 data without error, and the program itself is not wrong, Speculation should be the result of a large amount of data. By checking the information on the Internet, it is to set the JVM parameters of the Surefire plugin.

Jenkins run the following error:

Failed to execute goal org.apache.maven.plugins:maven-surefire-plugin:2.18.1:test (default-test) on project Lego: Execution default-test of goal org.apache.maven.plugins:maven-surefire-plugin:2.18.1:test Failed:the forked VMS Terminated without properly saying goodbye. VM crash or System.exit called?
Workaround: Add the following line to the Maven-surefire-plugin plugin tag in the pom file:
<argLine>-Xmx1024m-XX:MaxPermSize=256m</argLine>
Complete as follows:
<plugin> <groupId>org.apache.maven.plugins</groupId> <artifactid>mav En-surefire-plugin</artifactid> <version>2.18.1</version> <configuratio N> <forkMode>once</forkMode><argline>-dfile.encoding=utf-8-xmx1024m-xx:maxpermsize=256m</argline><suiteXmlFiles> <suiteXmlFile>${resource.dir}${case}/testng.xml</suiteXmlFile>                    </suiteXmlFiles> <testFailureIgnore>true</testFailureIgnore> <properties> <property> <name>usedefaultli                    Steners</name> <value>true</value> </property> </properties> <reportsdirectory>target/surefire-reports</reportsdirect Ory> </configuration> </plugin>

  

When Maven runs a test case, it executes the use case by calling MAVEN's surefire plug-in and fork a child process.

Using the Argline property, you can specify that additional parameters are passed to the forked JVM process, such as memory settings

JVM Parameters:

-xmx1024m JVM Maximum allowable allocated heap memory, on demand

-xx:maxpermsize=256m JVM Maximum allowable allocated non-heap memory, on demand

Java's memory management mechanism:

Heaps (heap) and non-heap (non-heap):

A heap is a run-time data region where all class instances and arrays of memory are allocated. The heap is created when the Java Virtual machine is started. Memory outside the JVM heap is called non-heap memory

The heap is the memory available to the Java code, which is left to the developer, not the heap, which is left to the JVM for its own use,


Heap memory allocation


the initial allocated heap memory of the JVM is specified by-XMS, and the default is the maximum allocated heap memory for 1/64;JVM of physical memory specified by-XMX, which defaults to 1/4 of the physical memory. When the default free heap memory is less than 40%, the JVM will increase the heap until the maximum limit of-xmx;
When free heap memory is greater than 70%, the JVM will reduce the heap until the minimum limit of-XMS. So the server generally sets-xms,-xmx equal to avoid resizing the heap after each GC.
Note: If-XMX is not specified or is small, the application may cause a java.lang.OutOfMemory error, which is from the JVM, not throwable, and cannot be captured with Try...catch.

Non-heap memory allocation


The JVM uses-xx:permsize to set the non-heap memory initial value , which defaults to 1/64 of physical memory, and by XX:maxpermsize Sets the maximum non-heap memory size , which by default is 1/4 of physical memory.

Jenkins run Error: Failed to execute goal org.apache.maven.plugins:maven-surefire-plugin:2.18.1:test (default-test) on Project Lego

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.