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

Tests failed while setting disableShadowRelocate=true #9711

Closed
123liuziming opened this issue Oct 19, 2023 · 1 comment · Fixed by #9715
Closed

Tests failed while setting disableShadowRelocate=true #9711

123liuziming opened this issue Oct 19, 2023 · 1 comment · Fixed by #9715
Labels
bug Something isn't working needs triage New issue that requires triage

Comments

@123liuziming
Copy link
Contributor

Describe the bug

When disableShadowRelocate is true, all tests will fail with the following exception:

'io.opentelemetry.instrumentation.api.instrumenter.InstrumenterBuilder io.opentelemetry.instrumentation.api.instrumenter.Instrumenter.builder(io.opentelemetry.api.OpenTelemetry, java.lang.String, io.opentelemetry.instrumentation.api.instrumenter.SpanNameExtractor)'
java.lang.NoSuchMethodError: 'io.opentelemetry.instrumentation.api.instrumenter.InstrumenterBuilder io.opentelemetry.instrumentation.api.instrumenter.Instrumenter.builder(io.opentelemetry.api.OpenTelemetry, java.lang.String, io.opentelemetry.instrumentation.api.instrumenter.SpanNameExtractor)'
	at io.opentelemetry.instrumentation.testing.TestInstrumenters.<init>(TestInstrumenters.java:40)
	at io.opentelemetry.instrumentation.testing.InstrumentationTestRunner.<init>(InstrumentationTestRunner.java:47)
	at io.opentelemetry.instrumentation.testing.AgentTestRunner.<init>(AgentTestRunner.java:44)
	at io.opentelemetry.instrumentation.testing.AgentTestRunner.<clinit>(AgentTestRunner.java:37)
	at io.opentelemetry.instrumentation.testing.junit.AgentInstrumentationExtension.<init>(AgentInstrumentationExtension.java:35)
	at io.opentelemetry.instrumentation.testing.junit.AgentInstrumentationExtension.create(AgentInstrumentationExtension.java:39)
	at io.opentelemetry.javaagent.instrumentation.spring.webflux.v5_0.server.SpringWebfluxTest.<clinit>(SpringWebfluxTest.java:89)
	at java.base/jdk.internal.misc.Unsafe.ensureClassInitialized0(Native Method)
	at java.base/jdk.internal.misc.Unsafe.ensureClassInitialized(Unsafe.java:1155)
	at java.base/java.lang.reflect.Field.acquireFieldAccessor(Field.java:1132)
	at java.base/java.lang.reflect.Field.getFieldAccessor(Field.java:1113)
	at java.base/java.lang.reflect.Field.get(Field.java:425)
	at java.base/java.util.stream.ForEachOps$ForEachOp$OfRef.accept(ForEachOps.java:183)
	at java.base/java.util.ArrayList.forEach(ArrayList.java:1511)
	at java.base/java.util.stream.SortedOps$RefSortingSink.end(SortedOps.java:395)
	at java.base/java.util.stream.Sink$ChainedReference.end(Sink.java:258)
	at java.base/java.util.stream.AbstractPipeline.copyInto(AbstractPipeline.java:510)
	at java.base/java.util.stream.AbstractPipeline.wrapAndCopyInto(AbstractPipeline.java:499)
	at java.base/java.util.stream.ForEachOps$ForEachOp.evaluateSequential(ForEachOps.java:150)
	at java.base/java.util.stream.ForEachOps$ForEachOp$OfRef.evaluateSequential(ForEachOps.java:173)
	at java.base/java.util.stream.AbstractPipeline.evaluate(AbstractPipeline.java:234)
	at java.base/java.util.stream.ReferencePipeline.forEach(ReferencePipeline.java:596)
	at java.base/java.util.ArrayList.forEach(ArrayList.java:1511)

Steps to reproduce

Set disableShadowRelocate=true and run any test.

Expected behavior

Tests work properly.

Actual behavior

All tests failed.

Javaagent or library instrumentation version

1.32.0.SNAPSHOT(main branch)

Environment

JDK: Amazon Corretto Version 17.05
OS: Window 11

Additional context

When we set disableShadowRelocate=true
1697691854053
Class Instrumenter will not be shaded and turned to be io.opentelemetry.javaagent.shaded.instrumentation.api.instrumenter. Class TestInstrumenters uses Instrumenter in bootstrap classloader like the following picture:

image

So the Instrumenter get the wrong param in builder method, expected type is io.opentelemetry.javaagent.shaded.io.opentelemetry.api.Opentelemetry but actually is io.opentelemetry.api.Opentelemetry.

Is that an expected behavior? Should we tell users in the documentation?

@123liuziming 123liuziming added bug Something isn't working needs triage New issue that requires triage labels Oct 19, 2023
@laurit
Copy link
Contributor

laurit commented Oct 19, 2023

As far as I know none of the maintainers uses this flag. I created a pr that got at least some tests passing.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working needs triage New issue that requires triage
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants