heartbeat: Unsupported command argument type: FalseClass - Redis
Asked Answered
A

2

12

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?

Error message: enter image description here

Aldine answered 4/11, 2022 at 9:38 Comment(0)
B
21

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

Burrussburry answered 8/11, 2022 at 5:48 Comment(1)
Worked like a charm for me Rails 6.1.5, Ruby 2.7.1, MBP M1Max, MontereyCollate
R
2

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. Adding redis explicitly allowed me to update to the most recent sidekiq version that had a fix for this issue:

gem 'sidekiq', '< 7' # 7.0 is not compatible with sidekiq-unique-jobs
gem 'sidekiq-unique-jobs', '~> 7.1'
gem 'redis', '~> 4' # sidekiq requires < 5
Retarder answered 25/11, 2022 at 15:26 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.