You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tomcat.apache.org by bu...@apache.org on 2010/02/10 23:46:20 UTC

DO NOT REPLY [Bug 48726] New: DeployTask throws OutOfMemoryErrors when deploying large WAR files

https://issues.apache.org/bugzilla/show_bug.cgi?id=48726

           Summary: DeployTask throws OutOfMemoryErrors when deploying
                    large WAR files
           Product: Tomcat 6
           Version: 6.0.24
          Platform: All
        OS/Version: All
            Status: NEW
          Severity: major
          Priority: P2
         Component: Manager application
        AssignedTo: dev@tomcat.apache.org
        ReportedBy: adam@fixflyer.com


Created an attachment (id=24967)
 --> (https://issues.apache.org/bugzilla/attachment.cgi?id=24967)
patch (diffed from org/apache/catalina/ant)

I consistently get OutOfMemory errors when attempting to deploy a 70 mb WAR
file to Tomcat using the Deploy ant task:

java.lang.OutOfMemoryError: Java heap space
        at
org.apache.catalina.ant.AbstractCatalinaTask.execute(AbstractCatalinaTask.java:262)
        at org.apache.catalina.ant.DeployTask.execute(DeployTask.java:201)
        at com.flyer.izpack.webapp.Deploy.run(Deploy.java:68)
        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
com.izforge.izpack.installer.ProcessPanelWorker$ExecutableClass.run(Unknown
Source)
        at
com.izforge.izpack.installer.ProcessPanelWorker$ProcessingJob.run(Unknown
Source)
        at com.izforge.izpack.installer.ProcessPanelWorker.run(Unknown Source)
        at java.lang.Thread.run(Unknown Source)
Caused by: java.lang.OutOfMemoryError: Java heap space
        at java.util.Arrays.copyOf(Unknown Source)
        at java.io.ByteArrayOutputStream.write(Unknown Source)
        at sun.net.www.http.PosterOutputStream.write(Unknown Source)
        at java.io.BufferedOutputStream.write(Unknown Source)
        at
org.apache.catalina.ant.AbstractCatalinaTask.execute(AbstractCatalinaTask.java:215)
        ... 10 more
--- Nested Exception ---
java.lang.OutOfMemoryError: Java heap space
        at java.util.Arrays.copyOf(Unknown Source)
        at java.io.ByteArrayOutputStream.write(Unknown Source)
        at sun.net.www.http.PosterOutputStream.write(Unknown Source)
        at java.io.BufferedOutputStream.write(Unknown Source)
        at
org.apache.catalina.ant.AbstractCatalinaTask.execute(AbstractCatalinaTask.java:215)
        at org.apache.catalina.ant.DeployTask.execute(DeployTask.java:201)
        at com.flyer.izpack.webapp.Deploy.run(Deploy.java:68)
        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
com.izforge.izpack.installer.ProcessPanelWorker$ExecutableClass.run(Unknown
Source)
        at
com.izforge.izpack.installer.ProcessPanelWorker$ProcessingJob.run(Unknown
Source)
        at com.izforge.izpack.installer.ProcessPanelWorker.run(Unknown Source)
        at java.lang.Thread.run(Unknown Source)

I've tracked the issue to the use of java.net.HttpURLConnection without setting
the contentLength (in some cases) and not using 'fixed length streaming mode'
when contentLength is available.

I'm attaching a patch that works for me with the DeployTask. I know that
org.apache.catalina.ant.AbstractCatalinaTask is subclassed by many tasks, but I
haven't tested all of those.

I can probably provide some code to reproduce if needed.

See also: https://issues.apache.org/bugzilla/show_bug.cgi?id=47660

-- 
Configure bugmail: https://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org


DO NOT REPLY [Bug 48726] DeployTask throws OutOfMemoryErrors when deploying large WAR files

Posted by bu...@apache.org.
https://issues.apache.org/bugzilla/show_bug.cgi?id=48726

--- Comment #1 from Mark Thomas <ma...@apache.org> 2010-02-10 23:49:59 UTC ---
Thanks for the patch. I've applied it to trunk and proposed it for 6.0.x

-- 
Configure bugmail: https://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org


DO NOT REPLY [Bug 48726] DeployTask throws OutOfMemoryErrors when deploying large WAR files

Posted by bu...@apache.org.
https://issues.apache.org/bugzilla/show_bug.cgi?id=48726

--- Comment #2 from Sebb <se...@apache.org> 2010-02-11 01:14:02 UTC ---
This may be completely irrelevant in this case, but just in case, the Javadoc
for HttpURLConnection has the following comment:

"When output streaming is enabled, authentication and redirection cannot be
handled automatically."

[This was suggested as a solution for preventing OOM in JMeter file uploads.
Not used it yet, as it would need to be optional.]

-- 
Configure bugmail: https://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org


DO NOT REPLY [Bug 48726] DeployTask throws OutOfMemoryErrors when deploying large WAR files

Posted by bu...@apache.org.
https://issues.apache.org/bugzilla/show_bug.cgi?id=48726

Mark Thomas <ma...@apache.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
         Resolution|                            |FIXED

--- Comment #3 from Mark Thomas <ma...@apache.org> 2010-02-22 21:11:27 UTC ---
This has been fixed in 6.0.x and will be included in 6.0.25 onwards. Thanks
again for the patch.

-- 
Configure bugmail: https://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org