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鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

Trying to send command strings to a closed connection #928

Closed
ajvondrak opened this issue Jun 17, 2020 · 1 comment
Closed

Trying to send command strings to a closed connection #928

ajvondrak opened this issue Jun 17, 2020 · 1 comment

Comments

@ajvondrak
Copy link

Hi, it's me again with some em-synchrony issues. 馃槄 Just for posterity (i.e., for #915), I'm getting errors akin to this:

undefined method `"*2\r\n$4\r\nLLEN\r\n$6\r\nmylist\r\n"' for nil:NilClass (NoMethodError)
redis-4.1.0/lib/redis/connection/synchrony.rb:121:in `write'
redis-4.1.0/lib/redis/client.rb:274:in `block in write'
redis-4.1.0/lib/redis/client.rb:253:in `io'
redis-4.1.0/lib/redis/client.rb:272:in `write'
redis-4.1.0/lib/redis/client.rb:231:in `block (3 levels) in process'
redis-4.1.0/lib/redis/client.rb:225:in `each'
redis-4.1.0/lib/redis/client.rb:225:in `block (2 levels) in process'
redis-4.1.0/lib/redis/client.rb:375:in `ensure_connected'
redis-4.1.0/lib/redis/client.rb:224:in `block in process'
redis-4.1.0/lib/redis/client.rb:312:in `logging'
redis-4.1.0/lib/redis/client.rb:223:in `process'
honeycomb-beeline-2.0.0/lib/honeycomb/integrations/redis.rb:107:in `process'
redis-4.1.0/lib/redis/client.rb:123:in `call'
redis-4.1.0/lib/redis.rb:923:in `block in mget'
redis-4.1.0/lib/redis.rb:50:in `block in synchronize'
lib/ruby/2.5.0/monitor.rb:226:in `mon_synchronize'
redis-4.1.0/lib/redis.rb:50:in `synchronize'
redis-4.1.0/lib/redis.rb:922:in `mget'

Not the most useful error message, but digging through the stack trace we see

def write(command)
@connection.send(build_command(command))
end

So we're attempting to write the Redis command string to the connection. But of course, people have the bad habit of overriding Object#send. 馃槕 So what appears to be happening is that #write is being called after a #disconnect:
def disconnect
@connection.close_connection
@connection = nil
end
So it tries to call NilClass#send with the Redis command string, resulting in the complicated NoMethodError.

@byroot
Copy link
Collaborator

byroot commented Aug 17, 2022

The synchrony driver has been removed in 5.0.

@byroot byroot closed this as not planned Won't fix, can't repro, duplicate, stale Aug 17, 2022
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

No branches or pull requests

2 participants