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

OpenTelemetry-agent conflicts with skywalking-agent,OpenTelemetry-agent overrode the modification logic of skywalking-agent to bytecode #7594

Closed
oswin886 opened this issue Jan 17, 2023 · 8 comments · Fixed by #7916
Labels
bug Something isn't working

Comments

@oswin886
Copy link

Describe the bug
OpenTelemetry-agent conflicts with skywalking-agent,OpenTelemetry-agent overrode the modification logic of skywalking-agent to bytecode.

Steps to reproduce
Through pre-research, it is found that openTelemetry-agent and skywalking-agent have also enhanced the bytecode of the org.eclipse.jetty.server.HttpChannel file.Therefore, a test application jetty-demo based on jetty9 has been developed here.

  1. Only install skywalking-agent, and then monitor the contents of the bytecode file of org.eclipse.jetty.server.HttpChannel in real time through arthas, as shown in the following figure. -javaagent:D:\data\skywalking-agent\skywalking-agent.jar
    only-skywalking

  2. Only install OpenTelemetry-agent, and then monitor the contents of the bytecode file of org.eclipse.jetty.server.HttpChannel in real time through arthas, as shown in the following figure. -javaagent:D:\data\opentelemetry-javaagent.jar
    only-opentelemetry

  3. Install openTelemetry-agent and skywalking-agent at the same time, and then monitor the contents of the bytecode file of org.eclipse.jetty.server.HttpChannel in real time through arthas, as shown in the following figure. -javaagent:D:\data\skywalking-agent\skywalking-agent.jar -javaagent:D:\data\opentelemetry-javaagent.jar.
    both and before request

4.After the third step is completed, request the /test api and then monitor the contents of the bytecode file of org.eclipse.jetty.server.HttpChannel in real time through arthas, as shown in the following figure.
both and after request

If possible, provide a recipe for reproducing the error.

What did you expect to see?
OpenTelemetry-agent and skywalking-agent do not affect each other.

What did you see instead?
The jetty9.x plugin of skywalking-agent does not work.

What version are you using?
opentelemetry: v1.20.0
skywalking: v8.10.0

Environment
Compiler: JDK 1.8
OS: Windows10
test app: Jetty9

Additional context
other env: idea+maven3.8.6+arthas3.6.2.

Other plugins have similar situations, such as Tomcat9.x, Mysql5.x.

I(@oswin886) have put the test application and tools required for the reproduction in the opentelemetry-new-issue.zip package. In addition, I have communicated with the development engineer of the skywalking community. He(@wu-sheng) suggested that I submit an issue to the opentelemetry community. If you have any questions or other things I need to provide, please feed me or he(@wu-sheng) back as soon as possible.

opentelemetry-new-issue.zip

@oswin886 oswin886 added the bug Something isn't working label Jan 17, 2023
@mateuszrzeszutek
Copy link
Member

Hey @oswin886 ,

In general, we don't recommend or support using other javaagents together with the OTel javaagent. However, we will accept patches that fix these kind of issues (as long as they don't break anything important).

@wu-sheng
Copy link

@mateuszrzeszutek An interested behavior of OTel javaagent is, it seems intentional to retransfer the codes in the runtime, even SkyWalking's agent has done everything after OTel javaagent did in the booting stage.
Do you know any mechanism or setup to control this?

@mateuszrzeszutek
Copy link
Member

I think this might be the code responsible for enabling it:

.with(AgentBuilder.RedefinitionStrategy.RETRANSFORMATION)
.with(new RedefinitionDiscoveryStrategy())

(+ the jar manifest entries)

@trask
Copy link
Member

trask commented Jan 18, 2023

(just linking to related #1534)

@oliver-zhang
Copy link
Contributor

Hey @mateuszrzeszutek ,
When I disable retransformation use the following way
image
My springboot application fail to start , bellow is the error message
image
Is there any other way to deal this problem ?

@laurit
Copy link
Contributor

laurit commented Feb 16, 2023

@oliver-zhang the default value for redefinition strategy is DISABLED which will break the agent. Besides RETRANSFORMATION the other option is REDEFINITION.

laurit added a commit that referenced this issue Mar 1, 2023
Fixes the issue described in
#7887
Hopefully resolves
#7594
We should not use cached `TypeDescription` for currently transformed
class as the cached description will not be the same as newly created
one if the class bytes were transformed. For example if another agent
adds an interface to the class then returning the cached description
that does not have that interface would result in bytebuddy removing
that interface, see
https://github.com/raphw/byte-buddy/blob/665a090c733c37339788cc5a1c441bd47fb77ef0/byte-buddy-dep/src/main/java/net/bytebuddy/dynamic/scaffold/TypeWriter.java#L5012
@oliver-zhang
Copy link
Contributor

oliver-zhang commented Mar 9, 2023

@oswin886 @oliver-zhang @wu-sheng try https://oss.sonatype.org/content/repositories/snapshots/io/opentelemetry/javaagent/opentelemetry-javaagent/1.24.0-SNAPSHOT/opentelemetry-javaagent-1.24.0-20230302.081319-55.jar and let us know whether this fixes the issue you had

Yes, It's fixes

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

Successfully merging a pull request may close this issue.

6 participants