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

NullPointerException while getting partitions on NodeTopologyView.getMatchOrDefault(NodeTopologyView.java:94) #2520

Closed
rafadesu opened this issue Oct 12, 2023 · 3 comments
Labels
status: invalid An issue that we don't feel is valid

Comments

@rafadesu
Copy link

Bug Report

I found similar closed error reported here: #2243

Current Behavior

Stack trace
java.lang.NullPointerException: Cannot invoke "java.lang.CharSequence.length()" because "this.text" is null
	at java.base/java.util.regex.Matcher.getTextLength(Matcher.java:1769)
	at java.base/java.util.regex.Matcher.reset(Matcher.java:415)
	at java.base/java.util.regex.Matcher.<init>(Matcher.java:252)
	at java.base/java.util.regex.Pattern.matcher(Pattern.java:1134)
	at io.lettuce.core.cluster.topology.NodeTopologyView.getMatchOrDefault(NodeTopologyView.java:94)
	at io.lettuce.core.cluster.topology.NodeTopologyView.getClientCount(NodeTopologyView.java:85)
	at io.lettuce.core.cluster.topology.NodeTopologyView.<init>(NodeTopologyView.java:73)
	at io.lettuce.core.cluster.topology.NodeTopologyView.from(NodeTopologyView.java:109)
	at io.lettuce.core.cluster.topology.DefaultClusterTopologyRefresh.getNodeSpecificViews(DefaultClusterTopologyRefresh.java:229)
	at io.lettuce.core.cluster.topology.DefaultClusterTopologyRefresh.lambda$null$1(DefaultClusterTopologyRefresh.java:108)
	at java.base/java.util.concurrent.CompletableFuture$UniApply.tryFire(CompletableFuture.java:646)
	at java.base/java.util.concurrent.CompletableFuture$Completion.run(CompletableFuture.java:482)
	at io.netty.util.concurrent.AbstractEventExecutor.runTask(AbstractEventExecutor.java:174)
	at io.netty.util.concurrent.DefaultEventExecutor.run(DefaultEventExecutor.java:66)
	at io.netty.util.concurrent.SingleThreadEventExecutor$4.run(SingleThreadEventExecutor.java:997)
	at io.netty.util.internal.ThreadExecutorMap$2.run(ThreadExecutorMap.java:74)
	at io.netty.util.concurrent.FastThreadLocalRunnable.run(FastThreadLocalRunnable.java:30)
	at java.base/java.lang.Thread.run(Thread.java:833)

Input Code

Input Code
            try {
                client.reloadPartitions();
                partitions = clusterConnection.getPartitions();
                log.info("A final reload of partitions after failover is completed");
            } catch (Exception e) {
                log.error("Unable to reload partitions after failover is completed", e);
            }

where client is RedisClusterClient and clusterConnection is StatefulRedisClusterConnection<byte[], byte[]>

Expected behavior/code

I would hope for partitions to be returned without NPE.

Environment

  • Lettuce version(s): 6.2.6.RELEASE
  • Redis version: 3.5.66

Possible Solution

I don't have any other than retrying.

Additional context

N/A

@mp911de mp911de added the type: bug A general bug label Oct 12, 2023
@mp911de
Copy link
Collaborator

mp911de commented Oct 12, 2023

This doesn't look like a version 6.2.6 exception but rather as if there were many Lettuce versions on the class path. getMatchOrDefault is guarded against a null value when looking up the client count.

@mp911de mp911de added the status: waiting-for-feedback We need additional information before we can continue label Oct 12, 2023
@rafadesu
Copy link
Author

You are right... this seems more accurate with 6.1.10.RELEASE which we updated from.
My mvn dependency:tree is clearly indicated 6.2.6.RELEASE though...:

[INFO] |     +- io.lettuce:lettuce-core:jar:6.2.6.RELEASE:compile
[INFO] |  |  |  |  |  \- io.lettuce:lettuce-core:jar:6.2.6.RELEASE:compile
[INFO] |  |  +- io.lettuce:lettuce-core:jar:6.2.6.RELEASE:compile
[INFO] |  |  |  \- io.lettuce:lettuce-core:jar:6.2.6.RELEASE:compile

But it is clearly my mistake. This seems to be a NPE in an instance that didn't get updated yet to 6.2.6.RELEASE.

Please disregard this issue and accept my apologies.

@mp911de
Copy link
Collaborator

mp911de commented Oct 13, 2023

No worries, each report can turn out as bug.

@mp911de mp911de closed this as not planned Won't fix, can't repro, duplicate, stale Oct 13, 2023
@mp911de mp911de added status: invalid An issue that we don't feel is valid and removed type: bug A general bug status: waiting-for-feedback We need additional information before we can continue labels Oct 13, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
status: invalid An issue that we don't feel is valid
Projects
None yet
Development

No branches or pull requests

2 participants