You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@ant.apache.org by bu...@apache.org on 2006/08/14 15:53:47 UTC

DO NOT REPLY [Bug 40249] New: - Out of Memory exceptions are near impossible to find the source of.

DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG�
RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT
<http://issues.apache.org/bugzilla/show_bug.cgi?id=40249>.
ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND�
INSERTED IN THE BUG DATABASE.

http://issues.apache.org/bugzilla/show_bug.cgi?id=40249

           Summary: Out of Memory exceptions are near impossible to find the
                    source of.
           Product: Ant
           Version: 1.6.5
          Platform: Other
        OS/Version: other
            Status: NEW
          Severity: normal
          Priority: P2
         Component: Core
        AssignedTo: dev@ant.apache.org
        ReportedBy: ryan@thebookhauler.com


I had an Out of Memory exception from the replace task (I was trying to do a
replace on a huge file).  I'll log a separate bug that replace can't work on an
aribtrarily large file.

The issue here is that the stack trace I got was removed because when ant
catches an exception, it tries to create new objects which causes more
OutOfMemory exceptions.  When the new OutOfMemoryExceptions are created, the
original exception is lost.

Here's the stack trace that I received when I ran "ant -v <mytarget>":
db-import:
  [replace] Replacing in
C:\projects\bookhauler\trunk\bookhauler\out\data\rsshill_bhProd3.sql: $db.name
--> rsshill_bhDev
Error was: Java heap space
  [antcall] Exiting C:\projects\bookhauler\trunk\bookhauler\build.xml.
C:\projects\bookhauler\trunk\bookhauler\build.xml:481:
java.lang.OutOfMemoryError: Java heap space
        at org.apache.tools.ant.Project.executeSortedTargets(Project.java:1227)
        at
org.apache.tools.ant.helper.SingleCheckExecutor.executeTargets(SingleCheckExecutor.java:37)
        at org.apache.tools.ant.Project.executeTargets(Project.java:1069)
        at org.apache.tools.ant.taskdefs.Ant.execute(Ant.java:382)
        at org.apache.tools.ant.taskdefs.CallTarget.execute(CallTarget.java:107)
        at org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:275)
        at org.apache.tools.ant.Task.perform(Task.java:364)
        at org.apache.tools.ant.Target.execute(Target.java:341)
        at org.apache.tools.ant.Target.performTasks(Target.java:369)
        at org.apache.tools.ant.Project.executeSortedTargets(Project.java:1217)
        at
org.apache.tools.ant.helper.SingleCheckExecutor.executeTargets(SingleCheckExecutor.java:37)
        at org.apache.tools.ant.Project.executeTargets(Project.java:1069)
        at org.apache.tools.ant.taskdefs.Ant.execute(Ant.java:382)
        at org.apache.tools.ant.taskdefs.CallTarget.execute(CallTarget.java:107)
        at org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:275)
        at org.apache.tools.ant.Task.perform(Task.java:364)
        at org.apache.tools.ant.Target.execute(Target.java:341)
        at org.apache.tools.ant.Target.performTasks(Target.java:369)
        at org.apache.tools.ant.Project.executeSortedTargets(Project.java:1217)
        at org.apache.tools.ant.Project.executeTarget(Project.java:1186)
        at
org.apache.tools.ant.helper.DefaultExecutor.executeTargets(DefaultExecutor.java:40)
        at org.apache.tools.ant.Project.executeTargets(Project.java:1069)
        at org.apache.tools.ant.Main.runBuild(Main.java:668)
        at org.apache.tools.ant.Main.startAnt(Main.java:187)
        at org.apache.tools.ant.launch.Launcher.run(Launcher.java:246)
        at org.apache.tools.ant.launch.Launcher.main(Launcher.java:67)
Caused by: java.lang.OutOfMemoryError: Java heap space
--- Nested Exception ---
java.lang.OutOfMemoryError: Java heap space
Found exception java.lang.OutOfMemoryError: Java heap space
  [antcall] Exiting C:\projects\bookhauler\trunk\bookhauler\build.xml.
