Skip to content
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

Warning when refreshing topology #756

Closed
theliro opened this issue Apr 5, 2018 · 6 comments
Closed

Warning when refreshing topology #756

theliro opened this issue Apr 5, 2018 · 6 comments
Labels
type: bug A general bug
Milestone

Comments

@theliro
Copy link

theliro commented Apr 5, 2018

Our application is getting intermittently this warning (every several hours). Looks like it is related to the issue #656 but the stack trace looks bit different. We cannot upgrade yet to any newer 5.0.* versions. Can it be a bug?

WARN  io.lettuce.core.cluster.ClusterTopologyRefreshScheduler [lettuce-eventExecutorLoop-1-4] [|] [] [] [] - Cannot refresh Redis Cluster topology
java.util.ConcurrentModificationException: null
	at java.util.TreeMap$PrivateEntryIterator.nextEntry(TreeMap.java:1211) ~[na:1.8.0_121]
	at java.util.TreeMap$EntryIterator.next(TreeMap.java:1247) ~[na:1.8.0_121]
	at java.util.TreeMap$EntryIterator.next(TreeMap.java:1242) ~[na:1.8.0_121]
	at io.lettuce.core.cluster.topology.Connections.requestClients(Connections.java:98) ~[lettuce-core-5.0.1.RELEASE.jar:na]
	at io.lettuce.core.cluster.topology.ClusterTopologyRefresh.loadViews(ClusterTopologyRefresh.java:71) ~[lettuce-core-5.0.1.RELEASE.jar:na]
	at io.lettuce.core.cluster.RedisClusterClient.loadPartitions(RedisClusterClient.java:787) ~[lettuce-core-5.0.1.RELEASE.jar:na]
	at io.lettuce.core.cluster.RedisClusterClient.reloadPartitions(RedisClusterClient.java:732) ~[lettuce-core-5.0.1.RELEASE.jar:na]
	at io.lettuce.core.cluster.ClusterTopologyRefreshScheduler$ClusterTopologyRefreshTask.run(ClusterTopologyRefreshScheduler.java:197) ~[lettuce-core-5.0.1.RELEASE.jar:na]
	at io.netty.util.concurrent.PromiseTask$RunnableAdapter.call(PromiseTask.java:38) [netty-common-4.1.17.Final.jar:4.1.17.Final]
	at io.netty.util.concurrent.PromiseTask.run(PromiseTask.java:73) [netty-common-4.1.17.Final.jar:4.1.17.Final]
	at io.netty.util.concurrent.DefaultEventExecutor.run(DefaultEventExecutor.java:66) [netty-common-4.1.17.Final.jar:4.1.17.Final]
	at io.netty.util.concurrent.SingleThreadEventExecutor$5.run(SingleThreadEventExecutor.java:858) [netty-common-4.1.17.Final.jar:4.1.17.Final]
	at io.netty.util.concurrent.DefaultThreadFactory$DefaultRunnableDecorator.run(DefaultThreadFactory.java:138) [netty-common-4.1.17.Final.jar:4.1.17.Final]
	at java.lang.Thread.run(Thread.java:745) [na:1.8.0_121]

Lettuce version: 5.0.1.RELEASE
JDK version: 8.0.121

Thanks

@mp911de mp911de added the type: bug A general bug label Apr 5, 2018
@mp911de
Copy link
Collaborator

mp911de commented Apr 5, 2018

Thanks for reporting the issue. It's a synchronization error.

@mp911de mp911de added this to the Lettuce 5.0.4 milestone Apr 5, 2018
@mp911de
Copy link
Collaborator

mp911de commented Apr 5, 2018

Have you customized SocketOptions or RedisURI.getTimeout regarding connection/command timeouts?

mp911de added a commit that referenced this issue Apr 5, 2018


Add synchronization to connection access on client/topology requests to ensure connection map is modified/read by a single thread at a time. Concurrent access may happen if connects succeed after awaiting the synchronization timeout.
mp911de added a commit that referenced this issue Apr 5, 2018


Add synchronization to connection access on client/topology requests to ensure connection map is modified/read by a single thread at a time. Concurrent access may happen if connects succeed after awaiting the synchronization timeout.
@mp911de
Copy link
Collaborator

mp911de commented Apr 5, 2018

There's a snapshot version (5.0.4.BUILD-SNAPSHOT) available that contains a fix for this issue. Care to give the snapshot a spin?

@theliro
Copy link
Author

theliro commented Apr 5, 2018

Yes, you are right. Both places (SocketOptions.connectionTimeout, RedisURI.getTimeout) contain our customizations. Thanks for the quick fix. It is not straightforward to test it but we will give it a try. When is the new version planned for release?

@mp911de
Copy link
Collaborator

mp911de commented Apr 5, 2018

If you make sure that connection timeout is less than the command timeout (by a second or so to be on the safe side), you shouldn't see that issue.

Not quite sure about the release date. Lettuce 5.0.2.RELEASE is being picked up by Spring Boot today. If the workaround with connection timeouts works, I'd schedule a release for the end of April.

@theliro
Copy link
Author

theliro commented Apr 5, 2018

connection_timeout=2000, read_timeout=1000. So exactly the other way around. We will go with your suggestion and see how is going.

@mp911de mp911de closed this as completed Apr 17, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type: bug A general bug
Projects
None yet
Development

No branches or pull requests

2 participants