I have rails application which is using sidekiq for background jobs. Recently upgraded ruby from 2.7.0 to 3.1.2 and respectively redis gem automatically updated to ‘5.0.5’. After this sidekiq(6.4.1) logs throws below error, if i revert to old redis version (4.6.0) in my gemlock, there is no error. Any idea what is the reason for this?
2
Answers
The Redis client for Ruby was recently updated and now checks command argument types strictly. Sidekiq as of 6.4.2 was passing a boolean (in your case
FalseClass
) in the heartbeat code, which the new Redis client rejected, hence the error. Booleans are invalid because Redis hashes don’t support type hints; Redis 4.6 and older would just quietly convert to string.Sidekiq has been updated to work with the new Redis client as of 6.5.x. I’m using 6.5.5 and the error is gone:
gem 'sidekiq', '~> 6.5.5'
Here’s the PR that introduced the fix for reference: https://github.com/mperham/sidekiq/pull/5298
I came here due to a similar error. In my case it was a bad combination of Gems that had different requirements.
I am using
sidekiq-unique-jobs
which (as of November 2022) does not work with Sidekiq 7. However, both this and Sidekiq require a specific version of Redis. Addingredis
explicitly allowed me to update to the most recentsidekiq
version that had a fix for this issue: