redis / hiredis-rb

Ruby wrapper for hiredis
BSD 3-Clause "New" or "Revised" License
319 stars 90 forks source link

redis-rb TestInternals#test_large_payload failure #85

Open voxik opened 2 years ago

voxik commented 2 years ago

As described in redis/redis-rb/issues/1117, testing redis-rb 4.7.1 with Redis 7, I observe the following bug when using hiredis-rb 0.6.3 with native extension (the plain Ruby version seems to work just fine):

  1) Error:
TestInternals#test_large_payload:
Redis::ProtocolError:  Got '' as initial reply byte. If you're in a forking environment, such as Unicorn, you need to connect to Redis after forking. 
    /builddir/build/BUILD/redis-4.7.1/usr/share/gems/gems/redis-4.7.1/lib/redis/connection/hiredis.rb:60:in `rescue in read'
    /builddir/build/BUILD/redis-4.7.1/usr/share/gems/gems/redis-4.7.1/lib/redis/connection/hiredis.rb:53:in `read'
    /builddir/build/BUILD/redis-4.7.1/usr/share/gems/gems/redis-4.7.1/lib/redis/client.rb:311:in `block in read'
    /builddir/build/BUILD/redis-4.7.1/usr/share/gems/gems/redis-4.7.1/lib/redis/client.rb:299:in `io'
    /builddir/build/BUILD/redis-4.7.1/usr/share/gems/gems/redis-4.7.1/lib/redis/client.rb:310:in `read'
    /builddir/build/BUILD/redis-4.7.1/usr/share/gems/gems/redis-4.7.1/lib/redis/client.rb:161:in `block in call'
    /builddir/build/BUILD/redis-4.7.1/usr/share/gems/gems/redis-4.7.1/lib/redis/client.rb:279:in `block (2 levels) in process'
    /builddir/build/BUILD/redis-4.7.1/usr/share/gems/gems/redis-4.7.1/lib/redis/client.rb:420:in `ensure_connected'
    /builddir/build/BUILD/redis-4.7.1/usr/share/gems/gems/redis-4.7.1/lib/redis/client.rb:269:in `block in process'
    /builddir/build/BUILD/redis-4.7.1/usr/share/gems/gems/redis-4.7.1/lib/redis/client.rb:373:in `logging'
    /builddir/build/BUILD/redis-4.7.1/usr/share/gems/gems/redis-4.7.1/lib/redis/client.rb:268:in `process'
    /builddir/build/BUILD/redis-4.7.1/usr/share/gems/gems/redis-4.7.1/lib/redis/client.rb:161:in `call'
    /builddir/build/BUILD/redis-4.7.1/usr/share/gems/gems/redis-4.7.1/lib/redis.rb:269:in `block in send_command'
    /builddir/build/BUILD/redis-4.7.1/usr/share/gems/gems/redis-4.7.1/lib/redis.rb:268:in `synchronize'
    /builddir/build/BUILD/redis-4.7.1/usr/share/gems/gems/redis-4.7.1/lib/redis.rb:268:in `send_command'
    /builddir/build/BUILD/redis-4.7.1/usr/share/gems/gems/redis-4.7.1/lib/redis/commands/strings.rb:108:in `setex'
    /builddir/build/BUILD/redis-4.7.1/usr/share/gems/gems/redis-4.7.1/test/internals_test.rb:20:in `test_large_payload'

And I wonder what might be the issue, because the error is not exhibited in redis-rb CI. The difference I have spotted is that hiredis-rb in Fedora is not using the vendored hiredis 1.0.0 but the system hiredis library 1.0.2.

voxik commented 2 years ago

This might be the culprit:

https://github.com/redis/hiredis/commit/76a7b10005c70babee357a7d0f2becf28ec7ed1e