mathworks / OpenTelemetry-MATLAB

MATLAB interface to OpenTelemetry
Apache License 2.0
14 stars 3 forks source link

Invalid mex file on Windows #130

Closed duncanpo closed 3 months ago

duncanpo commented 3 months ago

Since the Windows-2022 GitHub runner image has been updated to 20240610.1.0, we have been running into an invalid mex file error on Windows:

      Error using libmexclass.proxy.gateway
      Invalid MEX-file 'D:\a\OpenTelemetry-Matlab\OpenTelemetry-Matlab\otel_matlab_install\+libmexclass\+proxy\gateway.mexw64': A dynamic link library (DLL) initialization routine
      failed.

      Error in libmexclass.proxy.Proxy (line 37)
                          obj.Identifier = libmexclass.proxy.gateway("Create", options.Name, options.ConstructorArguments);

      Error in opentelemetry.baggage.Baggage (line 41)
                              obj.Proxy = libmexclass.proxy.Proxy("Name", ...

      Error in tbaggage/testSetEntries (line 47)
                  bag = opentelemetry.baggage.Baggage(dictionary(baggagekeys, baggagevalues));

This error is only on Windows can causes all tests to fail. On Linux and Mac, all tests passed successfully.

The timing of this issue seems similar to this issue reported on runner-images and this issue reported on apache/arrow. In these other issues, the problem is related to a C++ runtime library conflict causing mutex to crash. Mutex is used in various places in opentelemetry-cpp. I suspect we will also need to define _DISABLE_CONSTEXPR_MUTEX_CONSTRUCTOR when building opentelemetry-cpp