Comments (6)
@bjosv could please take a look at this and share some inputs / comments?
from hiredis-cluster.
hiredis_cluster does not officially support multi-threads since hiredis doesn't support it, but it might work.
Is the cluster contexts also mutex protected together with hiredis?
I can't see any obvious issue when looking around at redisClusterAsyncRetryCallback + 0x263
, but your output is most likely different than mine.
Could you find out what line of code that is triggering the crash?
You should be able to check this using the start address of redisClusterAsyncRetryCallback
presented by objdump
and add 0x263 to it.
Use something like:
objdump -S -d libhiredis_cluster.so.0.8
The -S
i.e. source annotation of the object dump requires the build flag -g
which hopefully is used.
from hiredis-cluster.
Thank you.
We are trying to reproduce the issue with debug symbols enabled.
from hiredis-cluster.
We have been able to reproduce the crash with debug symbols enabled. Please find the backtrace below.
This is with Release 0.8.1:
0 libhiredis_cluster.so.0.8!redisClusterAsyncRetryCallback [hircluster.c : 3907 + 0x0]
1 libhiredis.so.1.0.0!__redisAsyncFree [async.c : 287 + 0x9]
2 libhiredis.so.1.0.0!redisProcessCallbacks [async.c : 577 + 0x8]
3 redisLibmyeventHandler(int, unsigned int, base::SystemInfo) [hiredis_libmyevent.h : 89 + 0x5]
from hiredis-cluster.
Some input from one of the team members below for another crash which may be related. Please see if this seems plausible:
Backtrace:
0 libhiredis_cluster.so.0.8!redisClusterAsyncRetryCallback + 0x263
1 libhiredis.so.1.0.0!__redisAsyncFree + 0x69
2 libhiredis_cluster.so.0.8!cluster_node_deinit.part.0 + 0x55
3 libhiredis_cluster.so.0.8!dictClusterNodeDestructor + 0x11
4 libhiredis_cluster.so.0.8!dictRelease + 0x76
5 libhiredis_cluster.so.0.8!cluster_update_route + 0x7e4
6 libhiredis_cluster.so.0.8!redisClusterAsyncRetryCallback + 0x3d5
7 libhiredis.so.1.0.0!redisProcessCallbacks + 0x16c
8 redisLibmyeventHandler(int, unsigned int, base::SystemInfo) + 0x1d1
"It seems this is simply that
- when
cluster_node_deinit
callsredisAsyncFree
, it first setsac->data
toNULL
__redisAsyncFree
calls all of the pending callbacksredisClusterAsyncRetryCallback
assumes thatac->data
is non-NULL
- so if one of those callbacks is
redisClusterAsyncRetryCallback
, we hit this crash.
So why don't we hit this crash all the time?
I suspect that normally, cluster_node_deinit
is called from the redisClusterAsyncRetryCallback
, invoked on its own context. As a result, the redisClusterAsyncRetryCallback
has already been invoked by the time redisAsyncFree
is hit, and so isn't pending.
In this case, clusterNode_deinit
is called from the redisClusterAsyncRetryCallback
invoked on a different context, i.e. an event occured on the connection to Redis node 1 that caused us to decide that Redis node 2 should be de-initialized. We know this is true because redisAsyncFree
would not call __redisAsyncFree
synchronously if it was invoked on the same context.
I suspect the fix is simply for redisClusterAsyncCallback
to check if ac->data
is non-NULL
(and adding an extensive comment to explain how this could happen). The alternative could be to unregister these callbacks in cluster_node_deinit
before calling redisAsyncFree
."
from hiredis-cluster.
Great investigation. I managed to reproduce the problem via a testcase, without any extra threads.
Prepared the PR #112. Review comments are always welcomed.
from hiredis-cluster.
Related Issues (20)
- MOVED ERROR in pipeline-API when increasing shards in existing redis cluster HOT 10
- Target "hiredis::hiredis" because target "hiredis" is not a library HOT 1
- During cmake, Checking for module 'glib-2.0' No package 'glib-2.0' found HOT 2
- nodeNext strange behaviour after master failover. HOT 9
- With redisClusterAsyncCommandArgvToNode api, client not discovering new nodes on redis master node disconnect HOT 4
- Update the slotmap after send errors/timeouts in the sync API HOT 1
- hircluster.c:218:9: 错误: HOT 4
- Failed to find keys of command XREADGROUP HOT 2
- Recovery in case of discovered slots from redis cluster is partial HOT 2
- is redisClusterAppendCommand, redisClusterGetReply thread Safe? HOT 1
- SIGSEGV in clusterNodesReplyCallback while calling redisClusterAsyncFree HOT 3
- The connection always been close after every redisClusterCommandArgv HOT 1
- Unable to execute commands without keys (FLUSHALL, PING, INFO) HOT 2
- redisClusterAsyncDisconnect behaviour when a redisAsyncContext object has seen some error HOT 1
- symbol lookup error: /usr/local/lib/libhiredis_cluster.so.0.13: undefined symbol: hiredisAllocFns HOT 4
- Does hiredis-cluster support SCAN HOT 1
- Event loop occasionally hangs after redisClusterAsyncDisconnect under high connection error conditions HOT 2
- Crash while performing redisClusterAsyncFree() HOT 3
- memory leak HOT 1
- Cannot pass command with va_list to specific node HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from hiredis-cluster.