fluentd 1.15.1 → 1.15.2

Sign up to get free protection for your applications and to get access to all the features.

Potentially problematic release.


This version of fluentd might be problematic. Click here for more details.

checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 767485d0b4b0b514e2bf2e26817b54b53e33d44fafd47ba8d86ce195ef274986
4
- data.tar.gz: 525aa18805c114a792655dcd13ede2ed4c9370177d42efd8d33e8c9d1cce7d17
3
+ metadata.gz: af4e72332c4c1128c66e129579a50d0edd10b2bbeae16d805ed57f13cf425ae2
4
+ data.tar.gz: de907aa30f8d0352a871b8fb6cc938ffdffef7012910dbb99cc3986b69b6929e
5
5
  SHA512:
6
- metadata.gz: 7c6fe1fd468386c622ba02031e8dc24fe1d3d14666ae2bf195e3f34576cc0cbd50fa9e81519e747e101fcf2450cd51288b9e1b221df09dcb1fc7d7a5614b28ec
7
- data.tar.gz: 7d17bb661cb80b6fcaf0348b0b5883ebc3a70b7c2a087091f586d7e83fe5b5805c18b785510a1689a81e17d20187126b53890e33c80ccc9addb26374befc5c0b
6
+ metadata.gz: 908bc3de0f3d959d520e91cd62e6191f9b16c333769b8d1965fd7d0a8bdb585ad203d86fd5061b5d0e45cf7db33e81c2f44dd3f45cb81ee6c28dc287838f349f
7
+ data.tar.gz: c3e4b97d24ffb3f699d6d0d8003ae8bdcb1b83b2d0c983ae725f98024935cbc39742016efdbd106387cd8b0880dcc57ca837bde0820a568a301a8937337638b6
data/CHANGELOG.md CHANGED
@@ -1,5 +1,25 @@
1
1
  # v1.15
2
2
 
3
+ ## Release v1.15.2 - 2022/08/22
4
+
5
+ ### Enhancement
6
+
7
+ * Add a new system configuration `enable_jit`
8
+ https://github.com/fluent/fluentd/pull/3857
9
+
10
+ ### Bug Fix
11
+
12
+ * out_file: Fix append mode with `--daemon` flag
13
+ https://github.com/fluent/fluentd/pull/3864
14
+ * child_process: Plug file descriptor leak
15
+ https://github.com/fluent/fluentd/pull/3844
16
+
17
+ ### Misc
18
+
19
+ * Drop win32-api gem to support Ruby 3.2
20
+ https://github.com/fluent/fluentd/pull/3849
21
+ https://github.com/fluent/fluentd/pull/3866
22
+
3
23
  ## Release v1.15.1 - 2022/07/27
4
24
 
5
25
  ### Bug Fix
data/fluentd.gemspec CHANGED
@@ -34,12 +34,9 @@ Gem::Specification.new do |gem|
34
34
  fake_platform = ENV['GEM_BUILD_FAKE_PLATFORM'].to_s
35
35
  gem.platform = fake_platform unless fake_platform.empty?
36
36
  if /mswin|mingw/ =~ fake_platform || (/mswin|mingw/ =~ RUBY_PLATFORM && fake_platform.empty?)
37
- gem.add_runtime_dependency("win32-api", [">= 1.10", "< 2.0.0"])
38
37
  gem.add_runtime_dependency("win32-service", ["~> 2.3.0"])
39
38
  gem.add_runtime_dependency("win32-ipc", ["~> 0.7.0"])
40
39
  gem.add_runtime_dependency("win32-event", ["~> 0.6.3"])
41
- gem.add_runtime_dependency("windows-api", ["~> 0.4.5"])
42
- gem.add_runtime_dependency("windows-pr", ["~> 1.2.6"])
43
40
  gem.add_runtime_dependency("certstore_c", ["~> 0.1.7"])
44
41
  end
45
42
 
@@ -189,9 +189,6 @@ op.on('--disable-shared-socket', "Don't open shared socket for multiple workers"
189
189
  }
190
190
 
191
191
  if Fluent.windows?
192
- require 'windows/library'
193
- include Windows::Library
194
-
195
192
  opts.merge!(
196
193
  :winsvc_name => 'fluentdwinsvc',
197
194
  :winsvc_display_name => 'Fluentd Windows Service',
@@ -292,9 +289,7 @@ if winsvcinstmode = opts[:regwinsvc]
292
289
  case winsvcinstmode
293
290
  when 'i'
294
291
  binary_path = File.join(File.dirname(__FILE__), "..")
295
- ruby_path = "\0" * 256
296
- GetModuleFileName.call(0,ruby_path,256)
297
- ruby_path = ruby_path.rstrip.gsub(/\\/, '/')
292
+ ruby_path = ServerEngine.ruby_bin_path
298
293
  start_type = Service::DEMAND_START
299
294
  if opts[:regwinsvcautostart]
300
295
  start_type = Service::AUTO_START
@@ -14,6 +14,8 @@
14
14
  # limitations under the License.
15
15
  #
16
16
 
17
+ require 'fluent/win32api'
18
+
17
19
  module Fluent
18
20
  module FileWrapper
19
21
  def self.open(path, mode='r')
@@ -36,19 +38,16 @@ module Fluent
36
38
  end
37
39
 
38
40
  class WindowsFile
39
- require 'windows/file'
40
- require 'windows/handle'
41
-
42
41
  include File::Constants
43
- include Windows::File
44
- include Windows::Handle
45
42
 
46
43
  attr_reader :io
47
44
 
45
+ INVALID_HANDLE_VALUE = -1
46
+
48
47
  def initialize(path, mode='r')
49
48
  @path = path
50
49
  @io = File.open(path, mode2flags(mode))
51
- @file_handle = _get_osfhandle(@io.to_i)
50
+ @file_handle = Win32API._get_osfhandle(@io.to_i)
52
51
  @io.instance_variable_set(:@file_index, self.ino)
53
52
  def @io.ino
54
53
  @file_index
@@ -68,7 +67,7 @@ module Fluent
68
67
  def ino
69
68
  by_handle_file_information = '\0'*(4+8+8+8+4+4+4+4+4+4) #72bytes
70
69
 
71
- unless GetFileInformationByHandle.call(@file_handle, by_handle_file_information)
70
+ unless Win32API.GetFileInformationByHandle(@file_handle, by_handle_file_information)
72
71
  return 0
73
72
  end
74
73
 
@@ -122,7 +121,7 @@ module Fluent
122
121
  bufsize = 1024
123
122
  buf = '\0' * bufsize
124
123
 
125
- unless GetFileInformationByHandleEx.call(@file_handle, file_standard_info, buf, bufsize)
124
+ unless Win32API.GetFileInformationByHandleEx(@file_handle, file_standard_info, buf, bufsize)
126
125
  return false
127
126
  end
128
127
 
@@ -346,6 +346,9 @@ module Fluent
346
346
  if cb
347
347
  cb.call(process_info.exit_status) rescue nil
348
348
  end
349
+ process_info.readio&.close rescue nil
350
+ process_info.writeio&.close rescue nil
351
+ process_info.stderrio&.close rescue nil
349
352
  end
350
353
  thread[:_fluentd_plugin_helper_child_process_running] = true
351
354
  thread[:_fluentd_plugin_helper_child_process_pid] = pid
@@ -32,12 +32,6 @@ require 'fluent/variable_store'
32
32
  require 'serverengine'
33
33
 
34
34
  if Fluent.windows?
35
- require 'windows/library'
36
- require 'windows/synchronize'
37
- require 'windows/system_info'
38
- include Windows::Library
39
- include Windows::Synchronize
40
- include Windows::SystemInfo
41
35
  require 'win32/ipc'
42
36
  require 'win32/event'
43
37
  end
@@ -50,6 +44,9 @@ module Fluent
50
44
  @rpc_server = nil
51
45
  @counter = nil
52
46
 
47
+ @fluentd_lock_dir = Dir.mktmpdir("fluentd-lock-")
48
+ ENV['FLUENTD_LOCK_DIR'] = @fluentd_lock_dir
49
+
53
50
  if config[:rpc_endpoint]
54
51
  @rpc_endpoint = config[:rpc_endpoint]
55
52
  @enable_get_dump = config[:enable_get_dump]
@@ -79,9 +76,15 @@ module Fluent
79
76
  stop_windows_event_thread if Fluent.windows?
80
77
  stop_rpc_server if @rpc_endpoint
81
78
  stop_counter_server if @counter
79
+ cleanup_lock_dir
82
80
  Fluent::Supervisor.cleanup_resources
83
81
  end
84
82
 
83
+ def cleanup_lock_dir
84
+ FileUtils.rm(Dir.glob(File.join(@fluentd_lock_dir, "fluentd-*.lock")))
85
+ FileUtils.rmdir(@fluentd_lock_dir)
86
+ end
87
+
85
88
  def run_rpc_server
86
89
  @rpc_server = RPC::Server.new(@rpc_endpoint, $log)
87
90
 
@@ -235,7 +238,8 @@ module Fluent
235
238
  end
236
239
  begin
237
240
  loop do
238
- ipc_idx = ipc.wait_any(events.map {|e| e[:win32_event]}, Windows::Synchronize::INFINITE)
241
+ infinite = 0xFFFFFFFF
242
+ ipc_idx = ipc.wait_any(events.map {|e| e[:win32_event]}, infinite)
239
243
  event_idx = ipc_idx - 1
240
244
 
241
245
  if event_idx >= 0 && event_idx < events.length
@@ -876,10 +880,7 @@ module Fluent
876
880
  Fluent::Supervisor.load_config(@config_path, params)
877
881
  }
878
882
 
879
- Dir.mktmpdir("fluentd-lock-") do |lock_dir|
880
- ENV['FLUENTD_LOCK_DIR'] = lock_dir
881
- se.run
882
- end
883
+ se.run
883
884
  end
884
885
 
885
886
  def install_main_process_signal_handlers
@@ -1104,6 +1105,11 @@ module Fluent
1104
1105
  fluentd_spawn_cmd << '-Eascii-8bit:ascii-8bit'
1105
1106
  end
1106
1107
 
1108
+ if @system_config.enable_jit
1109
+ $log.info "enable Ruby JIT for workers (--jit)"
1110
+ fluentd_spawn_cmd << '--jit'
1111
+ end
1112
+
1107
1113
  # Adding `-h` so that it can avoid ruby's command blocking
1108
1114
  # e.g. `ruby -Eascii-8bit:ascii-8bit` will block. but `ruby -Eascii-8bit:ascii-8bit -h` won't.
1109
1115
  _, e, s = Open3.capture3(*fluentd_spawn_cmd, "-h")
@@ -28,7 +28,7 @@ module Fluent
28
28
  :without_source, :rpc_endpoint, :enable_get_dump, :process_name,
29
29
  :file_permission, :dir_permission, :counter_server, :counter_client,
30
30
  :strict_config_value, :enable_msgpack_time_support, :disable_shared_socket,
31
- :metrics, :enable_input_metrics, :enable_size_metrics
31
+ :metrics, :enable_input_metrics, :enable_size_metrics, :enable_jit
32
32
  ]
33
33
 
34
34
  config_param :workers, :integer, default: 1
@@ -50,6 +50,7 @@ module Fluent
50
50
  config_param :disable_shared_socket, :bool, default: nil
51
51
  config_param :enable_input_metrics, :bool, default: nil
52
52
  config_param :enable_size_metrics, :bool, default: nil
53
+ config_param :enable_jit, :bool, default: false
53
54
  config_param :file_permission, default: nil do |v|
54
55
  v.to_i(8)
55
56
  end
@@ -16,6 +16,6 @@
16
16
 
17
17
  module Fluent
18
18
 
19
- VERSION = '1.15.1'
19
+ VERSION = '1.15.2'
20
20
 
21
21
  end
@@ -0,0 +1,38 @@
1
+ #
2
+ # Fluentd
3
+ #
4
+ # Licensed under the Apache License, Version 2.0 (the "License");
5
+ # you may not use this file except in compliance with the License.
6
+ # You may obtain a copy of the License at
7
+ #
8
+ # http://www.apache.org/licenses/LICENSE-2.0
9
+ #
10
+ # Unless required by applicable law or agreed to in writing, software
11
+ # distributed under the License is distributed on an "AS IS" BASIS,
12
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
+ # See the License for the specific language governing permissions and
14
+ # limitations under the License.
15
+ #
16
+
17
+ require 'fluent/env'
18
+
19
+ module Fluent
20
+ module Win32API
21
+ require 'fiddle/import'
22
+ require 'fiddle/types'
23
+ extend Fiddle::Importer
24
+
25
+ if RUBY_PLATFORM.split('-')[-1] == "ucrt"
26
+ MSVCRT_DLL = 'ucrtbase.dll'
27
+ else
28
+ MSVCRT_DLL = 'msvcrt.dll'
29
+ end
30
+
31
+ dlload MSVCRT_DLL, "kernel32.dll"
32
+ include Fiddle::Win32Types
33
+
34
+ extern "intptr_t _get_osfhandle(int)"
35
+ extern "BOOL GetFileInformationByHandle(HANDLE, void *)"
36
+ extern "BOOL GetFileInformationByHandleEx(HANDLE, int, void *, DWORD)"
37
+ end if Fluent.windows?
38
+ end
data/lib/fluent/winsvc.rb CHANGED
@@ -17,14 +17,12 @@
17
17
  begin
18
18
 
19
19
  require 'optparse'
20
- require 'windows/debug'
21
- require 'Windows/Library'
22
20
  require 'win32/daemon'
23
21
  require 'win32/event'
22
+ require 'win32/registry'
23
+ require 'serverengine'
24
24
 
25
25
  include Win32
26
- include Windows::Library
27
- include Windows::Debug
28
26
 
29
27
  op = OptionParser.new
30
28
  opts = {service_name: nil}
@@ -37,16 +35,13 @@ begin
37
35
  end
38
36
 
39
37
  def read_fluentdopt(service_name)
40
- require 'win32/Registry'
41
38
  Win32::Registry::HKEY_LOCAL_MACHINE.open("SYSTEM\\CurrentControlSet\\Services\\#{service_name}") do |reg|
42
39
  reg.read("fluentdopt")[1] rescue ""
43
40
  end
44
41
  end
45
42
 
46
43
  def service_main_start(service_name)
47
- ruby_path = 0.chr * 260
48
- GetModuleFileName.call(0, ruby_path,260)
49
- ruby_path = ruby_path.rstrip.gsub(/\\/, '/')
44
+ ruby_path = ServerEngine.ruby_bin_path
50
45
  rubybin_dir = ruby_path[0, ruby_path.rindex("/")]
51
46
  opt = read_fluentdopt(service_name)
52
47
  Process.spawn("\"#{rubybin_dir}/ruby.exe\" \"#{rubybin_dir}/fluentd\" #{opt} -x #{service_name}")
@@ -84,6 +84,7 @@ module Fluent::Config
84
84
  assert_nil(sc.enable_input_metrics)
85
85
  assert_nil(sc.enable_size_metrics)
86
86
  assert_nil(sc.enable_msgpack_time_support)
87
+ assert(!sc.enable_jit)
87
88
  assert_equal(:text, sc.log.format)
88
89
  assert_equal('%Y-%m-%d %H:%M:%S %z', sc.log.time_format)
89
90
  end
@@ -102,6 +103,7 @@ module Fluent::Config
102
103
  'enable_msgpack_time_support' => ['enable_msgpack_time_support', true],
103
104
  'enable_input_metrics' => ['enable_input_metrics', true],
104
105
  'enable_size_metrics' => ['enable_size_metrics', true],
106
+ 'enable_jit' => ['enable_jit', true],
105
107
  )
106
108
  test "accepts parameters" do |(k, v)|
107
109
  conf = parse_text(<<-EOS)
@@ -2,11 +2,6 @@ require_relative '../helper'
2
2
  require 'fluent/plugin/file_wrapper'
3
3
 
4
4
  class FileWrapperTest < Test::Unit::TestCase
5
- require 'windows/file'
6
- require 'windows/error'
7
- include Windows::File
8
- include Windows::Error
9
-
10
5
  TMP_DIR = File.dirname(__FILE__) + "/../tmp/file_wrapper#{ENV['TEST_ENV_NUMBER']}"
11
6
 
12
7
  def setup
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: fluentd
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.15.1
4
+ version: 1.15.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Sadayuki Furuhashi
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2022-07-27 00:00:00.000000000 Z
11
+ date: 2022-08-22 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -705,6 +705,7 @@ files:
705
705
  - lib/fluent/unique_id.rb
706
706
  - lib/fluent/variable_store.rb
707
707
  - lib/fluent/version.rb
708
+ - lib/fluent/win32api.rb
708
709
  - lib/fluent/winsvc.rb
709
710
  - templates/new_gem/Gemfile
710
711
  - templates/new_gem/README.md.erb
@@ -965,7 +966,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
965
966
  - !ruby/object:Gem::Version
966
967
  version: '0'
967
968
  requirements: []
968
- rubygems_version: 3.3.5
969
+ rubygems_version: 3.3.17
969
970
  signing_key:
970
971
  specification_version: 4
971
972
  summary: Fluentd event collector