-
Notifications
You must be signed in to change notification settings - Fork 1.2k
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
IPv6 support for org.springframework.data.redis.connection.convert.Converters.ClusterNodesConverter#convert #2678
Comments
We indeed have a problem here, however, I wonder why Redis doesn't wrap the address in square brackets to disambiguate the port ( Do you want to submit a pull request or do you want us to implement the fix? |
I will submit a PR, thanks! |
@TheTweak - You should also have a look at Issue #2360. Also note, I am also not entirely convinced that using However, |
@jxblum Thanks for the info! So On one hand, support for IPv6 address w/o square brackets can be added to Another option could be a regexp that can parse both inputs, with and w/o square brackets, implemented in What do you think? |
I'll take your pull request and amend it accordingly. |
Looking through the history how It think that a regex is the best here, otherwise parsing can easily become a nightmare. |
Hello, when IPv6 network stack is used,
org.springframework.data.redis.connection.convert.Converters.ClusterNodesConverter#convert
can not convert the response from RedisCLUSTER NODES
command and throwsNumberFormatException
.Input to
convert()
in this case is:67adfe3df1058896e3cb49d2863e0f70e7e159fa 2a02:6b8:c67:9c:0:6d8b:33da:5a2c:6380@16380,redis-master master,nofailover - 0 1692108412315 1 connected 0-5460
and then
Integer.parseInt("6b8:c67:9c:0:6d8b:33da:5a2c:6380")
fails https://github.com/spring-projects/spring-data-redis/blob/main/src/main/java/org/springframework/data/redis/connection/convert/Converters.java#L577Discovered when using
RedisHealthIndicator
from Spring Data Redis module, and when connection to cluster is done via IPv6 network.Expected behaviour:
org.springframework.data.redis.connection.convert.Converters.ClusterNodesConverter#convert
returnsRedisClusterNode
objectActual behaviour:
NumberFormatException
is thrownSpring Data Redis version:
3.1.1
Possible fix could be to split on the last occurrence of
:
here https://github.com/spring-projects/spring-data-redis/blob/main/src/main/java/org/springframework/data/redis/connection/convert/Converters.java#L563The text was updated successfully, but these errors were encountered: