-
Notifications
You must be signed in to change notification settings - Fork 323
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
slf4j MDC with java.lang.LinkageError, within the transaction created by external plugin and log correlation enabled #2350
Comments
To confirm, you are using the apm-agent-plugin-sdk external plugin mechanism where the agent loads the plugin from the experimental |
Yes, the plugin also use the apm-agent-api to create transaction or span |
I see the same using
|
have you got a simple example of how to create that please, would help enormously |
No simple example now, but the problem can be reproduced easily 1、 create an external plugin,the plugin instrument some api and create a root transaction using apm-agent-api 2、create a simple application using slf4j, and launched with the es apm agent, which load the external plugin above,and also you should enable the log correlation 3、try to invoke the api which instrumented by your external plugin , then you will get the error log. |
I tried 1.28.2 with https://github.com/tobiasstadler/apm-wildfly-remote-ejb-plugin and log correlation is not working for me either. I can see
in the apm logs.
shows up as
in the application logs. |
Maybe the problem is that for internal plugins the @CoderLan0668 Does your external plugin use SLF4J? |
My problem will by fixed by #2369 |
Here's my analysis related to external plugins and our log correlation in general: each What happened to @CoderLan0668 is probably what @tobiasstadler suspects- since the plugin contain slf4j and since What happens to @tobiasstadler is the result of using the wrong class loader in the trace context. I will add a comment to #2369 and a proposed fix that hopefully will fix both issues. As for the issue reported by @wolframhaussig , this seems related to the mechanism added in #2167 - now the ECS logging classes have visibility to the logging framework, but they may also have duplicated visibility to slf4j... |
Also important for all here: as described in the official log4j vulnerability advisory, we released 1.26.1 yesterday, which uses log4j 2.12.3 that contains the required fixes for all known vulnerabilities to date. @CoderLan0668, @tobiasstadler, @wolframhaussig - If you do get the chance to try them out, please provide your feedback. |
@eyalkoren I am already on 1.28.1 so I think your comment does not apply to me |
I tried 1.26.1, but log correlation does not work for me. Infact, I think it never worked for me. But this is due to how class loading works in WildFly, #2369 will solve it for me. |
I think it does apply for you - I don't expect you having this problem in 1.26.1. We will propose a fix once we get to it and then you can try it out and upgrade again.
Just saw that, I guess this answers my last question in #2369 (comment) 🙂 |
@CoderLan0668 you are welcome to try out the proposed fix build. Your feedback would be much appreciated. |
You are right, version 1.26.2 does not produce those errors |
I was facing this issue from two days. Not able to open the jasper report and compile and print |
Using agent 1.27.0, and enable log correlation
Within the transaction created by external plugin, the application will throw java.lang.LinkageError, the stack trace is :
According to the stack trace above, i guess:
1、the transaction was created by elastic apm agent api in external plugin , so the application classloader of the trace context will be IndyPluginClassLoader
2、As the transaction activating, the MdcActivationListener will be called,and it will try to load slf4j MDC class, using IndyPluginClassLoader, but some oher class has already been loaded by ShadedClassLoader, and throw java.lang.LinkageError
The text was updated successfully, but these errors were encountered: