-
Notifications
You must be signed in to change notification settings - Fork 327
Attempting System CL when Context CL is null and caching loading failure #718
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
Attempting System CL when Context CL is null and caching loading failure #718
Conversation
|
Seems like that's the case when using the default fork-join pool as that is created by the bootstrap class loader and not by a particular web application, for example. |
|
The way we could fix that is to use the transaction's initiating class loader to look up slf4j. But we should do that in a separate PR. |
Context class loader is either set explicitly or gets the one from the parent thread. It is not related to loading.
If the rationale is to try and resemble the class visibility of the span, why not use the span class loader? Why are we using the context class loader in the first place? |
For example, in an application server environment, there can be multiple applications for a single JVM. We want to lookup the slf4j classes which correspond to the application which is currently being monitored via the span/transaction. When using the common fork-join pool (for example via Using the context class loader is, however, not really the best way to determine the application class loader. That's why we already require the class loader when starting a transaction. In the case of a servlet transaction, that would be set to We should store that class loader in the |
|
Did this fix made it into 1.18? Because I didn't see it in the change logs. (We have the same problem...) |
|
@Lonzak This specific fix was merged long ago. |
|
@eyalkoren Damn I overlooked the year (2019 vs. 2020) This would explain it...Ok then it must be another issue with the same error... |
When trying to use MDC correlation on threads with
nullcontext class loaders (like in the addedtestWithNullContextClassLoadertest), errors are thrown:And the logging correlation doesn't work. Instead, this is an attempt to load the slf4j MDC through the System class loader.
In addition, added a caching for loading errors, so that the MDC will not be attempted to get loaded through a ClassLoader where it already failed.