C:\projects\bookhauler\trunk\bookhauler\build.xml:481:
java.lang.OutOfMemoryError: Java heap space
        at org.apache.tools.ant.Project.executeSortedTargets(Project.java:1227)
        at
org.apache.tools.ant.helper.SingleCheckExecutor.executeTargets(SingleCheckExecutor.java:37)
        at org.apache.tools.ant.Project.executeTargets(Project.java:1069)
        at org.apache.tools.ant.taskdefs.Ant.execute(Ant.java:382)
        at org.apache.tools.ant.taskdefs.CallTarget.execute(CallTarget.java:107)
        at org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:275)
        at org.apache.tools.ant.Task.perform(Task.java:364)
        at org.apache.tools.ant.Target.execute(Target.java:341)
        at org.apache.tools.ant.Target.performTasks(Target.java:369)
        at org.apache.tools.ant.Project.executeSortedTargets(Project.java:1217)
        at
org.apache.tools.ant.helper.SingleCheckExecutor.executeTargets(SingleCheckExecutor.java:37)
        at org.apache.tools.ant.Project.executeTargets(Project.java:1069)
        at org.apache.tools.ant.taskdefs.Ant.execute(Ant.java:382)
        at org.apache.tools.ant.taskdefs.CallTarget.execute(CallTarget.java:107)
        at org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:275)
        at org.apache.tools.ant.Task.perform(Task.java:364)
        at org.apache.tools.ant.Target.execute(Target.java:341)
        at org.apache.tools.ant.Target.performTasks(Target.java:369)
        at org.apache.tools.ant.Project.executeSortedTargets(Project.java:1217)
        at org.apache.tools.ant.Project.executeTarget(Project.java:1186)
        at
org.apache.tools.ant.helper.DefaultExecutor.executeTargets(DefaultExecutor.java:40)
        at org.apache.tools.ant.Project.executeTargets(Project.java:1069)
        at org.apache.tools.ant.Main.runBuild(Main.java:668)
        at org.apache.tools.ant.Main.startAnt(Main.java:187)
        at org.apache.tools.ant.launch.Launcher.run(Launcher.java:246)
        at org.apache.tools.ant.launch.Launcher.main(Launcher.java:67)
Caused by: java.lang.OutOfMemoryError: Java heap space
--- Nested Exception ---
java.lang.OutOfMemoryError: Java heap space
Found exception java.lang.OutOfMemoryError: Java heap space

BUILD FAILED
C:\projects\bookhauler\trunk\bookhauler\build.xml:481:
java.lang.OutOfMemoryError: Java heap space
        at org.apache.tools.ant.Project.executeSortedTargets(Project.java:1227)
        at
org.apache.tools.ant.helper.SingleCheckExecutor.executeTargets(SingleCheckExecutor.java:37)
        at org.apache.tools.ant.Project.executeTargets(Project.java:1069)
        at org.apache.tools.ant.taskdefs.Ant.execute(Ant.java:382)
        at org.apache.tools.ant.taskdefs.CallTarget.execute(CallTarget.java:107)
        at org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:275)
        at org.apache.tools.ant.Task.perform(Task.java:364)
        at org.apache.tools.ant.Target.execute(Target.java:341)
        at org.apache.tools.ant.Target.performTasks(Target.java:369)
        at org.apache.tools.ant.Project.executeSortedTargets(Project.java:1217)
        at
org.apache.tools.ant.helper.SingleCheckExecutor.executeTargets(SingleCheckExecutor.java:37)
        at org.apache.tools.ant.Project.executeTargets(Project.java:1069)
        at org.apache.tools.ant.taskdefs.Ant.execute(Ant.java:382)
        at org.apache.tools.ant.taskdefs.CallTarget.execute(CallTarget.java:107)
        at org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:275)
        at org.apache.tools.ant.Task.perform(Task.java:364)
        at org.apache.tools.ant.Target.execute(Target.java:341)
        at org.apache.tools.ant.Target.performTasks(Target.java:369)
        at org.apache.tools.ant.Project.executeSortedTargets(Project.java:1217)
        at org.apache.tools.ant.Project.executeTarget(Project.java:1186)
        at
