fluentd 0.12.41 → 0.12.42

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
  SHA1:
3
- metadata.gz: 0ec31bae71a398df42247c0d91a55f5575fe1623
4
- data.tar.gz: 20c905e78d4d66f7c69c94be932dac503644e7f0
3
+ metadata.gz: dfec195ed913b2df7110db9f1daeff69618e0fe4
4
+ data.tar.gz: e04cae36275617e52cbfc29bcd00ad90e521d632
5
5
  SHA512:
6
- metadata.gz: de3317a3a936c3432cadd2f39fda59918ec509eb19f0dd99da0d806a9dacedff35aa52af816b6a05a01e5ba207f27a2510cfc3e9738566226a96f3513ead97e3
7
- data.tar.gz: ed3ea856639b975f67679fe2e7a6015cf6072d2d8edee017e5765424713dc3c85ef1660d56dc792d98ba970583f9b7d6f9e6db5f876f5cc7356a814ec02bc2df
6
+ metadata.gz: de52fc5d1eab2008728c18c7b04ea60f7c1a23d8341ea78d91fbe076d90e5c2dd4e85dc1e0519bb74691063b9e24ef4caf373738a5dddba032363268141b2504
7
+ data.tar.gz: 84a2f281792b3aa5c29ee53af28cb93de3bb24c3ca04af3a00d454a6313a1d5bda730956253e47310b5638f3b722e3eb1a2020d607a21e183c171b5e687cfd77
@@ -1,11 +1,10 @@
1
1
  language: ruby
2
2
 
3
3
  rvm:
4
- - 2.0.0
5
4
  - 2.1
6
5
  - 2.2.6
7
6
  - 2.3.3
8
- - 2.4.0
7
+ - 2.4.2
9
8
  - ruby-head
10
9
 
11
10
  os:
@@ -1,5 +1,25 @@
1
1
  # v0.12
2
2
 
3
+ ## Release 0.12.42 - 2017/12/14
4
+
5
+ ### New features / Enhancements
6
+
7
+ * Disable tracepoint feature to omit unnecessary insts
8
+ https://github.com/fluent/fluentd/pull/1764
9
+ * in_udp: Add receive_buffer_size parameter
10
+ https://github.com/fluent/fluentd/pull/1788
11
+
12
+ ### Bug fixes
13
+
14
+ * in_tail: Ensure close temporaly opened IO object
15
+ https://github.com/fluent/fluentd/pull/1756
16
+ * in_tail: Explicitly update position to 0 when the file is truncated
17
+ https://github.com/fluent/fluentd/pull/1791
18
+ * in_tail: Properly handle moved back and truncated case
19
+ https://github.com/fluent/fluentd/pull/1793
20
+ * out_forward: Rebuild weight array to apply server setting properly
21
+ https://github.com/fluent/fluentd/pull/1784
22
+
3
23
  ## Release 0.12.41 - 2017/11/15
4
24
 
5
25
  ### New features / Enhancements
@@ -490,8 +490,16 @@ module Fluent
490
490
  # assuming following situation:
491
491
  # a) file was once renamed and backed, or
492
492
  # b) symlink or hardlink to the same file is recreated
493
- # in either case, seek to the saved position
494
- pos = @pe.read_pos
493
+ # in either case of a and b, seek to the saved position
494
+ # c) file was once renamed, truncated and then backed
495
+ # in this case, consider it truncated
496
+ last_pos = @pe.read_pos
497
+ if stat.size < last_pos
498
+ pos = 0
499
+ @pe.update(inode, pos)
500
+ else
501
+ pos = last_pos
502
+ end
495
503
  elsif last_inode != 0
496
504
  # this is FilePositionEntry and fluentd once started.
497
505
  # read data from the head of the rotated file.
@@ -526,7 +534,7 @@ module Fluent
526
534
  stat = io.stat
527
535
  inode = stat.ino
528
536
  if inode == @pe.read_inode # truncated
529
- @pe.update_pos(stat.size)
537
+ @pe.update_pos(0)
530
538
  io_handler = IOHandler.new(io, @pe, @log, @read_lines_limit, &method(:wrap_receive_lines))
531
539
  @io_handler.close
532
540
  @io_handler = io_handler
@@ -535,6 +543,7 @@ module Fluent
535
543
  io_handler = IOHandler.new(io, @pe, @log, @read_lines_limit, &method(:wrap_receive_lines))
536
544
  @io_handler = io_handler
537
545
  else # file is rotated and new file found
546
+ io.close unless io.closed?
538
547
  detach
539
548
  @update_watcher.call(@path, swap_state(@pe))
540
549
  end
@@ -28,6 +28,8 @@ module Fluent
28
28
  config_param :message_length_limit, :size, default: 4096
29
29
  desc "Remove newline from the end of incoming payload"
30
30
  config_param :remove_newline, :bool, default: true
31
+ desc "The max size of socket receive buffer. SO_RCVBUF"
32
+ config_param :receive_buffer_size, :size, default: nil
31
33
 
32
34
  def configure(conf)
33
35
  super
@@ -39,7 +41,7 @@ module Fluent
39
41
  log.info "listening udp socket on #{@bind}:#{@port}"
40
42
  @usock = SocketUtil.create_udp_socket(@bind)
41
43
  @usock.bind(@bind, @port)
42
- SocketUtil::UdpHandler.new(@usock, log, @message_length_limit, callback, !!@source_hostname_key, @remove_newline)
44
+ SocketUtil::UdpHandler.new(@usock, log, @message_length_limit, callback, !!@source_hostname_key, @remove_newline, @receive_buffer_size)
43
45
  end
44
46
  end
45
47
  end
@@ -263,6 +263,7 @@ module Fluent
263
263
 
264
264
  r = Random.new(@rand_seed)
265
265
  weight_array.sort_by! { r.rand }
266
+ p weight_array.map { |e| e.name }
266
267
 
267
268
  @weight_array = weight_array
268
269
  end
@@ -397,13 +398,17 @@ module Fluent
397
398
  begin
398
399
  #log.trace "sending heartbeat #{n.host}:#{n.port} on #{@heartbeat_type}"
399
400
  if @heartbeat_type == :tcp
400
- send_heartbeat_tcp(n)
401
+ if send_heartbeat_tcp(n)
402
+ rebuild_weight_array
403
+ end
401
404
  else
402
405
  @usock.send "\0", 0, Socket.pack_sockaddr_in(n.port, n.resolved_host)
403
406
  end
404
- rescue Errno::EAGAIN, Errno::EWOULDBLOCK, Errno::EINTR, Errno::ECONNREFUSED
407
+ rescue Errno::EAGAIN, Errno::EWOULDBLOCK, Errno::EINTR, Errno::ECONNREFUSED => e
405
408
  # TODO log
406
- log.debug "failed to send heartbeat packet to #{n.host}:#{n.port}", error: $!.to_s
409
+ log.debug "failed to send heartbeat packet to #{n.host}:#{n.port}", error: e.to_s
410
+ rescue => e
411
+ log.debug "unexpected error happen during heartbeat to #{n.host}:#{n.port}", error: e.to_s
407
412
  end
408
413
  if n.tick
409
414
  rebuild_weight_array
@@ -32,8 +32,11 @@ module Fluent
32
32
  module_function :create_udp_socket
33
33
 
34
34
  class UdpHandler < Coolio::IO
35
- def initialize(io, log, body_size_limit, callback, resolve_hostname = false, remove_newline = true)
35
+ def initialize(io, log, body_size_limit, callback, resolve_hostname = false, remove_newline = true, receive_buffer_size = nil)
36
36
  super(io)
37
+ if io.is_a?(UDPSocket) && receive_buffer_size
38
+ io.setsockopt(Socket::SOL_SOCKET, Socket::SO_RCVBUF, receive_buffer_size)
39
+ end
37
40
  @io = io
38
41
  @io.do_not_reverse_lookup = !resolve_hostname
39
42
  @log = log
@@ -16,6 +16,6 @@
16
16
 
17
17
  module Fluent
18
18
 
19
- VERSION = '0.12.41'
19
+ VERSION = '0.12.42'
20
20
 
21
21
  end
@@ -315,6 +315,54 @@ class TailInputTest < Test::Unit::TestCase
315
315
  file.close
316
316
  end
317
317
 
318
+ def test_truncate_file
319
+ File.open("#{TMP_DIR}/tail.txt", "w") {|f|
320
+ f.puts "test1"
321
+ f.puts "test2"
322
+ }
323
+
324
+ d = create_driver
325
+ d.run do
326
+ sleep 1
327
+
328
+ File.open("#{TMP_DIR}/tail.txt", "a") {|f|
329
+ f.puts "test3"
330
+ f.puts "test4"
331
+ }
332
+ sleep 1
333
+ File.truncate("#{TMP_DIR}/tail.txt", 6)
334
+ sleep 1
335
+ end
336
+
337
+ emits = d.emits
338
+ assert_equal(3, emits.length)
339
+ assert_equal({"message" => "test3"}, emits[0][2])
340
+ assert_equal({"message" => "test4"}, emits[1][2])
341
+ assert_equal({"message" => "test1"}, emits[2][2])
342
+ end
343
+
344
+ def test_move_truncate_move_back
345
+ File.open("#{TMP_DIR}/tail.txt", "w") {|f|
346
+ f.puts "test1"
347
+ f.puts "test2"
348
+ }
349
+
350
+ d = create_driver
351
+ d.run do
352
+ sleep 1
353
+ FileUtils.mv("#{TMP_DIR}/tail.txt", "#{TMP_DIR}/tail2.txt")
354
+ sleep 1
355
+ File.truncate("#{TMP_DIR}/tail2.txt", 6)
356
+ sleep 1
357
+ FileUtils.mv("#{TMP_DIR}/tail2.txt", "#{TMP_DIR}/tail.txt")
358
+ sleep 1
359
+ end
360
+
361
+ emits = d.emits
362
+ assert_equal(1, emits.length)
363
+ assert_equal({"message" => "test1"}, emits[0][2])
364
+ end
365
+
318
366
  def test_lf
319
367
  File.open("#{TMP_DIR}/tail.txt", "w") {|f| }
320
368
 
@@ -33,6 +33,7 @@ class UdpInputTest < Test::Unit::TestCase
33
33
  assert_equal PORT, d.instance.port
34
34
  assert_equal k, d.instance.bind
35
35
  assert_equal 4096, d.instance.message_length_limit
36
+ assert_equal nil, d.instance.receive_buffer_size
36
37
  }
37
38
  end
38
39
 
@@ -124,6 +125,39 @@ class UdpInputTest < Test::Unit::TestCase
124
125
  compare_test_result(d.emits, tests)
125
126
  end
126
127
 
128
+ test "receive_buffer_size" do
129
+ # don't check exact value because it depends on platform and condition
130
+
131
+ # check if default socket and in_udp's one without receive_buffer_size have same size buffer
132
+ d0 = create_driver(BASE_CONFIG + %!
133
+ format none
134
+ !)
135
+ d0.run do
136
+ begin
137
+ sock = d0.instance.instance_variable_get(:@handler).instance_variable_get(:@io)
138
+ default_sock = UDPSocket.new
139
+ assert_equal(default_sock.getsockopt(Socket::SOL_SOCKET, Socket::SO_RCVBUF).int, sock.getsockopt(Socket::SOL_SOCKET, Socket::SO_RCVBUF).int)
140
+ ensure
141
+ default_sock.close
142
+ end
143
+ end
144
+
145
+ # check if default socket and in_udp's one with receive_buffer_size have different size buffer
146
+ d1 = create_driver(BASE_CONFIG + %!
147
+ format none
148
+ receive_buffer_size 1001
149
+ !)
150
+ d1.run do
151
+ sock = d1.instance.instance_variable_get(:@handler).instance_variable_get(:@io)
152
+ begin
153
+ default_sock = UDPSocket.new
154
+ assert_not_equal(default_sock.getsockopt(Socket::SOL_SOCKET, Socket::SO_RCVBUF).int, sock.getsockopt(Socket::SOL_SOCKET, Socket::SO_RCVBUF).int)
155
+ ensure
156
+ default_sock.close
157
+ end
158
+ end
159
+ end
160
+
127
161
  def compare_test_result(emits, tests)
128
162
  assert_equal(2, emits.size)
129
163
  emits.each_index {|i|
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: 0.12.41
4
+ version: 0.12.42
5
5
  platform: ruby
6
6
  authors:
7
7
  - Sadayuki Furuhashi
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2017-11-16 00:00:00.000000000 Z
11
+ date: 2017-12-14 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: msgpack