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

redis gem 4+ incompatibility "Specified 'redis' for Action Cable pubsub adapter, but the gem is not loaded" #30527

Closed
cpg opened this Issue Sep 5, 2017 · 15 comments

Comments

Projects
None yet
@cpg
Contributor

cpg commented Sep 5, 2017

Steps to reproduce

Using ActionCable 5.1.3 with the redis gem upgraded from 3.3.3 to 4.0.0 and attempting to broadcast on a channel seems to yield this exception:

Specified 'redis' for Action Cable pubsub adapter, but the gem is not loaded. Add `gem 'redis'` to your Gemfile (and ensure its version is at the minimum required by Action Cable).

Going back to ~> 3.3 makes AC work again as expected.

Expected behavior

AC should work

Actual behavior

An exception is raised indicating the gem is not loaded, but it seems to be.

Going back to ~> 3.3 makes AC work again as expected.

System configuration

Rails version: 5.1.3

Ruby version: 2.4.1

@KeithP

This comment has been minimized.

Show comment
Hide comment
@KeithP

KeithP Sep 11, 2017

Contributor

We got this error too after bundle update. Might not be obvious to all how to diagnose from the error message - we did have gem 'redis' in our gemfile, just not the right version.

Contributor

KeithP commented Sep 11, 2017

We got this error too after bundle update. Might not be obvious to all how to diagnose from the error message - we did have gem 'redis' in our gemfile, just not the right version.

@InteNs

This comment has been minimized.

Show comment
Hide comment
@InteNs

InteNs Sep 21, 2017

same problem here, seems that AC doesn't have it's dependencies straight.

InteNs commented Sep 21, 2017

same problem here, seems that AC doesn't have it's dependencies straight.

@rikkipitt

This comment has been minimized.

Show comment
Hide comment
@rikkipitt

rikkipitt Sep 21, 2017

I'm getting this today too, shall investigate further.

rikkipitt commented Sep 21, 2017

I'm getting this today too, shall investigate further.

@aldefouw

This comment has been minimized.

Show comment
Hide comment
@aldefouw

aldefouw Sep 22, 2017

Can confirm that this happened to me as well.

Rails Version 5.0.0.1.
Ruby Version 2.2.3

I tried running Redis 4.0 and received the error.

When I moved back to ~> 3.3 then everything was fine and web sockets worked.

aldefouw commented Sep 22, 2017

Can confirm that this happened to me as well.

Rails Version 5.0.0.1.
Ruby Version 2.2.3

I tried running Redis 4.0 and received the error.

When I moved back to ~> 3.3 then everything was fine and web sockets worked.

@apai4

This comment has been minimized.

Show comment
Hide comment
@apai4

apai4 Sep 28, 2017

I can also confirm that this issue persists in 5.1.4. As @rikkipitt discovered, the version constraint for the redis gem that actioncable is requesting is too strict:

Which causes this exception to be raised when using a 4.x version of the redis gem (4.0.0 was released August 25):

raise Gem::LoadError, "Specified '#{adapter}' for Action Cable pubsub adapter, but the gem is not loaded. Add `gem '#{e.name}'` to your Gemfile (and ensure its version is at the minimum required by Action Cable)."

It would also be helpful for debugging if the exception being raised mentioned the specific constraint that wasn't satisfied (which should be present in the exception being caught) instead of saying the minimum required version wasn't met.

I can start a PR, but some more testing may be required before the version constraint can be relaxed since this is a major version bump @maclover7 @matthewd

apai4 commented Sep 28, 2017

I can also confirm that this issue persists in 5.1.4. As @rikkipitt discovered, the version constraint for the redis gem that actioncable is requesting is too strict:

Which causes this exception to be raised when using a 4.x version of the redis gem (4.0.0 was released August 25):

raise Gem::LoadError, "Specified '#{adapter}' for Action Cable pubsub adapter, but the gem is not loaded. Add `gem '#{e.name}'` to your Gemfile (and ensure its version is at the minimum required by Action Cable)."

It would also be helpful for debugging if the exception being raised mentioned the specific constraint that wasn't satisfied (which should be present in the exception being caught) instead of saying the minimum required version wasn't met.

I can start a PR, but some more testing may be required before the version constraint can be relaxed since this is a major version bump @maclover7 @matthewd

@matthewd

This comment has been minimized.

Show comment
Hide comment
@matthewd

matthewd Sep 29, 2017

Member

@jeremy is taking care of the bump in #30748, but I agree the current exception is hiding too much information. It'd be good to improve that, if anyone's up for it.

We should address the AR instance it was copied from at the same time:

raise Gem::LoadError, "Specified '#{spec[:adapter]}' for database adapter, but the gem is not loaded. Add `gem '#{e.name}'` to your Gemfile (and ensure its version is at the minimum required by ActiveRecord)."

Member

matthewd commented Sep 29, 2017

@jeremy is taking care of the bump in #30748, but I agree the current exception is hiding too much information. It'd be good to improve that, if anyone's up for it.

We should address the AR instance it was copied from at the same time:

raise Gem::LoadError, "Specified '#{spec[:adapter]}' for database adapter, but the gem is not loaded. Add `gem '#{e.name}'` to your Gemfile (and ensure its version is at the minimum required by ActiveRecord)."

@Senegal

This comment has been minimized.

Show comment
Hide comment
@Senegal

Senegal Oct 1, 2017

any updates?
I faced same issue on heroku.

versions:
ruby-2.4.0
rails: '~> 5.1.3'

but when I try to downgrade redis to 3.3.3, heroku reject my commit.

remote: Bundler Output: Warning: the running version of Bundler (1.15.2) is older than the
version that created the lockfile (1.16.0.pre.2). We suggest you upgrade to the latest version of Bundler by running gem install bundler --pre.
remote: You are trying to install in deployment mode after changing
remote: your Gemfile. Run bundle install elsewhere and add the
remote: updated Gemfile.lock to version control.
remote:
remote: The dependencies in your gemfile changed
remote:
remote: You have added to the Gemfile:
remote: * redis (= 3.3.3)
remote:
remote: You have deleted from the Gemfile:
remote: * redis (~> 3.0)
remote: !
remote: ! Failed to install gems via Bundler.
remote: !
remote: ! Push rejected, failed to compile Ruby app.

how can i fix it?

Senegal commented Oct 1, 2017

any updates?
I faced same issue on heroku.

versions:
ruby-2.4.0
rails: '~> 5.1.3'

but when I try to downgrade redis to 3.3.3, heroku reject my commit.

remote: Bundler Output: Warning: the running version of Bundler (1.15.2) is older than the
version that created the lockfile (1.16.0.pre.2). We suggest you upgrade to the latest version of Bundler by running gem install bundler --pre.
remote: You are trying to install in deployment mode after changing
remote: your Gemfile. Run bundle install elsewhere and add the
remote: updated Gemfile.lock to version control.
remote:
remote: The dependencies in your gemfile changed
remote:
remote: You have added to the Gemfile:
remote: * redis (= 3.3.3)
remote:
remote: You have deleted from the Gemfile:
remote: * redis (~> 3.0)
remote: !
remote: ! Failed to install gems via Bundler.
remote: !
remote: ! Push rejected, failed to compile Ruby app.

how can i fix it?

@aldefouw

This comment has been minimized.

Show comment
Hide comment
@aldefouw

aldefouw Oct 2, 2017

@Senegal - You probably need to run bundle install on your LOCAL development machine and then commit those updates to your repository before you try deploying again.

When you run a bundle install locally what will happen is that your Gemfile.lock file will be updated to reflect the appropriate Redis version that you are referencing in your Gemfile.

I think Heroku is rejecting because your Gemfile and Gemfile.lock have versions that do not mesh.

If you fix that and then re-deploy, you should be good to go.

aldefouw commented Oct 2, 2017

@Senegal - You probably need to run bundle install on your LOCAL development machine and then commit those updates to your repository before you try deploying again.

When you run a bundle install locally what will happen is that your Gemfile.lock file will be updated to reflect the appropriate Redis version that you are referencing in your Gemfile.

I think Heroku is rejecting because your Gemfile and Gemfile.lock have versions that do not mesh.

If you fix that and then re-deploy, you should be good to go.

@jeremy jeremy closed this in #30748 Oct 8, 2017

jonallured added a commit to jonallured/bearden that referenced this issue Oct 26, 2017

Lock to older redis version
I was getting the exception documented here:

rails/rails#30527

Looks fixed but not yet deployed so I'm retreating to the older version
of the redis gem.

While I was at it, I also fixed an exception about not having the Popper
lib for Bootstrap.

jonallured added a commit to jonallured/bearden that referenced this issue Oct 26, 2017

Lock to older redis version
I was getting the exception documented here:

rails/rails#30527

Looks fixed but not yet deployed so I'm retreating to the older version
of the redis gem.

While I was at it, I also fixed an exception about not having the Popper
lib for Bootstrap.

n-rodriguez pushed a commit to jbox-web/deploy-it that referenced this issue Nov 5, 2017

@Xosmond

This comment has been minimized.

Show comment
Hide comment
@Xosmond

Xosmond Jan 16, 2018

Im experiencing the same problem! with Redis 4.0.1, I had to downgrade to 3.3.5

Xosmond commented Jan 16, 2018

Im experiencing the same problem! with Redis 4.0.1, I had to downgrade to 3.3.5

@novotarq

This comment has been minimized.

Show comment
Hide comment
@novotarq

novotarq Jan 25, 2018

I had the same problem - @Xosmond temporary(?) solution worked for me as well.

novotarq commented Jan 25, 2018

I had the same problem - @Xosmond temporary(?) solution worked for me as well.

zdavis added a commit to ManifoldScholar/manifold that referenced this issue Jan 26, 2018

[B] Downgrade redis and redis-objects
Action cable is not compatibile with v4 of the redis gem.

See rails/rails#30527
@nmiloserdov

This comment has been minimized.

Show comment
Hide comment
@nmiloserdov

nmiloserdov Feb 9, 2018

Have the same problem, ruby - 2.4.0, rails - 5.0.4, had to set redis to ~> 3.2

nmiloserdov commented Feb 9, 2018

Have the same problem, ruby - 2.4.0, rails - 5.0.4, had to set redis to ~> 3.2

@AnkIF

This comment has been minimized.

Show comment
Hide comment
@AnkIF

AnkIF Feb 16, 2018

I had the same issue.
I solved it by updating my gems (bundle update). Not sure which gem exactly solved it.
Now I have: ruby 2.5.0, rails 5.1.5, redis 4.0.1, actioncable 5.1.5.
Perhaps this method is not suitable for everyone, but it worked for me.

AnkIF commented Feb 16, 2018

I had the same issue.
I solved it by updating my gems (bundle update). Not sure which gem exactly solved it.
Now I have: ruby 2.5.0, rails 5.1.5, redis 4.0.1, actioncable 5.1.5.
Perhaps this method is not suitable for everyone, but it worked for me.

@Xosmond

This comment has been minimized.

Show comment
Hide comment
@Xosmond

Xosmond Feb 16, 2018

@AnkIF Looks like v5.1.5 was released 2 days ago.

Xosmond commented Feb 16, 2018

@AnkIF Looks like v5.1.5 was released 2 days ago.

@kimyu92

This comment has been minimized.

Show comment
Hide comment
@kimyu92

kimyu92 Apr 13, 2018

seems like it doesn't backport to rails 5.0.7 (ruby 2.4.4) still having the same problem with redis 4
cc @eileencodes

kimyu92 commented Apr 13, 2018

seems like it doesn't backport to rails 5.0.7 (ruby 2.4.4) still having the same problem with redis 4
cc @eileencodes

@eileencodes

This comment has been minimized.

Show comment
Hide comment
@eileencodes

eileencodes Apr 13, 2018

Member

I didn't backport 3789531 to 5-0-stable because the build wasn't failing with the error that 5-1-stable was failing with.

5.0 is only supported for security fixes now so we're likely not going to backport this to 5.0. Our recommendation is to upgrade to 5.1.

Member

eileencodes commented Apr 13, 2018

I didn't backport 3789531 to 5-0-stable because the build wasn't failing with the error that 5-1-stable was failing with.

5.0 is only supported for security fixes now so we're likely not going to backport this to 5.0. Our recommendation is to upgrade to 5.1.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment