opentelemetry-dotnet-instrumentation icon indicating copy to clipboard operation
opentelemetry-dotnet-instrumentation copied to clipboard

Hardcoded name of the output file in the code

Open dszmigielski opened this issue 4 years ago • 7 comments
trafficstars

Describe the bug There is a hardcoded output file name here. It was confirmed that it causes client applications with profiler attached to crash when the .dylib file's name is changed after compilation - see this comment for reference.

To Reproduce Steps to reproduce the behavior:

  1. Install profiler on macOS
  2. Rename .dylib file
  3. Set new name in CORECLR_PROFILER_PATH
  4. Run application
  5. Application crashes

Expected behavior I assume name of the profiler file should not affect how it works, and definitely shouldn't crash client apps.

Screenshots If applicable, add screenshots to help explain your problem.

Runtime environment (please complete the following information):

  • Instrumentation mode: Used files compiled on my machine
  • OS: macOS Catalina Version 10.15.7 (19H524)
  • .NET version: .NET 5

dszmigielski avatar Mar 12 '21 11:03 dszmigielski

Actual behaviour The application crashed with

Unhandled exception. System.OverflowException: Arithmetic operation resulted in an overflow.
at DDVoidMethodType.DDVoidMethodCall()
at Microsoft.DotNet.Cli.Program.Main(String[] args)

pellared avatar Mar 12 '21 11:03 pellared

Mac OS related. @tonyredondo should we tweak this. Can you please advise? :)

macrogreg avatar Apr 21 '21 18:04 macrogreg

Assigning the tracking item to myself to keep current.

macrogreg avatar Apr 21 '21 18:04 macrogreg

I am facing the same issue with 3.1 runtime.

Unhandled exception. System.ArgumentNullException: Value cannot be null. (Parameter 'source') at System.Runtime.InteropServices.Marshal.CopyToManaged[T](IntPtr source, T[] destination, Int32 startIndex, Int32 length) at System.Runtime.InteropServices.Marshal.Copy(IntPtr source, Byte[] destination, Int32 startIndex, Int32 length) at DDVoidMethodType.DDVoidMethodCall() at hellowold.Program.<Main>(String[] args)

piyushbicycle avatar Oct 08 '21 10:10 piyushbicycle

@piyushbicycle fyi we just switched the main branch on the repo so now we are using the previously named poc-otel-sdk, so a lot of changes.

Anyway, this error happens when the build doesn't properly add the Loader assembly as a resource of the native dll. We had fixed by @RassK by downgrading CMake (the version that we were using didn't add the resource correctly).

pjanotti avatar Oct 11 '21 20:10 pjanotti

@pjanotti The bug is still there: https://github.com/open-telemetry/opentelemetry-dotnet-instrumentation/blob/1cb8c5ededad090c78df93dea3980b8626387eb5/src/OpenTelemetry.ClrProfiler.Native/cor_profiler.cpp#L2960 As far as I understand the code the loader assembly is not properly read because OpenTelemetry.ClrProfiler.Native.dylib is hardcoded. It results in assemblySize, pAssemblyArray, symbolsSize, pSymbolsArray not being properly assigned.

pellared avatar Oct 11 '21 21:10 pellared

@pellared How can I make this work on my mac?

piyushbicycle avatar Oct 18 '21 05:10 piyushbicycle

Reference removed in scope of #2216

Kielek avatar Jun 30 '23 10:06 Kielek