karafka-rdkafka 0.14.9 → 0.14.11

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 8a3805cc154b0e1ca0d71fe06a852013c3e8d8dfd8148d4de8902aed66a2774d
4
- data.tar.gz: 908236ad1ab0be52549f01ddf90ed37355a3b6e9e3373b867eeb83fa05fdf39c
3
+ metadata.gz: 46b697b4fffd0a92901c4ba71c41fe81627828a2146f2f9a4bfb7f6127de44b9
4
+ data.tar.gz: 430bb67bd7de9c7aad6abc037d091aac9dd45b96146e0fc01d0b83e7c9fa0e1f
5
5
  SHA512:
6
- metadata.gz: 6460881076e6c45ae5feb38a3cfd4da3160f13a092f6a7acdbbe268e297b10e27ad792dab32a8c193824a5ef44fc9c2f40c5685ee5c489370056f1c408297f83
7
- data.tar.gz: c2f42212e4df244d36f2312506dd69e52e8064c3485dc1fd0692d223ac9f2512a8b8102b7f473766386eb997dc7bb490fc4fc3c4a2815c528d6c1a8cddee7fcd
6
+ metadata.gz: ee0329ac06eee8cd12d9ce7c0707dc097d73346d176e9e846621c575fc6fb7a199a8b44136ed07c685fe36bd0b51eb259440aaf21bc502e3b0a951d4481f5376
7
+ data.tar.gz: 5b55d118468203c5ea367d8b3902cb37baa018f8f0147b7ed5c2eb3d496a56641e3d3f238d90f2a0d9bcabbbf445158dfb6f185c7878882212d9ead56ec09026
checksums.yaml.gz.sig CHANGED
Binary file
data/CHANGELOG.md CHANGED
@@ -1,5 +1,11 @@
1
1
  # Rdkafka Changelog
2
2
 
3
+ ## 0.14.11 (2024-07-10)
4
+ - [Fix] Switch to local release of librdkafka to mitigate its unavailability.
5
+
6
+ ## 0.14.10 (2024-02-08)
7
+ - [Fix] Background logger stops working after forking causing memory leaks (mensfeld).
8
+
3
9
  ## 0.14.9 (2024-01-29)
4
10
  - [Fix] Partition cache caches invalid `nil` result for `PARTITIONS_COUNT_TTL`.
5
11
  - [Enhancement] Report `-1` instead of `nil` in case `partition_count` failure.
Binary file
data/ext/Rakefile CHANGED
@@ -22,11 +22,21 @@ task :default => :clean do
22
22
  ENV["LDFLAGS"] = "-L#{homebrew_prefix}/lib" unless ENV["LDFLAGS"]
23
23
  end
24
24
 
25
+ releases = File.expand_path(File.join(File.dirname(__FILE__), '../dist'))
26
+
25
27
  recipe.files << {
26
- :url => "https://codeload.github.com/edenhill/librdkafka/tar.gz/v#{Rdkafka::LIBRDKAFKA_VERSION}",
28
+ :url => "file://#{releases}/librdkafka_#{Rdkafka::LIBRDKAFKA_VERSION}.tar.gz",
27
29
  :sha256 => Rdkafka::LIBRDKAFKA_SOURCE_SHA256
28
30
  }
29
31
  recipe.configure_options = ["--host=#{recipe.host}"]
32
+
33
+ # Disable using libc regex engine in favor of the embedded one
34
+ # The default regex engine of librdkafka does not always work exactly as most of the users
35
+ # would expect, hence this flag allows for changing it to the other one
36
+ if ENV.key?('RDKAFKA_DISABLE_REGEX_EXT')
37
+ recipe.configure_options << '--disable-regex-ext'
38
+ end
39
+
30
40
  recipe.cook
31
41
  # Move dynamic library we're interested in
32
42
  if recipe.host.include?('darwin')
@@ -3,10 +3,10 @@
3
3
  require File.expand_path('lib/rdkafka/version', __dir__)
4
4
 
5
5
  Gem::Specification.new do |gem|
6
- gem.authors = ['Thijs Cadier']
6
+ gem.authors = ['Thijs Cadier', 'Maciej Mensfeld']
7
7
  gem.email = ["contact@karafka.io"]
8
8
  gem.description = "Modern Kafka client library for Ruby based on librdkafka"
9
- gem.summary = "The rdkafka gem is a modern Kafka client library for Ruby based on librdkafka. It wraps the production-ready C client using the ffi gem and targets Kafka 1.0+ and Ruby 2.4+."
9
+ gem.summary = "The rdkafka gem is a modern Kafka client library for Ruby based on librdkafka. It wraps the production-ready C client using the ffi gem and targets Kafka 1.0+ and Ruby 2.7+."
10
10
  gem.license = 'MIT'
11
11
 
12
12
  gem.files = `git ls-files`.split($\)
@@ -147,6 +147,8 @@ module Rdkafka
147
147
  else
148
148
  Logger::UNKNOWN
149
149
  end
150
+
151
+ Rdkafka::Config.ensure_log_thread
150
152
  Rdkafka::Config.log_queue << [severity, "rdkafka: #{line}"]
151
153
  end
152
154
 
@@ -15,13 +15,12 @@ module Rdkafka
15
15
  @@opaques = ObjectSpace::WeakMap.new
16
16
  # @private
17
17
  @@log_queue = Queue.new
18
-
19
- Thread.start do
20
- loop do
21
- severity, msg = @@log_queue.pop
22
- @@logger.add(severity, msg)
23
- end
24
- end
18
+ # @private
19
+ # We memoize thread on the first log flush
20
+ # This allows us also to restart logger thread on forks
21
+ @@log_thread = nil
22
+ # @private
23
+ @@log_mutex = Mutex.new
25
24
 
26
25
  # Returns the current logger, by default this is a logger to stdout.
27
26
  #
@@ -30,6 +29,24 @@ module Rdkafka
30
29
  @@logger
31
30
  end
32
31
 
32
+ # Makes sure that there is a thread for consuming logs
33
+ # We do not spawn thread immediately and we need to check if it operates to support forking
34
+ def self.ensure_log_thread
35
+ return if @@log_thread && @@log_thread.alive?
36
+
37
+ @@log_mutex.synchronize do
38
+ # Restart if dead (fork, crash)
39
+ @@log_thread = nil if @@log_thread && !@@log_thread.alive?
40
+
41
+ @@log_thread ||= Thread.start do
42
+ loop do
43
+ severity, msg = @@log_queue.pop
44
+ @@logger.add(severity, msg)
45
+ end
46
+ end
47
+ end
48
+ end
49
+
33
50
  # Returns a queue whose contents will be passed to the configured logger. Each entry
34
51
  # should follow the format [Logger::Severity, String]. The benefit over calling the
35
52
  # logger directly is that this is safe to use from trap contexts.
@@ -1,7 +1,7 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Rdkafka
4
- VERSION = "0.14.9"
4
+ VERSION = "0.14.11"
5
5
  LIBRDKAFKA_VERSION = "2.3.0"
6
6
  LIBRDKAFKA_SOURCE_SHA256 = "2d49c35c77eeb3d42fa61c43757fcbb6a206daa560247154e60642bcdcc14d12"
7
7
  end
@@ -22,6 +22,7 @@ describe Rdkafka::Config do
22
22
  it "supports logging queue" do
23
23
  log = StringIO.new
24
24
  Rdkafka::Config.logger = Logger.new(log)
25
+ Rdkafka::Config.ensure_log_thread
25
26
 
26
27
  Rdkafka::Config.log_queue << [Logger::FATAL, "I love testing"]
27
28
  20.times do
@@ -31,6 +32,25 @@ describe Rdkafka::Config do
31
32
 
32
33
  expect(log.string).to include "FATAL -- : I love testing"
33
34
  end
35
+
36
+ it "expect to start new logger thread after fork and work" do
37
+ reader, writer = IO.pipe
38
+
39
+ pid = fork do
40
+ $stdout.reopen(writer)
41
+ Rdkafka::Config.logger = Logger.new($stdout)
42
+ reader.close
43
+ producer = rdkafka_producer_config(debug: 'all').producer
44
+ producer.close
45
+ writer.close
46
+ sleep(1)
47
+ end
48
+
49
+ writer.close
50
+ Process.wait(pid)
51
+ output = reader.read
52
+ expect(output.split("\n").size).to be >= 20
53
+ end
34
54
  end
35
55
 
36
56
  context "statistics callback" do
@@ -211,6 +211,11 @@ describe Rdkafka::Consumer do
211
211
 
212
212
  # 7. ensure same message is read again
213
213
  message2 = consumer.poll(timeout)
214
+
215
+ # This is needed because `enable.auto.offset.store` is true but when running in CI that
216
+ # is overloaded, offset store lags
217
+ sleep(1)
218
+
214
219
  consumer.commit
215
220
  expect(message1.offset).to eq message2.offset
216
221
  expect(message1.payload).to eq message2.payload
data.tar.gz.sig CHANGED
Binary file
metadata CHANGED
@@ -1,10 +1,11 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: karafka-rdkafka
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.14.9
4
+ version: 0.14.11
5
5
  platform: ruby
6
6
  authors:
7
7
  - Thijs Cadier
8
+ - Maciej Mensfeld
8
9
  autorequire:
9
10
  bindir: bin
10
11
  cert_chain:
@@ -35,7 +36,7 @@ cert_chain:
35
36
  AnG1dJU+yL2BK7vaVytLTstJME5mepSZ46qqIJXMuWob/YPDmVaBF39TDSG9e34s
36
37
  msG3BiCqgOgHAnL23+CN3Rt8MsuRfEtoTKpJVcCfoEoNHOkc
37
38
  -----END CERTIFICATE-----
38
- date: 2024-01-29 00:00:00.000000000 Z
39
+ date: 2024-07-10 00:00:00.000000000 Z
39
40
  dependencies:
40
41
  - !ruby/object:Gem::Dependency
41
42
  name: ffi
@@ -185,6 +186,7 @@ files:
185
186
  - README.md
186
187
  - Rakefile
187
188
  - certs/cert_chain.pem
189
+ - dist/librdkafka_2.3.0.tar.gz
188
190
  - docker-compose.yml
189
191
  - ext/README.md
190
192
  - ext/Rakefile
@@ -282,7 +284,7 @@ signing_key:
282
284
  specification_version: 4
283
285
  summary: The rdkafka gem is a modern Kafka client library for Ruby based on librdkafka.
284
286
  It wraps the production-ready C client using the ffi gem and targets Kafka 1.0+
285
- and Ruby 2.4+.
287
+ and Ruby 2.7+.
286
288
  test_files:
287
289
  - spec/rdkafka/abstract_handle_spec.rb
288
290
  - spec/rdkafka/admin/create_acl_handle_spec.rb
metadata.gz.sig CHANGED
@@ -1,4 +1,2 @@
1
- �v�f).c̀K ���^�KaY��7�+�juE� e�:9��QmiV����R-�����Rm��.Ю0w��d��� -BVR0+h��
2
- +��-��Go�ބ㵀,�Nl�4�u�c8��\�|�n/�hR55��U4Ї�E rj���Qdz8� Y���ޘv���f���i^�����x����(볬�|�%SY�N����r񟊯���d"���4I1�6S���a��5l4�k]�-��S��Jgz�A��I��l3�� X�p/����z
3
- �y�(c�s�dA���,�
4
- F(���
1
+ 6.��(����:��ci����������^�9�ty��z CF�����������1��0]Q�@��+*�=E���v=!5 �jb('#����U�gXNCiƮ�ij[e������s'"N.�X�"C�����Z4�s/4k��1>En$�޸�}Q/KaϽ��k;����*
2
+ �֤�[a�\�J��Z#A��wKcm����k6��w���^�sQR�!�3.�"E&!�f��Z���u:0�����r��;�YflP׬�RKW1��6w�u��ۃ(r��'�َԟ�x�ԁ�r��D��|���;E��H���!�6�+/̧�a�3U��v̈́!�i�/,߶p��wl��X*0���IsPnǵ