-
Notifications
You must be signed in to change notification settings - Fork 93
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
NetFX dependency redirections fails in some cases #3714
Comments
Let's make sure we don't release this before a proper fix: This is a very good test example at the moment. |
I think @pjanotti figured it out that this check here is skipping important modules from dependency analysis. The initial tests show that after I removed System.Diagnostics prefix from being skipped the test application successfully bumped Not sure if |
It is based on https://learn.microsoft.com/en-us/dotnet/framework/unmanaged-api/profiling/icorprofilerinfo3-getruntimeinformation-method so unless that is broken it should correctly identify as "desktop" meaning .NET Fx.
I'm not aware of any measurement of that. Anyway, we need to ensure first that we are correct we then can take care of optimizing if that becomes an issue. This should affect start up time and should be done only once per app domain IIRC. |
I think that @pjanotti and @RassK are both correct, and have identified the root cause. It looks like the primary purpose of this Either way I think we need to decouple the concepts of which assemblies should be skipped for instrumentation, and which assemblies should be skipped for binding redirects. I suspect there are multiple assemblies in the current skip list that we want to apply binding redirects to. I am also wondering if we should ever skip an assembly for these binding redirects, because more and more built-in assemblies (or at least assemblies in the current skip list) will potentially be instrumented or use one of the libraries that we need to apply these binding redirects to. The current skip list check might need to be applied after we perform the binding redirects. |
So should we start with a quick fix by removing https://github.com/open-telemetry/opentelemetry-dotnet-instrumentation/blob/main/src/OpenTelemetry.AutoInstrumentation.Native/otel_profiler_constants.h#L48 ? Seems the most crucial thing to do 🤔 |
One more thing, it will be great to have a tests that check if we do not ship (in .netFx folder any library listed/prefixed by https://github.com/open-telemetry/opentelemetry-dotnet-instrumentation/blob/315758d7088eafab96a927dc374ca8f9c7f1c994/src/OpenTelemetry.AutoInstrumentation.Native/otel_profiler_constants.h) |
I don't think that we need the quick fix. I think we can just move the logic for updating the references, before the skip assemblies checks. |
Why I'm towards a quickfix is that S.D.DS v8.0.1 is already out there and we don't have a supporting release. Splunk also has a failing POC in progress because of this bug. For last, even if we manage to reorder loading with some time, there are no tests to cover this issue... I'm not sure how to pinpoint this issue so we prevent it happening again 🤔 Testing seems to need loads of work. |
@RassK I think the hope was that the two things could be really separated: is that too big of a change? For the tests we could potentially read the redirection from a file only in the test (e.g.: have some env var that reads from a file and ignores the map defined at compile time if defined and if not just proceed with the map defined in the header file). This file could point to earlier versions of the redirect but we should only use the ones from the app. That said I think that the tests could be done in separate as a follow-up. |
Seems some cache messed my testing up (by somehow compiling the redirection in). Prob updating my local branch cleared a cache and now the quickfix or making sure System.Diagnostics is not skipped does not work. I also could not get over of the question why IIS and console is different - and seems this is the important question. Location 1: This is fine, if checks work as supposed Location 2: There is another discovered path which does skipping. Even fixing it similar to the Location 1 does not fix it. So back to the question, why IIS and console differ. There is clearly a difference how AppDomain is handled. Console app loads the main module (In my case NetFxConsole.exe) in
However IIS app never performs I can find direct loading of
So my next question is: Where is ModuleLoadFinished for SimpleFrameworkApp module ? |
#3751 is going to fix the issue for some time. Will keep this open to investigate a proper solution. |
What
Runtime dependency redirection mechanism is failing in some cases.
Example affected library: System.Diagnostics.DiagnosticSource
Affected version: OpenTelemetry.AutoInstrumentation v1.8.0 (ships with System.Diagnostics.DiagnosticSource v8.0.0)
App 1 (NetFxConsole):
.NET FX 4.8 Console app (very simple, creates one manual Activity + makes a HttpClient call)
ref: System.Diagnostics.DiagnosticSource v8.0.1
result: works
App 2 (SimpleFrameworkApp):
ASP.NET 4.8 (template)
ref: System.Diagnostics.DiagnosticSource v8.0.1
result:
Could not load file or assembly 'System.Diagnostics.DiagnosticSource, Version=8.0.0.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51' or one of its dependencies. The system cannot find the file specified.
Native logs attached:
otel-dotnet-auto-5888-NetFxConsole-Native.log
otel-dotnet-auto-7856-w3wp-Native.log
The text was updated successfully, but these errors were encountered: