google/allocation-instrumenter

Support for JDK 11?

lemire opened this issue · 9 comments

We are getting errors on JDK 11:

WARNING: Failed to instrument class.
java.lang.IllegalArgumentException
	at com.google.monitoring.runtime.instrumentation.asm.ClassReader.<init>(ClassReader.java:160)
	at com.google.monitoring.runtime.instrumentation.asm.ClassReader.<init>(ClassReader.java:143)
	at com.google.monitoring.runtime.instrumentation.AllocationInstrumenter.instrument(AllocationInstrumenter.java:177)
	at com.google.monitoring.runtime.instrumentation.AllocationInstrumenter.instrument(AllocationInstrumenter.java:210)
	at com.google.monitoring.runtime.instrumentation.AllocationInstrumenter.transform(AllocationInstrumenter.java:157)
	at java.instrument/java.lang.instrument.ClassFileTransformer.transform(ClassFileTransformer.java:246)
	at java.instrument/sun.instrument.TransformerManager.transform(TransformerManager.java:188)
	at java.instrument/sun.instrument.InstrumentationImpl.transform(InstrumentationImpl.java:563)
	at java.instrument/sun.instrument.InstrumentationImpl.retransformClasses0(Native Method)
	at java.instrument/sun.instrument.InstrumentationImpl.retransformClasses(InstrumentationImpl.java:167)
	at com.google.monitoring.runtime.instrumentation.AllocationInstrumenter.bootstrap(AllocationInstrumenter.java:141)
	at com.google.monitoring.runtime.instrumentation.AllocationInstrumenter.premain(AllocationInstrumenter.java:117)
	at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
	at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.base/java.lang.reflect.Method.invoke(Method.java:566)
	at com.google.monitoring.runtime.instrumentation.AllocationInstrumenterBootstrap.premain(AllocationInstrumenterBootstrap.java:48)
	at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
	at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.base/java.lang.reflect.Method.invoke(Method.java:566)
	at java.instrument/sun.instrument.InstrumentationImpl.loadClassAndStartAgent(InstrumentationImpl.java:513)
	at java.instrument/sun.instrument.InstrumentationImpl.loadClassAndCallPremain(InstrumentationImpl.java:525)
Oct 21, 2018 6:49:27 PM com.google.monitoring.runtime.instrumentation.AllocationInstrumenter instrument

RoaringBitmap/RoaringBitmap#277 (comment)

Sorry about that. I'll send a patch some time in the next day or so.

Thanks!

cc @richardstartin

This is checked in. LMK if you need anything else.

@jhmanson We depend on this library through our maven build. We don't copy the code from the GitHub repo.

Would be so kind as to issue a new release and push it to the maven repository?

Thanks to @cgdecker , there is now a 3.2.0 in the Maven Repo.

We shall be updating. Thanks for the lib.

I still see this problem (when using java11 or java 14), when I follow the instructions in https://github.com/google/allocation-instrumenter/wiki using the jar from the "Alternatively, you can download the jar here" link, which leads to https://github.com/google/allocation-instrumenter/releases/download/java-allocation-instrumenter-3.0/java-allocation-instrumenter-3.0.jar .

I guess this is because those instructions still point to 3.0, and I need to use >=3.2.0 instead in order to get past this problem?

Is there a prebuilt jar for >=3.2.0? I don't see any under https://github.com/google/allocation-instrumenter/releases . (There is a release 3.3 in there, but it doesn't contain a jar, and I haven't had luck compiling from sources yet)

FWIW you can always download jars that are available in Maven Central yourself, using search.maven.org for example. Here's allocation-instrumenter 3.3.0: https://search.maven.org/artifact/com.google.code.java-allocation-instrumenter/java-allocation-instrumenter/3.3.0/jar (look for Downloads in the upper right).

I've updated the mentioned link. I've also added the indicated JAR to the release page.