Problem using Booster and the play-out agent

73 views
Skip to first unread message

George Kastrinis

unread,
Mar 23, 2015, 9:29:56 AM3/23/15
to tamiflex...@googlegroups.com
I am trying to run the play-out agent on a jar, get the reflection log and then use the booster jar to create a new jar. During those steps I encounter various issues.

-------------------------------------------------------

> java -version
java version "1.7.0_75"
Java(TM) SE Runtime Environment (build 1.7.0_75-b13)
Java HotSpot(TM) 64-Bit Server VM (build 24.75-b04, mixed mode)

>  java -javaagent:poa-2.0.1.jar -jar Reflect.jar
============================================================
TamiFlex Play-Out Agent Version 2.0.1
Loaded properties from /home/gkastrinis/.tamiflex/poa.properties
============================================================
Hey
Excepted exception.
Test30: Expected exception.
Reachable Test31 okay
Exception in thread "Thread-0" de.bodden.tamiflex.normalizer.ClassRenamer$NoHashedNameException: $Proxy
        at de.bodden.tamiflex.normalizer.Hasher$2$1.remapStringConstant(Hasher.java:90)
        at de.bodden.tamiflex.normalizer.RemappingStringConstantAdapter.visitLdcInsn(RemappingStringConstantAdapter.java:32)
        at org.objectweb.asm.ClassReader.accept(Unknown Source)
        at org.objectweb.asm.ClassReader.accept(Unknown Source)
        at de.bodden.tamiflex.normalizer.Hasher.generateHashNumber(Hasher.java:99)
        at de.bodden.tamiflex.playout.ClassDumper.writeClassesToDisk(ClassDumper.java:82)
        at de.bodden.tamiflex.playout.Agent$1.run(Agent.java:122)

If instead I use java 8, it works ok.
>  java8 -version
openjdk version "1.8.0_31"
OpenJDK Runtime Environment (build 1.8.0_31-b13)
OpenJDK 64-Bit Server VM (build 25.31-b07, mixed mode)

>  java8 -javaagent:poa-2.0.1.jar -jar Reflect.jar
============================================================
TamiFlex Play-Out Agent Version 2.0.1
Loaded properties from /home/gkastrinis/.tamiflex/poa.properties
============================================================
Hey
Excepted exception.
Test30: Expected exception.
Reachable Test31 okay

============================================================
TamiFlex Play-Out Agent Version 2.0.1
Found no new log entries.
Log file written to: /home/gkastrinis/tamiflex/out/refl.log
============================================================

-------------------------------------------------------

Then I try to use the results with the booster jar.

>  java8 -jar booster-2.0.1.jar -p cg reflection-log:out/refl.log -cp out -main-class Reflect Reflect
TamiFlex Booster Version 2.0.1
Soot started on Mon Mar 23 15:29:07 EET 2015
Exception in thread "main" java.lang.RuntimeException: Line: 'Class.getDeclaredField;<Test33: java.lang.Object o>;Test33.run;782;isAccessible=false;'
        at soot.Scene.addReflectionTraceClasses(Scene.java:1033)
        at soot.Scene.loadBasicClasses(Scene.java:985)
        at soot.Scene.loadNecessaryClasses(Scene.java:1060)
        at soot.Main.run(Main.java:167)
        at soot.Main.main(Main.java:141)
        at de.bodden.tamiflex.booster.ReflInliner.main(ReflInliner.java:53)
Caused by: java.lang.RuntimeException: Unknown entry kind: Class.getDeclaredField
        at soot.Scene.addReflectionTraceClasses(Scene.java:1030)
        ... 5 more


Am I missing some step in the process? Thanks in advance.

Eric Bodden

unread,
Mar 23, 2015, 11:33:49 AM3/23/15
to tamiflex...@googlegroups.com
Hi George.

> I am trying to run the play-out agent on a jar, get the reflection log and then use the booster jar to create a new jar. During those steps I encounter various issues.
>
> -------------------------------------------------------
>
> > java -version
> java version "1.7.0_75"
> Java(TM) SE Runtime Environment (build 1.7.0_75-b13)
> Java HotSpot(TM) 64-Bit Server VM (build 24.75-b04, mixed mode)
>
> > java -javaagent:poa-2.0.1.jar -jar Reflect.jar
> ============================================================
> TamiFlex Play-Out Agent Version 2.0.1
> Loaded properties from /home/gkastrinis/.tamiflex/poa.properties
> ============================================================
> Hey
> Excepted exception.
> Test30: Expected exception.
> Reachable Test31 okay
> Exception in thread "Thread-0" de.bodden.tamiflex.normalizer.ClassRenamer$NoHashedNameException: $Proxy
> at de.bodden.tamiflex.normalizer.Hasher$2$1.remapStringConstant(Hasher.java:90)
> at de.bodden.tamiflex.normalizer.RemappingStringConstantAdapter.visitLdcInsn(RemappingStringConstantAdapter.java:32)
> at org.objectweb.asm.ClassReader.accept(Unknown Source)
> at org.objectweb.asm.ClassReader.accept(Unknown Source)
> at de.bodden.tamiflex.normalizer.Hasher.generateHashNumber(Hasher.java:99)
> at de.bodden.tamiflex.playout.ClassDumper.writeClassesToDisk(ClassDumper.java:82)
> at de.bodden.tamiflex.playout.Agent$1.run(Agent.java:122)

