Bug: hiredis driver conflict with the hiredis gem
Closed this issue · 2 comments
casperisfine commented
I noticed this when working on the semian adapter.
Repro (linux only):
require 'redis'
require 'redis-client'
Redis.new(host: "redis", driver: :hiredis).ping
RedisClient.new(host: "redis", driver: :hiredis).call("ping")
From what I gather, we end up with redisContext->fd = 0
, which later causes Errno::ENOTSOCK
casperisfine commented
A bit more info, while I can't explain the how and why, what seem to happen based on my various debug attempts, is that both extensions end up using the same libhiredis
, e.g. if hiredis-rb
is loaded first, the redis-client
binding end up using the libhiredis
compiled by hiredis-rb
.
So it seems to be some kind of linking issue.
casperisfine commented
@flavorjones helpfully pointed me to https://github.com/sparklemotion/nokogiri/blob/1552b2aedf1f890016934731b239332c74c6f9a2/ext/nokogiri/extconf.rb#L966
$libs
should allow to import .a
inside the .so
without exporting symbols.