org.apache.tools.ant.helper.DefaultExecutor.executeTargets(DefaultExecutor.java:40)
        at org.apache.tools.ant.Project.executeTargets(Project.java:1069)
        at org.apache.tools.ant.Main.runBuild(Main.java:668)
        at org.apache.tools.ant.Main.startAnt(Main.java:187)
        at org.apache.tools.ant.launch.Launcher.run(Launcher.java:246)
        at org.apache.tools.ant.launch.Launcher.main(Launcher.java:67)
Caused by: java.lang.OutOfMemoryError: Java heap space
--- Nested Exception ---
java.lang.OutOfMemoryError: Java heap space

Total time: 18 seconds

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

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


DO NOT REPLY [Bug 40249] - Out of Memory exceptions are near impossible to find the source of.

Posted by bu...@apache.org.
DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG�
RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT
<http://issues.apache.org/bugzilla/show_bug.cgi?id=40249>.
ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND�
INSERTED IN THE BUG DATABASE.

http://issues.apache.org/bugzilla/show_bug.cgi?id=40249





------- Additional Comments From ryan@thebookhauler.com  2006-08-18 13:13 -------
I don't mean to be rude, but it did take me a couple of hours to figure out what
should have been obvious if the stack trace had been correct.

If this is a really difficult bug to fix, then the current status is correct. 
On the other hand, having if it's not, then having exception handling code throw
exceptions that obstruficate the original exception makes ANT a lot harder to
work with.

Perhaps I'm just being difficult - I got burned wasting a lot of time trying to
figure out something that may have been obvious if I was using the right tools,
as Jesse pointed out.  This is my last post on the subject - promise.

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

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


DO NOT REPLY [Bug 40249] - Out of Memory exceptions are near impossible to find the source of.

Posted by bu...@apache.org.
DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG�
RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT
<http://issues.apache.org/bugzilla/show_bug.cgi?id=40249>.
ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND�
INSERTED IN THE BUG DATABASE.

http://issues.apache.org/bugzilla/show_bug.cgi?id=40249


gudnabrsam@yahoo.com changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Severity|normal                      |enhancement




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

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


DO NOT REPLY [Bug 40249] - Out of Memory exceptions are near impossible to find the source of.

Posted by bu...@apache.org.
DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG�
RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT
<http://issues.apache.org/bugzilla/show_bug.cgi?id=40249>.
ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND�
INSERTED IN THE BUG DATABASE.

http://issues.apache.org/bugzilla/show_bug.cgi?id=40249





------- Additional Comments From gudnabrsam@yahoo.com  2006-08-18 13:42 -------
(In reply to comment #5)
> I don't mean to be rude, but it did take me a couple of hours to figure out what
> should have been obvious if the stack trace had been correct.
> 
> If this is a really difficult bug to fix, then the current status is correct. 
> On the other hand, having if it's not, then having exception handling code throw
> exceptions that obstruficate the original exception makes ANT a lot harder to
> work with.
> 
> Perhaps I'm just being difficult - I got burned wasting a lot of time trying to
> figure out something that may have been obvious if I was using the right tools,
> as Jesse pointed out.  This is my last post on the subject - promise.

That's not necessarily the best thing.  If you believe there really IS some way
in which the Ant code could be modified to alleviate some of the difficulties of
coping with such a situation, we would definitely be interested.  I didn't get
that from this bug report until your last comment.  If this is correct, maybe
the OOME is not the important/operative issue and rather the exception
propagation from <antcall> is.  If this is correct I would encourage you to:

a) assemble a small build example that exhibits the problem.
b) open a new bug report, referencing this one, and attaching the example
created in step (a).

br,
Matt

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

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


DO NOT REPLY [Bug 40249] - Out of Memory exceptions are near impossible to find the source of.

Posted by bu...@apache.org.
DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG�
RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT
<http://issues.apache.org/bugzilla/show_bug.cgi?id=40249>.
ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND�
INSERTED IN THE BUG DATABASE.

http://issues.apache.org/bugzilla/show_bug.cgi?id=40249


gudnabrsam@yahoo.com changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEEDINFO                    |RESOLVED
         Resolution|                            |WONTFIX




------- Additional Comments From gudnabrsam@yahoo.com  2006-08-15 13:41 -------
So in this case the cause for the OOME was not "near impossible" to find, as you
found it with some fairly simple debugging steps, right?  ;)  I stand by my
previous characterization of OOMEs in general, however.  Since you submitted the
<replace> bug separately as bug 40250 I will leave this one to its generic
interpretation (OOMEs in general), but don't know what we could really do to
make detecting their causes easier.

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

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


DO NOT REPLY [Bug 40249] - Out of Memory exceptions are near impossible to find the source of.

Posted by bu...@apache.org.
DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG�
RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT
<http://issues.apache.org/bugzilla/show_bug.cgi?id=40249>.
ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND�
INSERTED IN THE BUG DATABASE.

http://issues.apache.org/bugzilla/show_bug.cgi?id=40249


gudnabrsam@yahoo.com changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |NEEDINFO




------- Additional Comments From gudnabrsam@yahoo.com  2006-08-14 14:46 -------
Isn't this true for Java in general?  OOMEs are encountered due to cumulative
effects and the proverbial straw that breaks the camel's back is likely to be a
different culprit from one run to the next.  Do you have an exceptionally large
build?  Are you using custom tasks, etc.?  You can try forking certain things,
e.g. <javac>, <java>, etc.  You can increase the total memory available to your
Ant JVM with -X JVM options...

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

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


DO NOT REPLY [Bug 40249] - Out of Memory exceptions are near impossible to find the source of.

Posted by bu...@apache.org.
DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG�
RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT
<http://issues.apache.org/bugzilla/show_bug.cgi?id=40249>.
ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND�
INSERTED IN THE BUG DATABASE.

http://issues.apache.org/bugzilla/show_bug.cgi?id=40249





------- Additional Comments From stevel@apache.org  2006-08-19 21:43 -------
Hey, its ok to be pissed off with tool that dont work right. Why else would new
ones be written.

Presumably the problem is we cannot create a new BuildException with stack trace.

options
 -catch OOME and handle by printing out current fault, saying set ANT_OPTS to
-XX whatever

 -preallocate an emergency buffer and delete all references to it then force a
system.gc before creating a buildexception.

I've not done the latter on a java app, though it takes me back to some C++
emergency heap management code. Its a dog to test.

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

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


DO NOT REPLY [Bug 40249] - Out of Memory exceptions are near impossible to find the source of.

Posted by bu...@apache.org.
DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG�
RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT
<http://issues.apache.org/bugzilla/show_bug.cgi?id=40249>.
ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND�
INSERTED IN THE BUG DATABASE.

http://issues.apache.org/bugzilla/show_bug.cgi?id=40249





------- Additional Comments From ryan@thebookhauler.com  2006-08-15 13:10 -------
I don't have any custom tasks and my build file is 600 lines long (although all
of the targets that got executed were all within a 140 line block).  I'm using
-Xmx512M (on a machine with only 1GB of physical ram, although plenty of virtual
memory).  

The last line number in the ant version of the stack trace shows the antcall to
the target that had the actual exception.  After using echos to figure out where
the build was really failing, it turns out that it was when I was using the
replace task on an 86 MB file. I was trying to rebuild my development database.
 The only tasks I called before the replace were sql, mkdir, copy, echo and
property. 

I managed to get around this by using -Xmx1024M which is a little rediculous,
but hey - a guy's got deadlines.

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

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


DO NOT REPLY [Bug 40249] - Out of Memory exceptions are near impossible to find the source of.

Posted by bu...@apache.org.
DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG�
RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT
<http://issues.apache.org/bugzilla/show_bug.cgi?id=40249>.
ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND�
INSERTED IN THE BUG DATABASE.

http://issues.apache.org/bugzilla/show_bug.cgi?id=40249





------- Additional Comments From jglick@netbeans.org  2006-08-17 19:50 -------
Google for -XX:+HeapDumpOnOutOfMemoryError and jhat. All will be revealed. :-)

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

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