fluent / fluent-package-builder

td-agent (Fluentd) Building and Packaging System
Apache License 2.0
21 stars 23 forks source link

msi: fix slow start issue on Windows #631

Closed kenhys closed 3 months ago

kenhys commented 4 months ago

Until https://github.com/chef/win32-service/pull/85 is merged, use forked version of win32-service.

This fix should be applied to fluent-package not to block starting fluentdwinsvc service on Windows.

See https://github.com/fluent/fluent-package-builder/issues/618

Closes: #630

NOTE: even though just putting the following line does not install forked version of win32-service, so install it explicitly as same as fluentd gem.

  gem "win32-service", github: "fluent-plugins-nursery/win32-service",
  branch: "fluent-package", platforms: [:mingw, :x64_mingw]
kenhys commented 4 months ago

forked version was fetched.


2024-03-07T04:35:47.5844462Z [?25h[?25lUsing win32-service 2.3.2 from https://github.com/fluent-plugins-nursery/win32-s[?25h[?25l
2024-03-07T04:35:47.5845782Z ervice.git (at fix-slow-start-with-ruby3@cfcc200)[?25h[?25l
2024-03-07T04:35:47.5847685Z 
daipom commented 4 months ago

Thanks for this! The branch fix-slow-start-with-ruby3 is being used for fixing the upstream (https://github.com/chef/win32-service/pull/85). Should we make a specific branch or tag for our package?

kenhys commented 4 months ago

The branch fix-slow-start-with-ruby3 is being used for fixing the upstream (https://github.com/chef/win32-service/pull/85). Should we make a specific branch or tag for our package?

fix-slow-start-with-ruby may be removed by default (when that PR was merged), so it is better to create a specific branch.

kenhys commented 4 months ago

Added fluent-package branch and refer it from Gemfile. https://github.com/fluent-plugins-nursery/win32-service/tree/fluent-package

daipom commented 4 months ago

Added fluent-package branch and refer it from Gemfile. https://github.com/fluent-plugins-nursery/win32-service/tree/fluent-package

Thanks!!

kenhys commented 4 months ago

When processing :ruby_gems task, it raises Bundler::GemNotFound: Could not find gem 'win32-service' on Linux. It seems a bit strange... :thinking:

kenhys commented 4 months ago

bundler v2.3.27 contains fix for regression. check it. https://github.com/rubygems/rubygems/releases/tag/bundler-v2.3.27

kenhys commented 3 months ago

win32-service", platforms: [:mingw, :x64_mingw] with install gem from local repo may not work as expected.

with install_gem_from_local_repo

It try to install win32-service on linux.

kenhys commented 3 months ago

got it. It seems that the following context does not work.

source ... do
   gem ... , platforms: [:mingw, :x64_mingw] 
end
kenhys commented 3 months ago

Hmm, not reproducible failure yet about minimum Gemfile.

set -xe

rm -fr /tmp/local_gem_repo
mkdir -p /tmp/local_gem_repo
cp Gemfile Gemfile.lock /tmp/local_gem_repo

cd /tmp/local_gem_repo 
git clone https://github.com/fluent-plugins-nursery/win32-service.git --branch fluent-package
(cd win32-service && \
    rake build && \
    cp pkg/win32-service*.gem /tmp/local_gem_repo)
gem generate_index
TEST=yes bundle _2.3.26_ install
kenhys commented 3 months ago

win32-service gem was built but not installed from local repo.

*** RSpec not available. (sudo) gem install rspec to run unit tests. ***        
^[[80X^[[80C
win32-service 2.3.2 built to pkg/win32-service-2.3.2.gem.^[[23X^[[23C
cd C:/fluent-package-5.0.2/fluent-package/local_gem_repo^[[24X^[[24C
gem generate_index^[[62X^[[62C
^[[80X^[[80C
^[[?25h^[[?25lGenerating Marshal quick index gemspecs for 2 gems^[[?25h^[[?25l^[[Hw^[[25;51H^[[?25h^[[?25l
..^[[78X^[[78C^[[25;3H^[[?25h^[[?25l
Complete^[[72X^[[72C^[[25;9H^[[?25h^[[?25l
Generated Marshal quick index gemspecs: 0.003s^[[34X^[[34C^[[25;47H^[[?25h^[[?25l
Generating specs index^[[58X^[[58C^[[25;23H^[[?25h^[[?25l
Generated specs index: 0.000s^[[51X^[[51C^[[25;30H^[[?25h^[[?25l
Generating latest specs index^[[51X^[[51C^[[25;30H^[[?25h^[[?25l
Generated latest specs index: 0.000s^[[44X^[[44C^[[25;37H^[[?25h^[[?25l
Generating prerelease specs index^[[47X^[[47C^[[25;34H^[[?25h^[[?25l
Generated prerelease specs index: 0.000s^[[40X^[[40C^[[25;41H^[[?25h^[[?25l
Compressing indices^[[61X^[[61C^[[25;20H^[[?25h^[[?25l
^[[80X^[[80C
^[[?25h^[[?25lCompressed indices: 0.003s^[[?25h^[[?25l
^[[80X^[[80C
^[[?25h^[[?25lcd -^[[?25h^[[?25l
cd C:/opt/fluent/share^[[58X^[[58C^[[25;23H^[[?25h^[[?25l
kenhys commented 3 months ago

NOTE: sudo apt install colorized-logs and use ansi2txt < ... to eliminate it.

kenhys commented 3 months ago

checking only end_with?("/lib/win32/windows/functions.rb") is not enough:

 Find.find("c:/opt/fluent/lib/ruby/gems/") do |f|
irb(main):061:1*   if f.end_with?("functions.rb")  then p f; end
irb(main):062:0> end
"c:/opt/fluent/lib/ruby/gems/3.2.0/gems/rexml-3.2.5/lib/rexml/functions.rb"
"c:/opt/fluent/lib/ruby/gems/3.2.0/gems/rexml-3.2.6/lib/rexml/functions.rb"
"c:/opt/fluent/lib/ruby/gems/3.2.0/gems/win32-eventlog-0.6.7/lib/win32/windows/functions.rb"
"c:/opt/fluent/lib/ruby/gems/3.2.0/gems/win32-service-2.3.2/lib/win32/windows/functions.rb"
=> nil
kenhys commented 3 months ago

CI has passed !

daipom commented 3 months ago

Thanks so much!