Bug 125358 - Out of Memory Error
Summary: Out of Memory Error
Status: RESOLVED WORKSFORME
Alias: None
Product: AspectJ
Classification: Tools
Component: Compiler (show other bugs)
Version: 1.5.0   Edit
Hardware: PC Windows XP
: P3 normal (vote)
Target Milestone: 1.5.1   Edit
Assignee: aspectj inbox CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2006-01-26 12:07 EST by Jim Fontana CLA
Modified: 2006-07-11 03:58 EDT (History)
0 users

See Also:


Attachments
ajcore file (33.69 KB, text/plain)
2006-01-26 12:19 EST, Jim Fontana CLA
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description Jim Fontana CLA 2006-01-26 12:07:34 EST
Doing bytecode weaving of a large application - get an out of memory error regardless of the max stack size.  But if it is protected with a particular aspect, the weaving succeeds with a 512MB maximum stack size.  The aspect that enables the protection to complete prints various warning messages.
Comment 1 Jim Fontana CLA 2006-01-26 12:10:03 EST
The weaving fails for various combinations of other aspects and only works when the aspect below is woven:

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.Cookie;
import javax.servlet.ServletRequest;

import java.sql.Statement;
import java.sql.ResultSet;

import java.lang.Runtime;
import java.lang.System;

aspect Protect_WeaveReport {
    declare warning:
   		call (public String[] ServletRequest+.getParameterValues(String)):
   		"getParameterValues called";
	
    declare warning:
   		call (public String ServletRequest+.getParameter(String)):
   		"getParameter called";
   		
    declare warning:
		call(public void *.printStackTrace(..)):
		"printStackTrace called";      		
  
	declare warning:
		call (public void *.addCookie(Cookie)):
		"addCookie called";
	   	
   	declare warning:
   		call (public Cookie[] *.getCookies()):
		"getCookies called";
	
 	declare warning:
		call (public ResultSet Statement.executeQuery(String)):
		"executeQuery called";
		
	declare warning:
		call (public int Statement.executeUpdate(String)) || 
   		call (public int Statement.executeUpdate(String, ..)):
   		"executeUpdate called";

    declare warning: 
       	call (public * Runtime.exec(String, ..)) || 
        call (public * Runtime.exec(String[], ..)):
   	    "exec called";
   	        
    declare warning:
        call (public String System.setProperty(String, String)):
        "setProperty called";
   	        
    declare warning:
        call (public * System.load(String)) ||
        call (public * System.loadLibrary(String)) ||
        call (public * Runtime.load(String)) ||
        call (public * Runtime.loadLibrary(String)):
        "load or loadLibrary called";
   	    	
}
Comment 2 Jim Fontana CLA 2006-01-26 12:19:10 EST
Created attachment 33657 [details]
ajcore file
Comment 3 Jim Fontana CLA 2006-01-26 12:28:48 EST
Am running the weaving programatically - using the bareMain entry point.
Comment 4 Andrew Clement CLA 2006-02-16 04:09:40 EST
An interesting exception is captured in the ajcore file:

java.lang.NullPointerException
	at org.aspectj.org.eclipse.jdt.internal.compiler.Compiler.handleInternalException(Compiler.java:389)
	at org.aspectj.org.eclipse.jdt.internal.compiler.Compiler.ajc$privMethod$org_aspectj_ajdt_internal_compiler_CompilerAdapter$org_aspectj_org_eclipse_jdt_internal_compiler_Compiler$handleInternalException(Compiler.java:1)
	at org.aspectj.ajdt.internal.compiler.CompilerAdapter.ajc$afterReturning$org_aspectj_ajdt_internal_compiler_CompilerAdapter$2$f9cc9ca0(CompilerAdapter.aj:74)
	at org.aspectj.org.eclipse.jdt.internal.compiler.Compiler.compile(Compiler.java:367)
	at org.aspectj.ajdt.internal.core.builder.AjBuildManager.performCompilation(AjBuildManager.java:811)
	at org.aspectj.ajdt.internal.core.builder.AjBuildManager.doBuild(AjBuildManager.java:230)
	at org.aspectj.ajdt.internal.core.builder.AjBuildManager.batchBuild(AjBuildManager.java:156)
	at org.aspectj.ajdt.ajc.AjdtCommand.doCommand(AjdtCommand.java:112)
	at org.aspectj.ajdt.ajc.AjdtCommand.runCommand(AjdtCommand.java:60)
	at org.aspectj.tools.ajc.Main.run(Main.java:326)
	at org.aspectj.tools.ajc.Main.runMain(Main.java:240)
	at org.aspectj.tools.ajc.Main.bareMain(Main.java:111)
	at com.unisys.security.protect.Protect.protectJAR(Protect.java:858)
	at com.unisys.security.protect.Protect.protectEAR(Protect.java:746)
	at com.unisys.security.protect.Protect.access$6(Protect.java:701)
	at com.unisys.security.protect.Protect$ProtectThread.run(Protect.java:187)

if this were only triggered when the aspect was included - that explains why it goes OOM when the aspect isnt there.  When the exception occurs I guess we crash before we can get OOM.

The problem is that blowing up when handling the exception is causing us to fail to see the original exception that is occurring.  I half wonder if its related to the use of the bareMain entrypoint.  Are you supplying non-null parameters for all the parameters to bareMain?
Comment 5 Andrew Clement CLA 2006-05-22 06:22:46 EDT
are you still having problems with this?
Comment 6 Andrew Clement CLA 2006-07-11 03:58:18 EDT
memory usage was drastically reduced in 1.5.1a  - which will hopefully help this case. please reopen if you still have a problem.