Skip to content

NO-JIRA Guard against null node ID in QuorumManager.vote() - #6729

Open
jbonofre wants to merge 1 commit into
mainfrom
no-jira-quorummanager-nodeid-npe
Open

jbonofre wants to merge 1 commit into
mainfrom
no-jira-quorummanager-nodeid-npe

Conversation

@jbonofre

Copy link
Copy Markdown
Member

Summary

  • ClusterController.getNodeID() delegates to ActiveMQServer.getNodeID(), which is null until this node's NodeManager has assigned/read a node ID.
  • QuorumManager.vote() called .toString() on that value directly while filtering the local node out of the vote targets, so a connection failure that triggers a quorum vote before the node ID is set (e.g. very early in backup startup) throws a NullPointerException, surfacing as AMQ214002: Failed to execute failure listener.
  • This guards the null case: when our own node ID isn't known yet, we can't identify "ourselves" in the topology, so every member is included in the vote instead of crashing.

Test plan

  • Existing quorum/HA integration tests pass
  • Manually reproduce by triggering a connection failure during backup startup before node ID assignment completes, confirm no NPE and vote proceeds

ClusterController.getNodeID() can return null when this node hasn't
been assigned a node ID yet (e.g. during backup startup before the
node-ID handshake completes). If a connection failure triggers a
quorum vote in that window, vote() NPEs on getNodeID().toString().

Read the node ID once and treat a null value as "not yet identifiable
as ourselves" instead of dereferencing it directly.
@jbertram

Copy link
Copy Markdown
Contributor

Is this theoretical or did you actually see an NPE thrown here?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants