[JBoss JIRA] Created: (JASSIST-63) The stack map table is not correctly rebuilt for frame type 64-127 and frame type 247.
by Jason Hill (JIRA)
The stack map table is not correctly rebuilt for frame type 64-127 and frame type 247.
--------------------------------------------------------------------------------------
Key: JASSIST-63
URL: http://jira.jboss.com/jira/browse/JASSIST-63
Project: Javassist
Issue Type: Bug
Environment: java jdk1.6.0_05 on windows xp sp2
Reporter: Jason Hill
Assigned To: Shigeru Chiba
I receive the following exception when using javassist to modify the bytecode of an existing class.
javassist.CannotCompileException: by javassist.bytecode.BadBytecode: bad frame_type in StackMapTable
at javassist.CtClassType.modifyConstructors(CtClassType.java:1457)
at javassist.CtClassType.toBytecode(CtClassType.java:1318)
at javassist.CtClass.toBytecode(CtClass.java:1205)
at javassist.bytecode.test.StackMapFrameModificationTest.frameTypeTest(StackMapFrameModificationTest.java:50)
at javassist.bytecode.test.StackMapFrameModificationTest.testFrameType64To127(StackMapFrameModificationTest.java:13)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at junit.framework.TestCase.runTest(TestCase.java:164)
at junit.framework.TestCase.runBare(TestCase.java:130)
at junit.framework.TestResult$1.protect(TestResult.java:106)
at junit.framework.TestResult.runProtected(TestResult.java:124)
at junit.framework.TestResult.run(TestResult.java:109)
at junit.framework.TestCase.run(TestCase.java:120)
at junit.framework.TestSuite.runTest(TestSuite.java:230)
at junit.framework.TestSuite.run(TestSuite.java:225)
at org.eclipse.jdt.internal.junit.runner.junit3.JUnit3TestReference.run(JUnit3TestReference.java:130)
at org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:460)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:673)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:386)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:196)
Caused by: javassist.bytecode.BadBytecode: bad frame_type in StackMapTable
at javassist.bytecode.StackMapTable$Walker.stackMapFrames(StackMapTable.java:200)
at javassist.bytecode.StackMapTable$Walker.parse(StackMapTable.java:179)
at javassist.bytecode.StackMapTable$Shifter.doit(StackMapTable.java:714)
at javassist.bytecode.StackMapTable.shiftPc(StackMapTable.java:693)
at javassist.bytecode.CodeIterator.insertGap0(CodeIterator.java:676)
at javassist.bytecode.CodeIterator.insertGap(CodeIterator.java:636)
at javassist.bytecode.CodeIterator.insertGapCore(CodeIterator.java:467)
at javassist.bytecode.CodeIterator.insert0(CodeIterator.java:370)
at javassist.bytecode.CodeIterator.insertEx(CodeIterator.java:339)
at javassist.CtClassType.insertAuxInitializer(CtClassType.java:1478)
at javassist.CtClassType.modifyConstructors(CtClassType.java:1453)
... 22 more
--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: http://jira.jboss.com/jira/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira
16 years, 2 months
[JBoss JIRA] Created: (JASSIST-61) clone on a member array causes an NPE in MemberResolver when instrumenting
by Yanic Inghelbrecht (JIRA)
clone on a member array causes an NPE in MemberResolver when instrumenting
--------------------------------------------------------------------------
Key: JASSIST-61
URL: http://jira.jboss.com/jira/browse/JASSIST-61
Project: Javassist
Issue Type: Bug
Environment: Javassist 3.7.1 (latest from cvs HEAD)
Eclipse Version: 3.3.1.1, Build id: M20071023-1652 running in the JRE included with JDK1.6.0_03 on winXP and compiler compliance set to 5.0.
Show »
Javassist 3.7.1 (latest from cvs HEAD) Eclipse Version: 3.3.1.1, Build id: M20071023-1652 running in the JRE included with JDK1.6.0_03 on winXP and compiler compliance set to 5.0.
Reporter: Yanic Inghelbrecht
Assigned To: Shigeru Chiba
In the instrumentation of JHotDraw, I encountered an NPE in javassist.compiler.MemberResolver#lookupMethod(...).
When replacing a method call with a trivial block, a null pointer exception occurs in MemberResolver if that method calls clone() on a member array. The method that is being looked up is the clone method.
The simplest testcase to reproduce this bug consists of two classes : Client (to be instrumented) and Main (does the instrumentation).
It produces the following stack trace :
Exception in thread "main" java.lang.ClassNotFoundException: caught an exception while obtaining a class file for test_clone_member_array.Client
at javassist.Loader.findClass(Loader.java:359)
at javassist.Loader.loadClass(Loader.java:311)
at java.lang.ClassLoader.loadClass(Unknown Source)
at test_clone_member_array.Main.main(Main.java:25)
Caused by: java.lang.NullPointerException
at javassist.compiler.MemberResolver.lookupMethod(MemberResolver.java:110)
at javassist.compiler.MemberResolver.lookupMethod(MemberResolver.java:96)
at javassist.compiler.TypeChecker.atMethodCallCore(TypeChecker.java:704)
at javassist.compiler.TypeChecker.atCallExpr(TypeChecker.java:681)
at javassist.compiler.JvstTypeChecker.atCallExpr(JvstTypeChecker.java:156)
at javassist.compiler.ast.CallExpr.accept(CallExpr.java:45)
at javassist.compiler.Javac$1.setReturnType(Javac.java:459)
at javassist.compiler.JvstTypeChecker.atCallExpr(JvstTypeChecker.java:146)
at javassist.compiler.ast.CallExpr.accept(CallExpr.java:45)
at javassist.compiler.TypeChecker.atVariableAssign(TypeChecker.java:248)
at javassist.compiler.TypeChecker.atAssignExpr(TypeChecker.java:217)
at javassist.compiler.ast.AssignExpr.accept(AssignExpr.java:38)
at javassist.compiler.CodeGen.doTypeCheck(CodeGen.java:241)
at javassist.compiler.CodeGen.atStmnt(CodeGen.java:329)
at javassist.compiler.ast.Stmnt.accept(Stmnt.java:49)
at javassist.compiler.CodeGen.atStmnt(CodeGen.java:350)
at javassist.compiler.ast.Stmnt.accept(Stmnt.java:49)
at javassist.compiler.Javac.compileStmnt(Javac.java:568)
at javassist.expr.MethodCall.replace(MethodCall.java:234)
at test_clone_member_array.Main$MyTranslator.edit(Main.java:48)
at javassist.expr.ExprEditor.loopBody(ExprEditor.java:191)
at javassist.expr.ExprEditor.doit(ExprEditor.java:90)
at javassist.CtBehavior.instrument(CtBehavior.java:548)
at test_clone_member_array.Main$MyTranslator.modify(Main.java:40)
at test_clone_member_array.Main$MyTranslator.onLoad(Main.java:35)
at javassist.Loader.findClass(Loader.java:340)
... 3 more
The source code for this testcase :
// ----- file Client.java
package test_clone_member_array;
public class Client {
private Object[] oa;
public void test() throws Exception {
this.oa.clone();
}
}
// ----- file Main.java
package test_clone_member_array;
import javassist.CannotCompileException;
import javassist.ClassPool;
import javassist.CtClass;
import javassist.CtMethod;
import javassist.Loader;
import javassist.NotFoundException;
import javassist.Translator;
import javassist.expr.ExprEditor;
import javassist.expr.MethodCall;
public class Main {
public static void main(String[] args) throws Exception {
ClassPool pool = new ClassPool(true);
Loader cl = new Loader();
try {
cl.addTranslator(pool, new MyTranslator());
} catch (Exception e) {
e.printStackTrace();
return;
}
// load the Client class
Class clientClass=cl.loadClass("test_clone_member_array.Client");
// create an instance
Object client=clientClass.newInstance();
}
static public class MyTranslator extends ExprEditor implements Translator {
public void onLoad(ClassPool pool, String classname) throws NotFoundException, CannotCompileException {
CtClass cc = pool.get(classname);
modify(cc);
}
public void modify(CtClass c) throws CannotCompileException {
for (CtMethod m : c.getMethods()) {
m.instrument(this);
}
}
@Override
public void edit(MethodCall mc) throws CannotCompileException {
// no changes, for simplicity's sake
String block = "{$_=$proceed($$);}";
mc.replace(block);
}
public void start(ClassPool pool) throws NotFoundException, CannotCompileException {
// do nothing
}
}
}
I hope it's an easy fix for you, I did not find a usable workaround.
Thanks in advance.
Best regards,
Yanic
--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: http://jira.jboss.com/jira/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira
16 years, 2 months
[JBoss JIRA] Created: (JASSIST-30) Memory Leak - failure to clean up javassisst instances after EJB3 remote calls
by Grant Quimby (JIRA)
Memory Leak - failure to clean up javassisst instances after EJB3 remote calls
------------------------------------------------------------------------------
Key: JASSIST-30
URL: http://jira.jboss.com/jira/browse/JASSIST-30
Project: Javassist
Issue Type: Bug
Environment: JBoss 4.0.4.GA, Windows Xp
JBoss 4.0.4.GA, LInux (Debian)
JBoss 4.0.4.GA, Solaris
Reporter: Grant Quimby
Assigned To: Shigeru Chiba
Priority: Blocker
Quote from related JIRA issue EJBTHREE-736
PermGen in EJB3 client aplication by remote interface.
The application is as sample as it can be:
-get remote interface of stateless EJB3 (by JNDI)
- ask 1000 times to get a Collection (List) of 10 EntityBeans.
After 255 there is OutOfMemory: PermGen.
JVM options changes nothing (eventualy more PermSpace => longer run).
The reason looks like the Javassist create lazyinitializer classes for every EntityBean retrived from the server.
So: When I debug on server-side, I got before sending Entity to client:
I got:
myEntity[0].id=143534
myEntity[0].flow=<FlowEntity_$$_javassist_7> 13434
...
myEntity[0].user=<UserEntity_$$_javassist_15>...
myEntity[0].stage=<StageEntity_$$_javassist_17>...
And every remote call the class names (name)_$..._javassist_(index) got the same
indexes (7,15,17) on server side (end every entity in returned collections of entities)
But when I debug on client site - after return from remote call - the indexes of
all returned entities are different (Each next increments index).
So after first call I got:
myEntity[0].id=143534
myEntity[0].flow=<FlowEntity_$$_javassist_0>...
...
myEntity[0].user=<UserEntity_$$_javassist_1>...
myEntity[0].stage=<StageEntity_$$_javassist_2>...
...
myEntity[1].id=143534
myEntity[1].flow=<FlowEntity_$$_javassist_3>
...
myEntity[1].user=<UserEntity_$$_javassist_4>...
myEntity[1].stage=<StageEntity_$$_javassist_5>...
...
After secund call:
myEntity[0].id=143534
myEntity[0].flow=<FlowEntity_$$_javassist_6>...
...
myEntity[0].user=<UserEntity_$$_javassist_7>...
myEntity[0].stage=<StageEntity_$$_javassist_8>...
...
myEntity[1].id=143534
myEntity[1].flow=<FlowEntity_$$_javassist_9>
...
myEntity[1].user=<UserEntity_$$_javassist_10>...
myEntity[1].stage=<StageEntity_$$_javassist_11>...
...
And so on... ... and permGen after 260 iterations...
--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: http://jira.jboss.com/jira/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira
16 years, 2 months
[JBoss JIRA] Created: (JASSIST-28) javassist enhancement failed on deserializing hibernate proxies
by Armin Haaf (JIRA)
javassist enhancement failed on deserializing hibernate proxies
---------------------------------------------------------------
Key: JASSIST-28
URL: http://jira.jboss.com/jira/browse/JASSIST-28
Project: Javassist
Issue Type: Bug
Environment: hibernate 3.2.0GA, javassist 3.3, jboss 4.0.4GA
Reporter: Armin Haaf
Assigned To: Shigeru Chiba
on deserializing objects load by hibernate on a jbossas with uninitialized proxies we the following exception on a performance/concurrent testing:
Exception in thread "Thread-7" org.hibernate.HibernateException: Javassist Enhancement failed: de.mueller.wms.base.model.impl.StorageImpl
at org.hibernate.proxy.pojo.javassist.JavassistLazyInitializer.getProxy(JavassistLazyInitializer.java:88)
at org.hibernate.proxy.pojo.javassist.SerializableProxy.readResolve(SerializableProxy.java:54)
at sun.reflect.GeneratedMethodAccessor1.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:585)
at java.io.ObjectStreamClass.invokeReadResolve(ObjectStreamClass.java:1033)
at java.io.ObjectInputStream.readOrdinaryObject(ObjectInputStream.java:1728)
at java.io.ObjectInputStream.readObject0(ObjectInputStream.java:1305)
at java.io.ObjectInputStream.defaultReadFields(ObjectInputStream.java:1908)
at java.io.ObjectInputStream.readSerialData(ObjectInputStream.java:1832)
at java.io.ObjectInputStream.readOrdinaryObject(ObjectInputStream.java:1719)
at java.io.ObjectInputStream.readObject0(ObjectInputStream.java:1305)
at java.io.ObjectInputStream.defaultReadFields(ObjectInputStream.java:1908)
at java.io.ObjectInputStream.readSerialData(ObjectInputStream.java:1832)
at java.io.ObjectInputStream.readOrdinaryObject(ObjectInputStream.java:1719)
at java.io.ObjectInputStream.readObject0(ObjectInputStream.java:1305)
at java.io.ObjectInputStream.readObject(ObjectInputStream.java:348)
at org.jboss.aop.joinpoint.InvocationResponse.readExternal(InvocationResponse.java:122)
at java.io.ObjectInputStream.readExternalData(ObjectInputStream.java:1755)
at java.io.ObjectInputStream.readOrdinaryObject(ObjectInputStream.java:1717)
at java.io.ObjectInputStream.readObject0(ObjectInputStream.java:1305)
at java.io.ObjectInputStream.defaultReadFields(ObjectInputStream.java:1908)
at java.io.ObjectInputStream.readSerialData(ObjectInputStream.java:1832)
at java.io.ObjectInputStream.readOrdinaryObject(ObjectInputStream.java:1719)
at java.io.ObjectInputStream.readObject0(ObjectInputStream.java:1305)
at java.io.ObjectInputStream.readObject(ObjectInputStream.java:348)
at org.jboss.remoting.serialization.impl.java.JavaSerializationManager.receiveObject(JavaSerializationManager.java:128)
at org.jboss.remoting.marshal.serializable.SerializableUnMarshaller.read(SerializableUnMarshaller.java:66)
at org.jboss.remoting.transport.socket.SocketClientInvoker.transport(SocketClientInvoker.java:279)
at org.jboss.remoting.RemoteClientInvoker.invoke(RemoteClientInvoker.java:143)
at org.jboss.remoting.Client.invoke(Client.java:525)
at org.jboss.remoting.Client.invoke(Client.java:488)
at org.jboss.aspects.remoting.InvokeRemoteInterceptor.invoke(InvokeRemoteInterceptor.java:55)
at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
at org.jboss.aspects.tx.ClientTxPropagationInterceptor.invoke(ClientTxPropagationInterceptor.java:61)
at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
at org.jboss.aspects.security.SecurityClientInterceptor.invoke(SecurityClientInterceptor.java:55)
at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
at org.jboss.ejb3.remoting.IsLocalInterceptor.invoke(IsLocalInterceptor.java:65)
at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
at org.jboss.ejb3.stateless.StatelessRemoteProxy.invoke(StatelessRemoteProxy.java:102)
at $Proxy2.executeCommand(Unknown Source)
at de.mueller.wms.base.service.JndiRemoteLookupDelegateImpl$CommandExecutionInvocationHandler.invoke(JndiRemoteLookupDelegateImpl.java:57)
at $Proxy1.changeStock(Unknown Source)
at de.mueller.wms.base.TestJBossPerformance$1.run(TestJBossPerformance.java:58)
Caused by: java.lang.RuntimeException: by java.lang.LinkageError: duplicate class definition: de/mueller/wms/base/model/impl/StorageImpl_$$_javassist_1272
at javassist.util.proxy.ProxyFactory.createClass(ProxyFactory.java:174)
at org.hibernate.proxy.pojo.javassist.JavassistLazyInitializer.getProxy(JavassistLazyInitializer.java:79)
... 44 more
Caused by: javassist.CannotCompileException: by java.lang.LinkageError: duplicate class definition: de/mueller/wms/base/model/impl/StorageImpl_$$_javassist_1272
at javassist.util.proxy.FactoryHelper.toClass(FactoryHelper.java:167)
at javassist.util.proxy.ProxyFactory.createClass(ProxyFactory.java:170)
... 45 more
Caused by: java.lang.LinkageError: duplicate class definition: de/mueller/wms/base/model/impl/StorageImpl_$$_javassist_1272
at java.lang.ClassLoader.defineClass1(Native Method)
at java.lang.ClassLoader.defineClass(ClassLoader.java:620)
at sun.reflect.GeneratedMethodAccessor2.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:585)
at javassist.util.proxy.FactoryHelper.toClass(FactoryHelper.java:159)
... 46 more
The performance is also very bad in comparison with cglib proxies (in our performance test with cglib proxies the test runs 3x faster)
--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: http://jira.jboss.com/jira/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira
16 years, 2 months