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

java.lang.RuntimeException: Class java/util/UUID could not be instrumented #106

Closed
monperrus opened this issue Sep 28, 2021 · 7 comments · Fixed by SpoonLabs/astor#336 or SpoonLabs/astor#337

Comments

@monperrus
Copy link
Collaborator

On Oracle JDK 11, Astor fails with Class java/util/UUID could not be instrumented.

Reference: https://ci.inria.fr/sos/job/astor/1067/

Is there a way to exclude java.* from being instrumented?

Exception in thread "main" java.lang.reflect.InvocationTargetException
	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)
Caused by: java.lang.RuntimeException: Class java/util/UUID could not be instrumented.
	at org.jacoco.agent.rt.internal_b0d6a23.core.runtime.ModifiedSystemClassRuntime.createFor(ModifiedSystemClassRuntime.java:139)
	at org.jacoco.agent.rt.internal_b0d6a23.core.runtime.ModifiedSystemClassRuntime.createFor(ModifiedSystemClassRuntime.java:100)
	at org.jacoco.agent.rt.internal_b0d6a23.PreMain.createRuntime(PreMain.java:55)
	at org.jacoco.agent.rt.internal_b0d6a23.PreMain.premain(PreMain.java:47)
	... 6 more
Caused by: java.lang.NoSuchFieldException: $jacocoAccess
FATAL ERROR in native method: processing of -javaagent failed
	at java.base/java.lang.Class.getField(Class.java:2000)
	at org.jacoco.agent.rt.internal_b0d6a23.core.runtime.ModifiedSystemClassRuntime.createFor(ModifiedSystemClassRuntime.java:137)
	... 9 more
@andre15silva
Copy link
Member

By default we don't include any package in the exclude option.

We only have, by default, an includes pattern that is computed in https://github.com/SpoonLabs/flacoco/blob/609b42ef074ce90f8b47aeff225c2a918dc0d038/src/main/java/fr/spoonlabs/flacoco/core/coverage/framework/TestFrameworkStrategy.java#L88-L101

In the case of astor, there is an option which overrides the includes called packageToInstrument in https://github.com/SpoonLabs/astor/blob/02cf9829e12298fbf9e44fc995631d0dd90e8c2d/src/main/java/fr/inria/astor/core/faultlocalization/flacoco/FlacocoFaultLocalization.java#L111-L119

We can, however, add java.* by default as an excluded package yes.
I have opened a PR which does that (SpoonLabs/astor#336).

I opened it in astor so as not to pollute flacoco's defaults, but if you think we should have it as default for flacoco that's possible too. As it is, the include pattern should be enough if well configured.

@monperrus
Copy link
Collaborator Author

monperrus commented Sep 29, 2021 via email

@monperrus
Copy link
Collaborator Author

The problem is still there, see https://ci.inria.fr/sos/job/astor/1068/display/redirect?page=changes

Is the exclude well propagated?

@monperrus monperrus reopened this Sep 29, 2021
@andre15silva
Copy link
Member

andre15silva commented Oct 3, 2021

Hi @monperrus,

My bad, I didn't read the entire log. It seems to me that the issue isn't in flacoco actually, but with the jacoco agent that runs on astor (for code coverage only). If it where to be in flacoco then we would see that some test had begun, which is not the case.

I would suggest the following:

@monperrus
Copy link
Collaborator Author

Upgrade the version to 0.8.7 here: SpoonLabs/astor@9f02492/pom.xml#L264-L267

What about PRing on Astor also?

@andre15silva
Copy link
Member

Upgrade the version to 0.8.7 here: SpoonLabs/astor@9f02492/pom.xml#L264-L267

What about PRing on Astor also?

WDYM? That PR was on Astor, and has already been merged by Matias today.

@monperrus
Copy link
Collaborator Author

my bad.

this problem seems solved, now we're running into another one, see SpoonLabs/astor#338

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