tamiflex icon indicating copy to clipboard operation
tamiflex copied to clipboard

PlayOutAgent fails with OpenJ9 JDK

Open dheeraj135 opened this issue 3 years ago • 0 comments

Hey all, I am trying to use tamiflex poa with OpenJ9 JDK, but poa is crashing. For java version:

$ java -version
openjdk version "1.8.0_282"
OpenJDK Runtime Environment (build 1.8.0_282-8u282-b08-0ubuntu1~20.04-b08)
OpenJDK 64-Bit Server VM (build 25.282-b08, mixed mode)

On running poa, we get:

$ java -javaagent:PATH/poa-trunk.jar
============================================================
TamiFlex Play-Out Agent Version trunk
Loaded properties from PATH/.tamiflex/poa.properties
Transforming class: java/util/LinkedList$ListItr ::: classBeingRedefined: null
Affected Classes: [class java.lang.Class, class java.lang.Class, class java.lang.reflect.Constructor, class java.lang.reflect.Field, class java.lang.reflect.Field, class java.lang.reflect.Method]
Transforming class: java/lang/Class ::: classBeingRedefined: class java.lang.Class
Transformed Class: java/lang/Class
Transforming class: java/lang/Class ::: classBeingRedefined: class java.lang.Class
Transformed Class: java/lang/Class
Transforming class: java/lang/reflect/Constructor ::: classBeingRedefined: class java.lang.reflect.Constructor
Transformed Class: java/lang/reflect/Constructor
Transforming class: java/lang/reflect/Field ::: classBeingRedefined: class java.lang.reflect.Field
Transformed Class: java/lang/reflect/Field
Transforming class: java/lang/reflect/Field ::: classBeingRedefined: class java.lang.reflect.Field
Transformed Class: java/lang/reflect/Field
Transforming class: java/lang/reflect/Method ::: classBeingRedefined: class java.lang.reflect.Method
Transformed Class: java/lang/reflect/Method
============================================================
Usage: java [-options] class [args...]
           (to execute a class)
   or  java [-options] -jar jarfile [args...]
           (to execute a jar file)
where options include:
    -d32          use a 32-bit data model if available
    -d64          use a 64-bit data model if available
    -server       to select the "server" VM
    -zero         to select the "zero" VM
    -dcevm        to select the "dcevm" VM
                  The default VM is server,
                  because you are running on a server-class machine.
    -cp <class search path of directories and zip/jar files>
    -classpath <class search path of directories and zip/jar files>
                  A : separated list of directories, JAR archives,
                  and ZIP archives to search for class files.
    -D<name>=<value>
                  set a system property
    -verbose:[class|gc|jni]
                  enable verbose output
    -version      print product version and exit
    -version:<value>
                  Warning: this feature is deprecated and will be removed
                  in a future release.
                  require the specified version to run
    -showversion  print product version and continue
    -jre-restrict-search | -no-jre-restrict-search
                  Warning: this feature is deprecated and will be removed
                  in a future release.
                  include/exclude user private JREs in the version search
    -? -help      print this help message
    -X            print help on non-standard options
    -ea[:<packagename>...|:<classname>]
    -enableassertions[:<packagename>...|:<classname>]
                  enable assertions with specified granularity
    -da[:<packagename>...|:<classname>]
    -disableassertions[:<packagename>...|:<classname>]
                  disable assertions with specified granularity
    -esa | -enablesystemassertions
                  enable system assertions
    -dsa | -disablesystemassertions
                  disable system assertions
    -agentlib:<libname>[=<options>]
                  load native agent library <libname>, e.g. -agentlib:hprof
                  see also, -agentlib:jdwp=help and -agentlib:hprof=help
    -agentpath:<pathname>[=<options>]
                  load native agent library by full pathname
    -javaagent:<jarpath>[=<options>]
                  load Java programming language agent, see java.lang.instrument
    -splash:<imagepath>
                  show splash screen with specified image
