karafka 2.4.5 → 2.4.6

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: fe76e139b2007e11b0cb9393bc94e2b5b9cad5dc40d69b5ad2bfa34a0555e2b8
4
- data.tar.gz: e288c63648d17388f577a45b51267e30fceb4726def0a42c40a9133de27d93f8
3
+ metadata.gz: e550fa0b7395eab3b961181319d195809baeca82c02935d2735cf98353f6ef8b
4
+ data.tar.gz: f734562bfb86db59a64f4fbeb596bfe126eacd428a4ade00da90d238d959ab64
5
5
  SHA512:
6
- metadata.gz: b5e46439a216e66c728ceb74070832407d39b1ebe06d21c858f3e3a0e8e599df15b749318131aa82a5bc994e6dd7ed3094f44639e706a57231f031f0e52186b6
7
- data.tar.gz: dc44b6a2f0e5d21bdcbe156f0cc94c324d586c74e9fb757454157ac014897fc3cbd683acb19e6397d668f67a9c68e97d683521f1ceecdbf338e24f3d497c688d
6
+ metadata.gz: f80b521d063653c93caee987358573c992af2488ffec9c6465dbb04f9e51e8334548cf669b2b5f8f5783540be01fa8b52e067042cf72afda35f14181148ec87d
7
+ data.tar.gz: 32fd0f08102a2687f4b646d15cd07599f9aaefac957f828396af1f2d91bc91d5c922119bfec04d94cba63af86724d43cb50852de140d78e289fdbb612892dc78
checksums.yaml.gz.sig CHANGED
Binary file
data/CHANGELOG.md CHANGED
@@ -1,4 +1,7 @@
1
- # Karafka framework changelog
1
+ # Karafka Framework Changelog
2
+
3
+ ## 2.4.6 (2024-07-22)
4
+ - [Fix] Mitigate `rd_kafka_cgrp_terminated` and other `librdkafka` shutdown issues by unsubscribing fully prior to shutdown.
2
5
 
3
6
  ## 2.4.5 (2024-07-18)
4
7
  - [Change] Inject `client.id` when building subscription group and not during the initial setup.
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- karafka (2.4.5)
4
+ karafka (2.4.6)
5
5
  base64 (~> 0.2)
6
6
  karafka-core (>= 2.4.3, < 2.5.0)
7
7
  waterdrop (>= 2.7.3, < 3.0.0)
@@ -39,13 +39,13 @@ GEM
39
39
  activesupport (>= 6.1)
40
40
  i18n (1.14.5)
41
41
  concurrent-ruby (~> 1.0)
42
- karafka-core (2.4.3)
43
- karafka-rdkafka (>= 0.15.0, < 0.17.0)
44
- karafka-rdkafka (0.16.0)
42
+ karafka-core (2.4.4)
43
+ karafka-rdkafka (>= 0.15.0, < 0.18.0)
44
+ karafka-rdkafka (0.17.0)
45
45
  ffi (~> 1.15)
46
46
  mini_portile2 (~> 2.6)
47
47
  rake (> 12)
48
- karafka-testing (2.4.4)
48
+ karafka-testing (2.4.5)
49
49
  karafka (>= 2.4.0, < 2.5.0)
50
50
  waterdrop (>= 2.7.0)
51
51
  karafka-web (0.9.1)
@@ -58,7 +58,7 @@ GEM
58
58
  minitest (5.24.0)
59
59
  mutex_m (0.2.0)
60
60
  ostruct (0.6.0)
61
- rack (3.1.4)
61
+ rack (3.1.5)
62
62
  rake (13.2.1)
63
63
  roda (3.81.0)
64
64
  rack
@@ -84,8 +84,8 @@ GEM
84
84
  tilt (2.4.0)
85
85
  tzinfo (2.0.6)
86
86
  concurrent-ruby (~> 1.0)
87
- waterdrop (2.7.3)
88
- karafka-core (>= 2.4.0, < 3.0.0)
87
+ waterdrop (2.7.4)
88
+ karafka-core (>= 2.4.3, < 3.0.0)
89
89
  karafka-rdkafka (>= 0.15.1)
90
90
  zeitwerk (~> 2.3)
91
91
  zeitwerk (2.6.16)
@@ -106,4 +106,4 @@ DEPENDENCIES
106
106
  simplecov
107
107
 
108
108
  BUNDLED WITH
109
- 2.5.14
109
+ 2.5.11
@@ -257,11 +257,15 @@ module Karafka
257
257
 
258
258
  # Gracefully stops topic consumption.
259
259
  def stop
260
- # In case of cooperative-sticky, there is a bug in librdkafka that may hang it.
261
- # To mitigate it we first need to unsubscribe so we will not receive any assignments and
262
- # only then we should be good to go.
260
+ # librdkafka has several constant issues when shutting down during rebalance. This is
261
+ # an issue that gets back every few versions of librdkafka in a limited scope, for example
262
+ # for cooperative-sticky or in a general scope. This is why we unsubscribe and wait until
263
+ # we no longer have any assignments. That way librdkafka consumer shutdown should never
264
+ # happen with rebalance associated with the given consumer instance
265
+ #
266
+ # @see https://github.com/confluentinc/librdkafka/issues/4792
263
267
  # @see https://github.com/confluentinc/librdkafka/issues/4527
264
- if @subscription_group.kafka[:'partition.assignment.strategy'] == 'cooperative-sticky'
268
+ if unsubscribe?
265
269
  unsubscribe
266
270
 
267
271
  until assignment.empty?
@@ -658,8 +662,13 @@ module Karafka
658
662
  subscriptions = @subscription_group.subscriptions
659
663
  assignments = @subscription_group.assignments(consumer)
660
664
 
661
- consumer.subscribe(*subscriptions) if subscriptions
662
- consumer.assign(assignments) if assignments
665
+ if subscriptions
666
+ consumer.subscribe(*subscriptions)
667
+ @mode = :subscribe
668
+ elsif assignments
669
+ consumer.assign(assignments)
670
+ @mode = :assign
671
+ end
663
672
 
664
673
  consumer
665
674
  end
@@ -690,6 +699,22 @@ module Karafka
690
699
  @kafka.start
691
700
  @kafka
692
701
  end
702
+
703
+ # Decides whether or not we should unsubscribe prior to closing.
704
+ #
705
+ # We cannot do it when there is a static group membership assignment as it would be
706
+ # reassigned.
707
+ # We cannot do it also for assign mode because then there are no subscriptions
708
+ # We also do not do it if there are no assignments at all as it does not make sense
709
+ #
710
+ # @return [Boolean] should we unsubscribe prior to shutdown
711
+ def unsubscribe?
712
+ return false if @subscription_group.kafka.key?(:'group.instance.id')
713
+ return false if @mode != :subscribe
714
+ return false if assignment.empty?
715
+
716
+ true
717
+ end
693
718
  end
694
719
  end
695
720
  end
@@ -38,6 +38,7 @@ module Karafka
38
38
  default_topic_conf
39
39
  enable.auto.commit
40
40
  enable.auto.offset.store
41
+ enable.metrics.push
41
42
  enable.partition.eof
42
43
  enable.random.seed
43
44
  enable.sasl.oauthbearer.unsecure.jwt
@@ -89,6 +90,8 @@ module Karafka
89
90
  reconnect.backoff.max.ms
90
91
  reconnect.backoff.ms
91
92
  resolve_cb
93
+ retry.backoff.max.ms
94
+ retry.backoff.ms
92
95
  sasl.kerberos.keytab
93
96
  sasl.kerberos.kinit.cmd
94
97
  sasl.kerberos.min.time.before.relogin
@@ -182,6 +185,7 @@ module Karafka
182
185
  dr_msg_cb
183
186
  enable.gapless.guarantee
184
187
  enable.idempotence
188
+ enable.metrics.push
185
189
  enable.random.seed
186
190
  enable.sasl.oauthbearer.unsecure.jwt
187
191
  enable.ssl.certificate.verification
@@ -3,5 +3,5 @@
3
3
  # Main module namespace
4
4
  module Karafka
5
5
  # Current Karafka version
6
- VERSION = '2.4.5'
6
+ VERSION = '2.4.6'
7
7
  end
data.tar.gz.sig CHANGED
Binary file
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: karafka
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.4.5
4
+ version: 2.4.6
5
5
  platform: ruby
6
6
  authors:
7
7
  - Maciej Mensfeld
@@ -35,7 +35,7 @@ cert_chain:
35
35
  AnG1dJU+yL2BK7vaVytLTstJME5mepSZ46qqIJXMuWob/YPDmVaBF39TDSG9e34s
36
36
  msG3BiCqgOgHAnL23+CN3Rt8MsuRfEtoTKpJVcCfoEoNHOkc
37
37
  -----END CERTIFICATE-----
38
- date: 2024-07-18 00:00:00.000000000 Z
38
+ date: 2024-07-22 00:00:00.000000000 Z
39
39
  dependencies:
40
40
  - !ruby/object:Gem::Dependency
41
41
  name: base64
metadata.gz.sig CHANGED
Binary file