Hmm, I think this is due to some internal tool limitations. It appears that the Reflect.jar is using some unusual class names during dynamic loading. May I ask what functionality Reflect.jar is executing?

> If instead I use java 8, it works ok.
> > java8 -version
> openjdk version "1.8.0_31"
> OpenJDK Runtime Environment (build 1.8.0_31-b13)
> OpenJDK 64-Bit Server VM (build 25.31-b07, mixed mode)
>
> > java8 -javaagent:poa-2.0.1.jar -jar Reflect.jar
> ============================================================
> TamiFlex Play-Out Agent Version 2.0.1
> Loaded properties from /home/gkastrinis/.tamiflex/poa.properties
> ============================================================
> Hey
> Excepted exception.
> Test30: Expected exception.
> Reachable Test31 okay
>
> ============================================================
> TamiFlex Play-Out Agent Version 2.0.1
> Found no new log entries.
> Log file written to: /home/gkastrinis/tamiflex/out/refl.log
> ============================================================

That is kind of weird.

> -------------------------------------------------------
>
> Then I try to use the results with the booster jar.
>
> > java8 -jar booster-2.0.1.jar -p cg reflection-log:out/refl.log -cp out -main-class Reflect Reflect
> TamiFlex Booster Version 2.0.1
> Soot started on Mon Mar 23 15:29:07 EET 2015
> Exception in thread "main" java.lang.RuntimeException: Line: 'Class.getDeclaredField;<Test33: java.lang.Object o>;Test33.run;782;isAccessible=false;'
> at soot.Scene.addReflectionTraceClasses(Scene.java:1033)
> at soot.Scene.loadBasicClasses(Scene.java:985)
> at soot.Scene.loadNecessaryClasses(Scene.java:1060)
> at soot.Main.run(Main.java:167)
> at soot.Main.main(Main.java:141)
> at de.bodden.tamiflex.booster.ReflInliner.main(ReflInliner.java:53)
> Caused by: java.lang.RuntimeException: Unknown entry kind: Class.getDeclaredField
> at soot.Scene.addReflectionTraceClasses(Scene.java:1030)
> ... 5 more


This is a well-known limitation. The booster can only deal with the following kinds of entries:

• Class.forName
• Class.newInstance
• Constructor.newInstance
• Method.invoke

You can modify the configuration file to have the POA only produce the appropriate entries in the first place.

Cheers,
Eric



signature.asc

George Kastrinis

unread,
Mar 23, 2015, 11:37:58 AM3/23/15
to tamiflex...@googlegroups.com
Hi Eric. I saw your announcement for using github, and I posted this issue there. Should we continue our conversation on github?

George Kastrinis

unread,
Mar 23, 2015, 11:48:00 AM3/23/15
to tamiflex...@googlegroups.com

On Monday, March 23, 2015 at 5:33:49 PM UTC+2, Eric wrote:

Eric Bodden

unread,
Mar 24, 2015, 5:54:38 AM3/24/15
to tamiflex...@googlegroups.com
Hi George.

We can continue the discussion here for now.
Thanks a lot. Would it be possible for you to do a bit of delta-debudding to find out exactly which of those test cases is causing the problem you see? That would be tremendously helpful in debugging this.

Cheers,
Eric
signature.asc

George Kastrinis

unread,
Mar 24, 2015, 8:49:57 AM3/24/15
to tamiflex...@googlegroups.com
Hi Eric.

It turns out that the problem is not caused by a certain Java instruction (I think).

I tried this "emtpy" java file and still the problem persists.

>  rm ~/.tamiflex/poa.properties 

>  cat Reflect.java
public class Reflect
{
  public static void main(String[] ps)
  {
  }
}

>  make delta
mkdir -p ./tmp/build
javac Reflect.java -d ./tmp/build -bootclasspath ../doop/benchmarks/JREs/jre1.7/lib/rt.jar -source 1.7 -target 1.7
jar cvfe Reflect.jar Reflect -C ./tmp/build .
added manifest
adding: Reflect.class(in = 259) (out= 193)(deflated 25%)
rm -rf ./tmp
rm -rf out
java -javaagent:poa-2.0.1.jar -jar Reflect.jar
============================================================
TamiFlex Play-Out Agent Version 2.0.1
Loaded properties from /home/gkastrinis/.tamiflex/poa.properties
============================================================
Exception in thread "Thread-0" de.bodden.tamiflex.normalizer.ClassRenamer$NoHashedNameException: $Proxy
        at de.bodden.tamiflex.normalizer.Hasher$2$1.remapStringConstant(Hasher.java:90)
        at de.bodden.tamiflex.normalizer.RemappingStringConstantAdapter.visitLdcInsn(RemappingStringConstantAdapter.java:32)
        at org.objectweb.asm.ClassReader.accept(Unknown Source)
        at org.objectweb.asm.ClassReader.accept(Unknown Source)
        at de.bodden.tamiflex.normalizer.Hasher.generateHashNumber(Hasher.java:99)
        at de.bodden.tamiflex.playout.ClassDumper.writeClassesToDisk(ClassDumper.java:82)
        at de.bodden.tamiflex.playout.Agent$1.run(Agent.java:122)


As a sidenote, I had already opened an issue at github (https://github.com/secure-software-engineering/tamiflex/issues/1 ). Should I close it?
Reply all
Reply to author
Forward
0 new messages