See http://www.oracle.com/technetwork/java/javase/documentation/index.html for more details.
============================================================
TamiFlex Play-Out Agent Version trunk
Found no new log entries.
Dumped no new classes.
Log file written to: PATH/refl.log
============================================================

But for java version:

$ java -version
openjdk version "1.8.0_292"
OpenJDK Runtime Environment (build 1.8.0_292-b10)
Eclipse OpenJ9 VM (build openj9-0.26.0, JRE 1.8.0 Linux amd64-64-Bit Compressed References 20210421_1000 (JIT enabled, AOT enabled)
OpenJ9   - b4cc246d9
OMR      - 162e6f729
JCL      - 2a5e268814 based on jdk8u292-b10)

We get:

$ JAVA_HOME=PATH PATH/java -javaagent:poa-trunk.jar
============================================================
TamiFlex Play-Out Agent Version trunk
Loaded properties from PATH/.tamiflex/poa.properties
WARNING: Cannot dump class com.ibm.jit.JITHelpers
Transforming class: java/util/LinkedList$ListItr ::: classBeingRedefined: null
Transformed Class: java/util/LinkedList$ListItr
Affected Classes: [class java.lang.Class, class java.lang.Class, class java.lang.reflect.Constructor, class java.lang.reflect.Field, class java.lang.reflect.Field, class java.lang.reflect.Method]
Transforming class: java/lang/Class ::: classBeingRedefined: class java.lang.Class
Transformed Class: java/lang/Class
Transforming class: java/lang/Class ::: classBeingRedefined: class java.lang.Class
Transformed Class: java/lang/Class
Transforming class: java/lang/reflect/Constructor ::: classBeingRedefined: class java.lang.reflect.Constructor
Transformed Class: java/lang/reflect/Constructor
Transforming class: java/lang/reflect/Field ::: classBeingRedefined: class java.lang.reflect.Field
Transformed Class: java/lang/reflect/Field
Transforming class: java/lang/reflect/Field ::: classBeingRedefined: class java.lang.reflect.Field
Transformed Class: java/lang/reflect/Field
Transforming class: java/lang/reflect/Method ::: classBeingRedefined: class java.lang.reflect.Method
Transformed Class: java/lang/reflect/Method
Transforming class: java/lang/VerifyError ::: classBeingRedefined: null
Transformed Class: java/lang/VerifyError
Exception in thread "main" Transforming class: java/util/IdentityHashMap ::: classBeingRedefined: null
Transformed Class: java/util/IdentityHashMap
java/lang/reflect/InvocationTargetException
        at sun/reflect/NativeMethodAccessorImpl.invoke0 (NativeMethod:4294967295)
        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 sun/instrument/InstrumentationImpl.loadClassAndStartAgent (InstrumentationImpl.java:401)
        at sun/instrument/InstrumentationImpl.loadClassAndCallPremain (InstrumentationImpl.java:416)
Fatal error: processing of -javaagent failed

Contents of poa.properties file:

dontDumpClasses = false
dontNormalize = false
count = false
useDeclaredTypes = false
verbose = false
#outDir = /tmp/out
#NOTE: out of the following instruments, the "Booster" only supports the first four! 
transformations =\
			de.bodden.tamiflex.playout.transformation.clazz.ClassForNameTransformation \
			de.bodden.tamiflex.playout.transformation.clazz.ClassNewInstanceTransformation \
			de.bodden.tamiflex.playout.transformation.constructor.ConstructorNewInstanceTransformation \
			de.bodden.tamiflex.playout.transformation.method.MethodInvokeTransformation \
			de.bodden.tamiflex.playout.transformation.field.FieldGetTransformation \
			de.bodden.tamiflex.playout.transformation.field.FieldSetTransformation \

As we can see, in the openj9 jdk tamiflex is transforming additional classes. This is probably the source of this crash. I am willing to work on this issue. Any guidance/suggestion on how to approach this would be very helpful.

dheeraj135 avatar May 04 '21 14:05 dheeraj135