-
Notifications
You must be signed in to change notification settings - Fork 3.9k
JedisCluster functionLoadReplace throws JedisBroadcastException #4144
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’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
@oscarboher |
Sure, this is the simplest way to test it, using Jedis 5.2.0. I checked against a redis-cluster installed locally (as well as our environment) - The error only happens when the cluster has replicas, with only 3 masters the JedisBroadcastException does not appear.
This results in the error:
The client.set returns correctly, just to validate that we can reach the cluster. |
Thanks! Just confirmed the error is reproducible with the provided example code. |
The actual cause for the error can be checked by printing replies from individual nodes stored with JedisBroadcastException. try {
var functionName = client.functionLoadReplace(script);
System.out.println("Ok! Function name: " + functionName);
} catch (JedisBroadcastException e) {
System.out.println("Error getting testKey: " + e);
e.getReplies().forEach((node, reply) -> {
System.out.println("Node: " + node + ", Reply: " + reply);
});
}
The root cause for the exception is that we are broadcasting the command not only to primary nodes as specified in Broadcast for It's a bug that needs to be addressed. @oscarboher as a workaround I can suggest having a dedicated connection to individual primary nodes and executing |
Hey, any estimation on the fix? Will this be available in 5.2 or directly on 6.0.0? Thank you |
Our hands are kind of full right now, and I can not commit to when will have free slots to work on it. Plans are to backport it to 5.2 once fixed. Any contribution is welcome! |
Uh oh!
There was an error while loading. Please reload this page.
Expected behavior
functionLoadReplace(script) using a JedisCluster should load the function without errors.
The script is a dummy script:
Using Jedis 5.2.0
Actual behavior
functionLoadReplace throws a JedisBroadcastException error:
Caused by: redis.clients.jedis.exceptions.JedisBroadcastException: A failure occurred while broadcasting the command.
at redis.clients.jedis.executors.ClusterCommandExecutor.broadcastCommand(ClusterCommandExecutor.java:47) ~[jedis-5.2.0.jar:?]
at redis.clients.jedis.UnifiedJedis.broadcastCommand(UnifiedJedis.java:312) ~[jedis-5.2.0.jar:?]
at redis.clients.jedis.UnifiedJedis.checkAndBroadcastCommand(UnifiedJedis.java:325) ~[jedis-5.2.0.jar:?]
at redis.clients.jedis.UnifiedJedis.functionLoadReplace(UnifiedJedis.java:3552) ~[jedis-5.2.0.jar:?]
Checking in the cluster the function does exist, so I understand that in some node the load was successful, but failed in the broadcast.
This happens for both functions that write to the ddbb and for functions with the 'no-write' flag, so It would seem it is not because of trying to upload the function to a replica node.
Doing functionLoadReplace on each of the nodes of the cluster using a Jedis resource does work, both for replicas and masters, with or without the
no-write
flag.The text was updated successfully, but these errors were encountered: