Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

JavaMOP not working with tradebeans and tradesoap #250

Open
JesperStromblad opened this issue Jan 23, 2018 · 4 comments
Open

JavaMOP not working with tradebeans and tradesoap #250

JesperStromblad opened this issue Jan 23, 2018 · 4 comments

Comments

@JesperStromblad
Copy link

Hi, I am trying to run JavaMOP on Dacapo benchmark. However, I am getting this exception only on two workloads.

Exception initializing client: org.apache.geronimo.kernel.config.LifecycleException: load of org.apache.geronimo.daytrader/daytrader-dacapo/2.2-SNAPSHOT/car failedorg.apache.geronimo.kernel.config.LifecycleException: load of org.apache.geronimo.daytrader/daytrader-dacapo/2.2-SNAPSHOT/car failed
at org.apache.geronimo.kernel.config.SimpleConfigurationManager.loadConfiguration(SimpleConfigurationManager.java:328)
at org.apache.geronimo.kernel.config.SimpleConfigurationManager.loadConfiguration(SimpleConfigurationManager.java:281)
at org.apache.geronimo.kernel.config.SimpleConfigurationManager.loadConfiguration(SimpleConfigurationManager.java:256)
at org.apache.geronimo.kernel.config.KernelConfigurationManager.loadConfiguration(KernelConfigurationManager.java:112)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at org.apache.geronimo.gbean.runtime.ReflectionMethodInvoker.invoke(ReflectionMethodInvoker.java:34)
at org.apache.geronimo.gbean.runtime.GBeanOperation.invoke(GBeanOperation.java:124)
at org.apache.geronimo.gbean.runtime.GBeanInstance.invoke(GBeanInstance.java:832)
at org.apache.geronimo.gbean.runtime.RawInvoker.invoke(RawInvoker.java:57)
at org.apache.geronimo.kernel.basic.RawOperationInvoker.invoke(RawOperationInvoker.java:35)
at org.apache.geronimo.kernel.basic.ProxyMethodInterceptor.intercept(ProxyMethodInterceptor.java:96)
at org.apache.geronimo.kernel.config.EditableConfigurationManager$$EnhancerByCGLIB$$6b66b72e.loadConfiguration()
at org.dacapo.daytrader.DaCapoClientRunner.initialize(DaCapoClientRunner.java:44)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at org.dacapo.daytrader.Launcher.initialize(Launcher.java:77)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at org.dacapo.harness.Tradesoap.prepare(Tradesoap.java:45)
at org.dacapo.harness.Benchmark.run(Benchmark.java:163)
at org.dacapo.harness.TestHarness.runBenchmark(TestHarness.java:199)
at org.dacapo.harness.TestHarness.main(TestHarness.java:152)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at Harness.main(Unknown Source)
Caused by: org.apache.geronimo.kernel.config.InvalidConfigException: Error starting configuration gbean org.apache.geronimo.daytrader/daytrader-dacapo/2.2-SNAPSHOT/car
at org.apache.geronimo.kernel.config.KernelConfigurationManager.load(KernelConfigurationManager.java:181)
at org.apache.geronimo.kernel.config.SimpleConfigurationManager.loadConfiguration(SimpleConfigurationManager.java:313)
... 33 more
Caused by: org.apache.geronimo.gbean.InvalidConfigurationException: Configuration gbean failed to start org.apache.geronimo.daytrader/daytrader-dacapo/2.2-SNAPSHOT/car
reason: Unable to deserialize GBeanState in classloader: [org.apache.geronimo.kernel.config.MultiParentClassLoader id=org.apache.geronimo.daytrader/daytrader-dacapo/2.2-SNAPSHOT/car]
at org.apache.geronimo.kernel.config.KernelConfigurationManager.load(KernelConfigurationManager.java:164)
... 34 more

Instrumentation code is -

aspect BaseAspect {
pointcut notwithin() :
!within(sun..) &&
!within(java..
) &&
!within(javax..) &&
!within(com.sun..
) &&
!within(org.dacapo.harness..) &&
!within(org.apache.commons..
) &&
!within(org.apache.geronimo..) &&
!within(net.sf.cglib..
) &&
!within(mop..) &&
!within(javamoprt..
) &&
!within(rvmonitorrt..) &&
!within(com.runtimeverification..
);
}

public aspect ArrayDeque_NonNullMonitorAspect implements com.runtimeverification.rvmonitor.java.rt.RVMObject {
public ArrayDeque_NonNullMonitorAspect(){
}

    // Declarations for the Lock
  static ReentrantLock ArrayDeque_NonNull_MOPLock = new ReentrantLock();
   static Condition ArrayDeque_NonNull_MOPLock_cond = ArrayDeque_NonNull_MOPLock.newCondition();

   pointcut MOP_CommonPointCut() : !within(com.runtimeverification.rvmonitor.java.rt.RVMObject+) && !adviceexecution() && BaseAspect.notwithin();
    pointcut ArrayDeque_NonNull_insertnull(Object e) : ((call(* ArrayDeque.add*(..)) || call(* ArrayDeque.offer*(..)) || call(* ArrayDeque.push(..))) && args(Object+) && args(e)) && MOP_CommonPoin    tCut();
    before (Object e) : ArrayDeque_NonNull_insertnull(e) {
           ArrayDeque_NonNullRuntimeMonitor.insertnullEvent(e);
     }

}

Thank you.

@jtoman
Copy link

jtoman commented Aug 6, 2018

This is an old bug, but I recently ran into this as well. FWIW, the solution is as follows.

The issue is caused by the fact that the GBeans are serialized by Java's writeObject but the classes do not declare a serialUID. As a result, at runtime the Java runtime computes its own serialUID, which is based off of the non-private members of the class declaration. By adding non-private fields (as I believe your example is doing) the serial UID computed by Java ends up being different than the one stored in the serialized GBean, causing an "InvalidClassException" which eventually causes the error you see.

There are two solutions: do not add any members that can change the UID computed by Java (the exact algorithm can be found here https://docs.oracle.com/javase/6/docs/platform/serialization/spec/class.html#4100) or before any instrumentation compute the default UID according to the current members of the class, insert it into the class definition, and then perform your instrumentation.

@john5f35
Copy link

john5f35 commented Aug 8, 2018

I'm currently maintaining DaCapo, I'm looking into this at the moment.

A few things:

  • we have recently updated the benchmark versions (has not officially released yet, though there is an uncalibrated unofficial release), is this bug still found in the new version of DaCapo (Geronimo v3.0.1)?
  • anyone can help with a unit-test / instructions in reproducing the bug?
  • more clarity on the problem in DaCapo and how to fix this?

@jtoman
Copy link

jtoman commented Aug 16, 2018

Hello @johnjiabinzhang, are you a maintainer of javamop? If not, we should probably have this discussion on in the dacapo issue tracker.

@john5f35
Copy link

Hi @jtoman, I'm not a maintainer of JavaMOP. Let's do it in the DaCapo issue tracker.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants