redis-rb icon indicating copy to clipboard operation
redis-rb copied to clipboard

NOAUTH Authentication required when forked

Open alxx opened this issue 5 years ago • 0 comments

I know that there have been some similar (fixed) issues about forked clients reconnecting and so on, but that was before Redis introduced ACL. Now the problem isn't necessarily the connection, but the authentication.

> r=Redis.new
 => #<Redis client v4.1.3 for redis://127.0.0.1:6379/0> 
> r.auth 'not_my_actual_password'
 => "OK" 
> r.client(:list)
 => [{"id"=>"244"...] 
> fork { puts r.client(:list) }
 => 21693 
Traceback (most recent call last):
	...
	 1: from /Users/alxx/.rvm/gems/ruby-2.5.5/gems/redis-4.1.3/lib/redis.rb:222:in `block in client'
/Users/alxx/.rvm/gems/ruby-2.5.5/gems/redis-4.1.3/lib/redis/client.rb:126:in `call': NOAUTH Authentication required. (Redis::CommandError)

If I rescue this exception, then authenticate and retry, it works well. But isn't there some built-in mechanism to fix this problem?

alxx avatar May 26 '20 15:05 alxx