rdkafka 0.23.1 → 0.24.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: fcc01c63ae339c6d9a2bda9ac171d022bcbe900e2b358725914a3b1950bb775b
4
- data.tar.gz: 2c95e85ed2b2890d2b59e7c171285fcc2050cf50dff27fafb5b8a30282f34fb8
3
+ metadata.gz: 5b0467e6f670f137f458bb1cb856f812ba2292c45a4c2a4b19477531fd59a3b7
4
+ data.tar.gz: 9e18e607e5114b7ed31266565c308517729890e643a68b8535d19fb8df4f8256
5
5
  SHA512:
6
- metadata.gz: b96a9a6362fb86e3c6f6210c4b93b8204801256178747fd1e25dc08bd8132b454c56102ad009fee1ee6c4de89a4a8f1f8835c3262063ef68c04e31a555f5a28e
7
- data.tar.gz: 60ab2b193be2e30d22fed7fe6c12bed7041bc2408c05d9702993c69e029321fa49e0c8a4d33d6334e347c21072c113cfcd065f0581b47dcea734e53140b3f03a
6
+ metadata.gz: d90b9aff5f184ec165c37451773845f66c71cfa47dc4dbf62d4764c009711ac28ab40fe4b3ecc083c2b599043f3906d552b52a1296fcbee089a8024a03c16e9e
7
+ data.tar.gz: 91db6ebb4e3dde0d98395c1714205bae0a5027b31f4d1a1fa435171873d81998efa56c76bdb2c8a410f3cbb3d4348ae847d564d8c2348884d0a7ee080877e7a4
data/CHANGELOG.md CHANGED
@@ -1,12 +1,22 @@
1
1
  # Rdkafka Changelog
2
2
 
3
+ ## 0.24.2 (2025-10-31)
4
+ - [Enhancement] Force lock FFI to 1.17.1 or higher to include critical bug fixes around GCC, write barriers, and thread restarts for forks.
5
+ - [Fix] Fix for Core dump when providing extensions to oauthbearer_set_token (dssjoblom)
6
+
7
+ ## 0.24.1 (2025-10-10)
8
+ - [Fix] Fix Github Action Ruby reference preventing non-compiled releases.
9
+
10
+ ## 0.24.0 (2025-10-10)
11
+ - [Enhancement] Bump librdkafka to `2.11.1`
12
+
3
13
  ## 0.23.1 (2025-09-25)
4
14
  - [Enhancement] Improve sigstore attestation for precompiled releases.
5
15
  - [Fix] Fix incorrectly set default SSL certs dir.
6
16
  - [Fix] Disable OpenSSL Heartbeats during compilation.
7
17
 
8
18
  ## 0.23.0 (2025-09-04)
9
- - **[Breaking]** Drop support for Ruby 3.1 to move forward with the fiber scheduler work.
19
+ - **[EOL]** Drop support for Ruby 3.1 to move forward with the fiber scheduler work.
10
20
  - [Enhancement] Bump librdkafka to `2.11.0`
11
21
  - [Enhancement] Support explicit Debian testing due to lib issues.
12
22
  - [Enhancement] Support ARM64 Gnu precompilation.
@@ -53,7 +63,7 @@
53
63
  - [Patch] Retire no longer needed cooperative-sticky patch.
54
64
 
55
65
  ## 0.19.0 (2024-10-01)
56
- - **[Breaking]** Drop Ruby 3.0 support
66
+ - **[EOL]** Drop Ruby 3.0 support
57
67
  - [Enhancement] Update `librdkafka` to `2.5.3`
58
68
  - [Enhancement] Use default oauth callback if none is passed (bachmanity1)
59
69
  - [Fix] Fix incorrectly behaving CI on failures.
@@ -77,7 +87,7 @@
77
87
  - [Fix] Switch to local release of librdkafka to mitigate its unavailability.
78
88
 
79
89
  ## 0.16.0 (2024-06-13)
80
- - **[Breaking]** Retire support for Ruby 2.7.
90
+ - **[EOL]** Retire support for Ruby 2.7.
81
91
  - **[Breaking]** Messages without headers returned by `#poll` contain frozen empty hash.
82
92
  - **[Breaking]** `HashWithSymbolKeysTreatedLikeStrings` has been removed so headers are regular hashes with string keys.
83
93
  - **[Feature]** Support incremental config describe + alter API.
@@ -138,7 +148,7 @@
138
148
  - [Fix] Reference to Opaque is not released when Admin, Consumer or Producer is closed (mensfeld)
139
149
  - [Fix] Trigger `#poll` on native kafka creation to handle oauthbearer cb (mensfeld)
140
150
  - [Fix] `#flush` does not handle the timeouts errors by making it return `true` if all flushed or `false` if failed. We do **not** raise an exception here to keep it backwards compatible (mensfeld)
141
- - [Change] Remove support for Ruby 2.6 due to it being EOL and WeakMap incompatibilities (mensfeld)
151
+ - **[EOL]** Remove support for Ruby 2.6 due to it being EOL and WeakMap incompatibilities (mensfeld)
142
152
  - [Change] Update Kafka Docker with Confluent KRaft (mensfeld)
143
153
  - [Change] Update librdkafka repo reference from edenhill to confluentinc (mensfeld)
144
154
 
data/README.md CHANGED
@@ -163,6 +163,7 @@ bundle exec rake produce_messages
163
163
 
164
164
  | rdkafka-ruby | librdkafka | patches |
165
165
  |-|-|-|
166
+ | 0.24.x (Unreleased) | 2.11.1 (2025-08-08) | yes |
166
167
  | 0.23.x (2025-09-04) | 2.11.0 (2025-07-03) | yes |
167
168
  | 0.22.x (2025-07-17) | 2.8.0 (2025-01-07) | yes |
168
169
  | 0.21.x (2025-02-13) | 2.8.0 (2025-01-07) | yes |
@@ -0,0 +1,37 @@
1
+ #!/bin/bash
2
+
3
+ # Checks Kafka logs for unsupported warning patterns
4
+ # Only specified warnings are allowed, all others should trigger failure
5
+
6
+ allowed_patterns=(
7
+ "Performing controller activation"
8
+ "registered with feature metadata.version"
9
+ "Replayed TopicRecord for"
10
+ "Replayed PartitionRecord for"
11
+ "Previous leader None and previous leader epoch"
12
+ "Creating new"
13
+ "Unloaded transaction metadata"
14
+ "closing connection"
15
+ )
16
+
17
+ # Get all warnings
18
+ warnings=$(docker logs --since=0 kafka | grep "] WARN ")
19
+ exit_code=0
20
+
21
+ while IFS= read -r line; do
22
+ allowed=0
23
+ for pattern in "${allowed_patterns[@]}"; do
24
+ if echo "$line" | grep -q "$pattern"; then
25
+ allowed=1
26
+ break
27
+ fi
28
+ done
29
+
30
+ if [ $allowed -eq 0 ]; then
31
+ echo "Unexpected warning found:"
32
+ echo "$line"
33
+ exit_code=1
34
+ fi
35
+ done <<< "$warnings"
36
+
37
+ exit $exit_code
@@ -1,7 +1,7 @@
1
1
  services:
2
2
  kafka:
3
3
  container_name: kafka
4
- image: confluentinc/cp-kafka:8.0.0
4
+ image: confluentinc/cp-kafka:8.1.0
5
5
  ports:
6
6
  - 9092:9092 # Support PLAINTEXT so we can run one docker setup for SSL and PLAINTEXT
7
7
  - 9093:9093
data/docker-compose.yml CHANGED
@@ -1,7 +1,7 @@
1
1
  services:
2
2
  kafka:
3
3
  container_name: kafka
4
- image: confluentinc/cp-kafka:8.0.0
4
+ image: confluentinc/cp-kafka:8.1.0
5
5
 
6
6
  ports:
7
7
  - 9092:9092
@@ -2,6 +2,15 @@
2
2
 
3
3
  module Rdkafka
4
4
  # @private
5
+ #
6
+ # @note
7
+ # There are two types of responses related to errors:
8
+ # - rd_kafka_error_t - a C object that we need to remap into an error or null when no error
9
+ # - rd_kafka_resp_err_t - response error code (numeric) that we can use directly
10
+ #
11
+ # It is critical to ensure, that we handle them correctly. The result type should be:
12
+ # - rd_kafka_error_t - :pointer
13
+ # - rd_kafka_resp_err_t - :int
5
14
  module Bindings
6
15
  extend FFI::Library
7
16
 
@@ -91,7 +100,7 @@ module Rdkafka
91
100
  end
92
101
 
93
102
  attach_function :rd_kafka_topic_partition_list_new, [:int32], :pointer
94
- attach_function :rd_kafka_topic_partition_list_add, [:pointer, :string, :int32], :void
103
+ attach_function :rd_kafka_topic_partition_list_add, [:pointer, :string, :int32], :pointer
95
104
  attach_function :rd_kafka_topic_partition_list_set_offset, [:pointer, :string, :int32, :int64], :void
96
105
  attach_function :rd_kafka_topic_partition_list_destroy, [:pointer], :void
97
106
  attach_function :rd_kafka_topic_partition_list_copy, [:pointer], :pointer
@@ -147,6 +156,10 @@ module Rdkafka
147
156
 
148
157
  attach_function :rd_kafka_err2name, [:int], :string
149
158
  attach_function :rd_kafka_err2str, [:int], :string
159
+ attach_function :rd_kafka_error_is_fatal, [:pointer], :int
160
+ attach_function :rd_kafka_error_is_retriable, [:pointer], :int
161
+ attach_function :rd_kafka_error_txn_requires_abort, [:pointer], :int
162
+ attach_function :rd_kafka_error_destroy, [:pointer], :void
150
163
  attach_function :rd_kafka_get_err_descs, [:pointer, :pointer], :void
151
164
 
152
165
  # Configuration
@@ -12,12 +12,18 @@ module Rdkafka
12
12
  # @return [Integer] 0 on success
13
13
  def oauthbearer_set_token(token:, lifetime_ms:, principal_name:, extensions: nil)
14
14
  error_buffer = FFI::MemoryPointer.from_string(" " * 256)
15
+ extensions_ptr, extensions_str_ptrs = map_extensions(extensions)
15
16
 
16
- response = @native_kafka.with_inner do |inner|
17
- Rdkafka::Bindings.rd_kafka_oauthbearer_set_token(
18
- inner, token, lifetime_ms, principal_name,
19
- flatten_extensions(extensions), extension_size(extensions), error_buffer, 256
20
- )
17
+ begin
18
+ response = @native_kafka.with_inner do |inner|
19
+ Rdkafka::Bindings.rd_kafka_oauthbearer_set_token(
20
+ inner, token, lifetime_ms, principal_name,
21
+ extensions_ptr, extension_size(extensions), error_buffer, 256
22
+ )
23
+ end
24
+ ensure
25
+ extensions_str_ptrs&.each { |ptr| ptr.free }
26
+ extensions_ptr&.free
21
27
  end
22
28
 
23
29
  return response if response.zero?
@@ -41,10 +47,31 @@ module Rdkafka
41
47
 
42
48
  private
43
49
 
44
- # Flatten the extensions hash into a string according to the spec, https://datatracker.ietf.org/doc/html/rfc7628#section-3.1
45
- def flatten_extensions(extensions)
46
- return nil unless extensions
47
- "\x01#{extensions.map { |e| e.join("=") }.join("\x01")}"
50
+ # Convert extensions hash to FFI::MemoryPointer (const char **).
51
+ # Note: the returned pointers must be freed manually (autorelease = false).
52
+ def map_extensions(extensions)
53
+ return [nil, nil] if extensions.nil? || extensions.empty?
54
+
55
+ # https://github.com/confluentinc/librdkafka/blob/master/src/rdkafka_sasl_oauthbearer.c#L327-L347
56
+
57
+ # The method argument is const char **
58
+ array_ptr = FFI::MemoryPointer.new(:pointer, extension_size(extensions))
59
+ array_ptr.autorelease = false
60
+ str_ptrs = []
61
+
62
+ # Element i is the key, i + 1 is the value.
63
+ extensions.each_with_index do |(k, v), i|
64
+ k_ptr = FFI::MemoryPointer.from_string(k.to_s)
65
+ k_ptr.autorelease = false
66
+ str_ptrs << k_ptr
67
+ v_ptr = FFI::MemoryPointer.from_string(v.to_s)
68
+ v_ptr.autorelease = false
69
+ str_ptrs << v_ptr
70
+ array_ptr[i * 2].put_pointer(0, k_ptr)
71
+ array_ptr[i * 2 + 1].put_pointer(0, v_ptr)
72
+ end
73
+
74
+ [array_ptr, str_ptrs]
48
75
  end
49
76
 
50
77
  # extension_size is the number of keys + values which should be a non-negative even number
@@ -12,8 +12,8 @@ module Rdkafka
12
12
  # @return [Integer]
13
13
  attr_reader :offset
14
14
 
15
- # The name of the topic this message was produced to or nil in case of reports with errors
16
- # where topic was not reached.
15
+ # The name of the topic this message was produced to or nil in case delivery failed and we
16
+ # we not able to get the topic reference
17
17
  #
18
18
  # @return [String, nil]
19
19
  attr_reader :topic_name
@@ -1,7 +1,7 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Rdkafka
4
- VERSION = "0.23.1"
5
- LIBRDKAFKA_VERSION = "2.11.0"
6
- LIBRDKAFKA_SOURCE_SHA256 = "592a823dc7c09ad4ded1bc8f700da6d4e0c88ffaf267815c6f25e7450b9395ca"
4
+ VERSION = "0.24.2"
5
+ LIBRDKAFKA_VERSION = "2.11.1"
6
+ LIBRDKAFKA_SOURCE_SHA256 = "a2c87186b081e2705bb7d5338d5a01bc88d43273619b372ccb7bb0d264d0ca9f"
7
7
  end
data/rdkafka.gemspec CHANGED
@@ -67,7 +67,7 @@ Gem::Specification.new do |gem|
67
67
  gem.extensions = %w(ext/Rakefile)
68
68
  end
69
69
 
70
- gem.add_dependency 'ffi', '~> 1.15'
70
+ gem.add_dependency 'ffi', '~> 1.17.1'
71
71
  gem.add_dependency 'json', '> 2.0'
72
72
  gem.add_dependency 'logger'
73
73
  gem.add_dependency 'mini_portile2', '~> 2.6'
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rdkafka
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.23.1
4
+ version: 0.24.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Thijs Cadier
@@ -16,14 +16,14 @@ dependencies:
16
16
  requirements:
17
17
  - - "~>"
18
18
  - !ruby/object:Gem::Version
19
- version: '1.15'
19
+ version: 1.17.1
20
20
  type: :runtime
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
24
  - - "~>"
25
25
  - !ruby/object:Gem::Version
26
- version: '1.15'
26
+ version: 1.17.1
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: json
29
29
  requirement: !ruby/object:Gem::Requirement
@@ -177,7 +177,8 @@ files:
177
177
  - MIT-LICENSE
178
178
  - README.md
179
179
  - Rakefile
180
- - dist/librdkafka-2.11.0.tar.gz
180
+ - bin/verify_kafka_warnings
181
+ - dist/librdkafka-2.11.1.tar.gz
181
182
  - dist/patches/rdkafka_global_init.patch
182
183
  - docker-compose-ssl.yml
183
184
  - docker-compose.yml