简体   繁体   中英

Heap Space issue in Jenkins

In Jenkins, we are getting following error. It shows Out Of Memory Error . I increased heap size from 256 to 1024 but this is still not working. When I increase heap size from 1024 to 2048 then Jenkins service does not work. I made all these changes in Jenkins.xml file.

BUILD FAILED
D:\Jenkins_Build\build_cs\cartridge\build\build.xml:2034: The following error occurred while executing this line:
D:\Jenkins_Build\build_cs\cartridge\build\build.xml:1662: java.lang.OutOfMemoryError: Java heap space
    at java.util.Arrays.copyOf(Unknown Source)
    at java.io.ByteArrayOutputStream.grow(Unknown Source)
    at java.io.ByteArrayOutputStream.ensureCapacity(Unknown Source)
    at java.io.ByteArrayOutputStream.write(Unknown Source)
    at org.apache.commons.httpclient.methods.InputStreamRequestEntity.bufferContent(InputStreamRequestEntity.java:137)
    at org.apache.commons.httpclient.methods.InputStreamRequestEntity.getContentLength(InputStreamRequestEntity.java:187)
    at org.apache.commons.httpclient.methods.EntityEnclosingMethod.getRequestContentLength(EntityEnclosingMethod.java:336)
    at org.apache.commons.httpclient.methods.EntityEnclosingMethod.addContentLengthRequestHeader(EntityEnclosingMethod.java:406)
    at org.apache.commons.httpclient.methods.EntityEnclosingMethod.addRequestHeaders(EntityEnclosingMethod.java:374)
    at org.apache.commons.httpclient.HttpMethodBase.writeRequestHeaders(HttpMethodBase.java:2177)
    at org.apache.commons.httpclient.HttpMethodBase.writeRequest(HttpMethodBase.java:2060)
    at org.apache.commons.httpclient.HttpMethodBase.execute(HttpMethodBase.java:1096)
    at org.apache.commons.httpclient.HttpMethodDirector.executeWithRetry(HttpMethodDirector.java:398)
    at org.apache.commons.httpclient.HttpMethodDirector.executeMethod(HttpMethodDirector.java:171)
    at org.apache.commons.httpclient.HttpClient.executeMethod(HttpClient.java:397)
    at org.apache.commons.httpclient.HttpClient.executeMethod(HttpClient.java:323)
    at com.demandware.deploy.WebDavHelper.doPutAndUnzip(WebDavHelper.java:152)
    at com.demandware.deploy.WebDavHelper.uploadZip(WebDavHelper.java:87)
    at com.demandware.deploy.DeployCartridgesTask.execute(DeployCartridgesTask.java:148)
    at org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:292)
    at sun.reflect.GeneratedMethodAccessor4.invoke(Unknown Source)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
    at java.lang.reflect.Method.invoke(Unknown Source)
    at org.apache.tools.ant.dispatch.DispatchUtils.execute(DispatchUtils.java:106)
    at org.apache.tools.ant.Task.perform(Task.java:348)
    at org.apache.tools.ant.taskdefs.Sequential.execute(Sequential.java:68)
    at net.sf.antcontrib.logic.IfTask.execute(IfTask.java:217)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
    at java.lang.reflect.Method.invoke(Unknown Source)
    at org.apache.tools.ant.dispatch.DispatchUtils.execute(DispatchUtils.java:106)

You perform an ant build. Therefore you must increase the heap of your ant build and not the heap of the jenkins server.

Take a look at How to use the `Java Options` in jenkins ant build tool to set ANT_OPTS

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM