onnxruntime.dll may fail to run in sandboxed processes on Windows
When running onnxruntime.dll in a sandboxed process on Windows, for example, in an Edge or Chrome child utility process, the OS API TraceLoggingRegisterEx fails in //onnxruntime/core/platform/windows/logging/etw_sink.cc. This results in an exception, which can fail fast and then crash the process.
Could we please make ETW tracing build configurable or make this failure non-fatal?
Tagging @ivberg who worked on recent ETW changes.
Thank you, Steve Becker Software Engineer, Microsoft
@ivberg Is there a way for the code to check if ETW is available more gracefully? There seems to be a fairly hard assumption that if _WIN32 is defined that ETW could and should always be enabled.
https://github.com/microsoft/onnxruntime/blob/ac98bcae3788a1ad231c4d104af6af91ab6b2785/onnxruntime/core/session/inference_session.cc#L364-L378
This is interesting. I have not heard of this registration issue with sandboxed processes and ETW but will do some research.
Registration just registers the providers with Windows, but it doesn’t mean they are enabled until someone listens for them. Almost all dlls in Windows do it this way during runtime.
I didn’t add the 2 providers including registration but my dynamic logging code makes it easier for them to be invoked and registered / used.
Can you send a dump (and private symbols) my way in an email link?
We're seeing this error in Edge sandbox process: C:\onnxruntime\onnxruntime\core\platform\windows\logging\etw_sink.cc:162 onnxruntime::logging::EtwRegistrationManager::LazyInitialize ETW registration failed. Logging will be broken: -2147024891
Resolved with PR