treasure-data / omnibus-td-agent

td-agent (Fluentd) Packaging Scripts
https://docs.treasuredata.com/articles/td-agent-changelog
Apache License 2.0
82 stars 131 forks source link

Register/Un-register Windows service causes warnings #246

Open ksandrmatveyev opened 4 years ago

ksandrmatveyev commented 4 years ago

Hi, affected version: td-agent 3.7.0 for Windows warning if you try to register/un-register Windows service:

PS C:\Temp\td-agent> fluentd --reg-winsvc i
[DEPRECATION] Struct layout is already defined for class Windows::ServiceStructs::SERVICE_STATUS_PROCESS. Redefinition as in C:/opt/td-agent/embedded/lib/ruby/gems/2.4.0/gems/win32-service-0.8.10/lib/win32/windows/structs.rb:72:in `<class:SERVICE_STATUS_PROCESS>' will be disallowed in ffi-2.0.
PS C:\Temp\td-agent> $LASTEXITCODE
0
PS C:\Temp\td-agent> fluentd --reg-winsvc u
[DEPRECATION] Struct layout is already defined for class Windows::ServiceStructs::SERVICE_STATUS_PROCESS. Redefinition as in C:/opt/td-agent/embedded/lib/ruby/gems/2.4.0/gems/win32-service-0.8.10/lib/win32/windows/structs.rb:72:in `<class:SERVICE_STATUS_PROCESS>' will be disallowed in ffi-2.0.

Tested OS: Windows Server 2016 td-agent version, that is going to be updated: 3.5.0

Is this something that should be handled?

ksandrmatveyev commented 4 years ago

Seems that the old version of win32-service gem is installed alongside with a new version:

PS C:\temp> fluent-gem list | findstr win32-service
win32-service (2.1.5, 0.8.10)
PS C:\temp> fluent-gem list -i win32-service -v 0.8.10
true

I guess this happens because of https://github.com/fluent/fluentd/blob/237b27625f99ad7c0d67d424180fb2afa73ba4fb/fluentd.gemspec#L35

ksandrmatveyev commented 4 years ago

I'm not sure if this a reason of another issue that causes 5 ruby processes instead of 3 in basic scenario with Windows service + default 1 worker.

image

Steps to reproduce:

  1. install td-agent 3.5.0
  2. register Windows service and pass options to it
  3. unregister Windows service
  4. install td-agent 3.7.0
  5. register Windows service and pass options to it

Accepted behavior: 3 ruby processes Current behavior: 5 ruby processes

@cosmo0920 , @repeatedly

repeatedly commented 4 years ago

@cosmo0920 Did you see this problem before? I assume the problem is previous worker exists and supervisor creates new worker.

cosmo0920 commented 4 years ago

I'm investigating on it.

cosmo0920 commented 4 years ago

I'd checked this but I couldn't reproduce this issue...

repeatedly commented 4 years ago

Thanks for the confirmation. So process shutdown failed unexpectedly and it causes this double loading. Hmm...

skupjoe commented 3 years ago

Same issue for me. And this also seems to break the installer msi where it doesn't fully register/unregister the service during install or uninstall.