Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

NameError: uninitialized constant Kafka::Consumer::Concurrent on v1.1.0 #840

Closed
fernandes opened this issue Jun 16, 2020 · 1 comment · Fixed by #845
Closed

NameError: uninitialized constant Kafka::Consumer::Concurrent on v1.1.0 #840

fernandes opened this issue Jun 16, 2020 · 1 comment · Fixed by #845

Comments

@fernandes
Copy link

If this is a bug report, please fill out the following:

  • Version of Ruby: 2.6.6p146
  • Version of Kafka: 2.5.0
  • Version of ruby-kafka: 1.1.0

Please verify that the problem you're seeing hasn't been fixed by the current master of ruby-kafka.

It it's not, still showing using Concurrent::Map

Steps to reproduce
  1. Use ruby kafka outside rails (In my case it's a racecar consumer)
Expected outcome

Was expected to run normally

Actual outcome

=> Crashed: NameError: uninitialized constant Kafka::Consumer::Concurrent
vendor/bundle/ruby/2.6.0/gems/ruby-kafka-1.1.0/lib/kafka/consumer.rb:79:in `initialize'

Possible solution

In my case I solved adding concurrent-ruby as dependency and then require 'concurrent/map' on my lib file.

I suspect this is caused because ActiveSupport install ruby-concurrency as its dependency and it's being installed as dev dependency on the gemspec so it wouldn't break in development/tests.

My suggestion is to add ruby-concurrent as a runtime dependency

@TJC
Copy link

TJC commented Jun 18, 2020

I just hit this bug independently!

Likewise, the fix was to add a `require "concurrent/map"

d1egoaz added a commit to d1egoaz/ruby-kafka that referenced this issue Jun 24, 2020
From the comment: `It seems it doesn't need to be threadsafe.`
Via zendesk#835 (comment)

I took a quick look and it seems it's safe to use a simple Hash

Fixes: zendesk#842
Fixes: zendesk#840
digitalronin added a commit to digitalronin/kafka-consumer that referenced this issue Jul 19, 2020
I was getting this error:
zendesk/ruby-kafka#840

The heroku-kafka-demo-ruby app. also uses 
activesupport, which avoids this problem.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants