fluent-plugins-nursery / fluent-plugin-windows-exporter

Fluentd plugin to collect Windows metrics
Apache License 2.0
3 stars 2 forks source link

Investigate missing counter names on RubyInstaller #10

Open fujimotos opened 2 years ago

fujimotos commented 2 years ago

Branched from https://github.com/fluent-plugins-nursery/fluent-plugin-windows-exporter/issues/1#issuecomment-994168635.

fujimotos commented 2 years ago

@daipom's investigation revealed that the root cause was SetDefaultDllDirectories(). If we do not call that function, it works as expected:

We've found the cause. When SetDefaultDllDirectories(LOAD_LIBRARY_SEARCH_DEFAULT_DIRS) is executed, some data cannot be retrieved in both ruby and C++. SetDefaultDllDirectories: https://docs.microsoft.com/ja-jp/windows/win32/api/libloaderapi/nf-libloaderapi-setdefaultdlldirectories

In ruby, this is called by RubyInstaller::Runtime.enable_dll_search_paths in rubygems\defaults\operating_system.rb. (In my machine, the path is C:\Ruby26-x64\lib\ruby\2.6.0\rubygems\defaults\operating_system.rb) Commenting out this fixes this problem in ruby.

In C++, adding SetDefaultDllDirectories(LOAD_LIBRARY_SEARCH_DEFAULT_DIRS); makes the same problem occur.

daipom commented 2 years ago

@fujimotos Thank you for re-summarizing this!

fujimotos commented 2 years ago

@daipom FWIW, I don't think we resolve this issue (at least) in the first release.

It strongly seems to me that it's essentially caused by the way RubyInstaller sets up the execution environment, not by some deficit in our implementation.

But anyway, I created a separate ticket for the issue, mostly because I wanted to make it easier to track our investigtion progress.

fujimotos commented 2 years ago

A possible related issue: https://github.com/oneclick/rubyinstaller2/issues/243

daipom commented 2 years ago

I agree! Thank you!

fujimotos commented 2 years ago

I stated to label any non-critical tickets as longterm. These tickets are not necessary for our first release, so we don't need to work on them at the moment.