Community
Participate
Working Groups
This program causes the java VM to crash. It is a minimal example -- if you remove anything in the aspects it works. 1. PROGRAM CODE package test; import org.aspectj.lang.*; import org.aspectj.lang.reflect.*; public class Test3 { public static void main(String[] args) throws Exception { Test3 a = new Test3(); a.foo(-3); } public void foo(int i) { this.x=i; } int x; } aspect Log { pointcut assign(Object newval, Object targ): set(* test..*) && args(newval) && target(targ); before(Object newval, Object targ): assign(newval,targ) { Signature sign = thisJoinPoint.getSignature(); System.out.println(targ.toString() + "." + sign.getName() + ":=" + newval); } /* } // Different error message if you divide into two aspects aspect Tracing { */ pointcut tracedCall(): call(* test..*(..))/* && !within(Tracing)*/ && !within(Log); after() returning (Object o): tracedCall() { // Works if you comment out either of these two lines thisJoinPoint.getSignature(); System.out.println(thisJoinPoint); } } 2. RESULTS ON SOLARIS [erik@oden test] java test.Test3 test.Test3@b8df17.x:=-3 Unexpected Signal : 11 occurred at PC=0xFA415A00 Function=[Unknown.] Library=(N/A) NOTE: We are unable to locate the function name symbol for the error just occurred. Please refer to release documentation for possible reason and solutions. Current Java thread: Dynamic libraries: 0x10000 java 0xff350000 /usr/lib/libthread.so.1 0xff390000 /usr/lib/libdl.so.1 0xff200000 /usr/lib/libc.so.1 0xff330000 /usr/platform/SUNW,Ultra-250/lib/libc_psr.so.1 0xfe000000 /usr/j2se/jre/lib/sparc/client/libjvm.so 0xff2e0000 /usr/lib/libCrun.so.1 0xff1e0000 /usr/lib/libsocket.so.1 0xff100000 /usr/lib/libnsl.so.1 0xff0d0000 /usr/lib/libm.so.1 0xff310000 /usr/lib/libw.so.1 0xff0b0000 /usr/lib/libmp.so.2 0xff080000 /usr/j2se/jre/lib/sparc/native_threads/libhpi.so 0xff050000 /usr/j2se/jre/lib/sparc/libverify.so 0xff020000 /usr/j2se/jre/lib/sparc/libjava.so 0xfe7e0000 /usr/j2se/jre/lib/sparc/libzip.so 0xfe5b0000 /usr/lib/locale/sv_SE/sv_SE.so.2 Local Time = Fri Jan 24 13:38:29 2003 Elapsed Time = 2 # # HotSpot Virtual Machine Error : 11 # Error ID : 4F530E43505002D3 01 # Please report this error at # http://java.sun.com/cgi-bin/bugreport.cgi # # Java VM: Java HotSpot(TM) Client VM (1.4.0-b92 mixed mode) # # An error report file has been saved as hs_err_pid15099.log. # Please refer to the file for further information. # Abort [erik@oden test] [erik@oden test] /usr/j2se.old/bin/java test.Test3 test.Test3@1afa3.x:=-3 Unexpected Signal : 11 occurred at PC=0x85c24 Function name=(N/A) Library=(N/A) NOTE: We are unable to locate the function name symbol for the error just occurred. Please refer to release documentation for possible reason and solutions. Current Java thread: Dynamic libraries: 0x10000 /usr/j2se.old/bin/../bin/sparc/native_threads/java 0xff350000 /usr/lib/libthread.so.1 0xff390000 /usr/lib/libdl.so.1 0xff200000 /usr/lib/libc.so.1 0xff330000 /usr/platform/SUNW,Ultra-250/lib/libc_psr.so.1 0xfe480000 /usr/j2se.old/jre/lib/sparc/client/libjvm.so 0xff2e0000 /usr/lib/libCrun.so.1 0xff1e0000 /usr/lib/libsocket.so.1 0xff100000 /usr/lib/libnsl.so.1 0xff0d0000 /usr/lib/libm.so.1 0xff310000 /usr/lib/libw.so.1 0xff0b0000 /usr/lib/libmp.so.2 0xff080000 /usr/j2se.old/jre/lib/sparc/native_threads/libhpi.so 0xff050000 /usr/j2se.old/jre/lib/sparc/libverify.so 0xfe440000 /usr/j2se.old/jre/lib/sparc/libjava.so 0xff020000 /usr/j2se.old/jre/lib/sparc/libzip.so 0xfe260000 /usr/lib/locale/sv_SE/sv_SE.so.2 Local Time = Fri Jan 24 13:39:20 2003 Elapsed Time = 2 # # HotSpot Virtual Machine Error : 11 # Error ID : 4F530E43505002C4 01 # Please report this error at # http://java.sun.com/cgi-bin/bugreport.cgi # # Java VM: Java HotSpot(TM) Client VM (1.3.1_02-b02 mixed mode) # # An error report file has been saved as hs_err_pid15100.log. # Please refer to the file for further information. # Abort [erik@oden test] 3. RESULTS ON WINDOWS 2000 Results on Windows 2000 (If I have copied it correctly) >java -classpath ..\..\aspectj1.1\lib\aspectjrt.jar;. test.Test3 test.Test3@1a8c4e7.x:=-3 Exception in thread "main" java.lang.NullPointerException at test.Log.ajc$afterReturning$test_Log$30d(Test3.java:37) at test.Test3.main(Test3.java:8) >java -version java version "1.4.1_01" Java(TM) 2 Runtime Environment, Standard Edition (build 1.4.1_01-b01) Java HotSpot(TM) Client VM (build 1.4.1_01-b01, mixed mode) java
This is now fixed in the current cvs tree with a test in bugs/crashes. This was a fascinating bug, and you did an excellent job of reducing it to a minimal test case. The problem had to do with ajc's attempts to optimize away the creation of dynamic JoinPoint objects, which can be very expensive. Your code managed to confuse this optimization and caused it to generate a call to the method ThisJoinPoint.StaticPart.getSignature on an object that was statically typed to ThisJoinPoint. This is illegal bytecode. You should consider reporting this as a bug to SUN. While ajc did generate illegal bytecode here, the correct VM behavior should have been to produce a VerifyError when loading the classes. Neither the Solaris or Windows VM is handling this case at all well. The Solaris VMs behavior is particularly troubling as it causes such a hard crash.