You are viewing a plain text version of this content. The canonical link for it is here.
Posted to pr@cassandra.apache.org by "krummas (via GitHub)" <gi...@apache.org> on 2025/04/04 13:37:47 UTC
[PR] CASSANDRA-20527; Avoid NPE during cms initialization abort [cassandra]
krummas opened a new pull request, #4049:
URL: https://github.com/apache/cassandra/pull/4049
Thanks for sending a pull request! Here are some tips if you're new here:
* Ensure you have added or run the [appropriate tests](https://cassandra.apache.org/_/development/testing.html) for your PR.
* Be sure to keep the PR description updated to reflect all changes.
* Write your PR title to summarize what this PR proposes.
* If possible, provide a concise example to reproduce the issue for a faster review.
* Read our [contributor guidelines](https://cassandra.apache.org/_/development/index.html)
* If you're making a documentation change, see our [guide to documentation contribution](https://cassandra.apache.org/_/development/documentation.html)
Commit messages should follow the following format:
```
<One sentence description, usually Jira title or CHANGES.txt summary>
<Optional lengthier description (context on patch)>
patch by <Authors>; reviewed by <Reviewers> for CASSANDRA-#####
Co-authored-by: Name1 <email1>
Co-authored-by: Name2 <email2>
```
The [Cassandra Jira](https://issues.apache.org/jira/projects/CASSANDRA/issues/)
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: pr-unsubscribe@cassandra.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: pr-unsubscribe@cassandra.apache.org
For additional commands, e-mail: pr-help@cassandra.apache.org
Re: [PR] CASSANDRA-20527; Avoid NPE during cms initialization abort [cassandra]
Posted by "dcapwell (via GitHub)" <gi...@apache.org>.
dcapwell commented on code in PR #4049:
URL: https://github.com/apache/cassandra/pull/4049#discussion_r2029456246
##########
src/java/org/apache/cassandra/tcm/migration/Election.java:
##########
@@ -243,9 +243,11 @@ public class AbortHandler implements IVerbHandler<CMSInitializationRequest.Initi
public void doVerb(Message<CMSInitializationRequest.Initiator> message) throws IOException
{
logger.info("Received election abort message {} from {}", message.payload, message.from());
- CMSInitializationRequest.Initiator initiator = message.payload;
- if (!initiator.initiator.equals(initiator().initiator) || !updateInitiator(message.payload, null))
- logger.error("Could not clear initiator - initiator is set to {}, abort message received from {}", initiator(), message.payload);
+ CMSInitializationRequest.Initiator remoteInitiator = message.payload;
+ if (initiator() == null)
+ logger.info("Initiator already cleared, ignoring abort message from {}: {}", message.from(), remoteInitiator);
+ else if (!remoteInitiator.endpoint.equals(initiator().endpoint) || !updateInitiator(remoteInitiator, null))
Review Comment:
backported this to cep-15-accord as I was about to fix the NPE then found out about this patch. This doesn't seem to fix the NPE for me
```
Suppressed: java.lang.NullPointerException
at org.apache.cassandra.tcm.migration.Election$AbortHandler.doVerb(Election.java:246)
at org.apache.cassandra.net.InboundSink.lambda$new$0(InboundSink.java:102)
at org.apache.cassandra.net.InboundSink$Filtered.accept(InboundSink.java:70)
at org.apache.cassandra.net.InboundSink$Filtered.accept(InboundSink.java:56)
at org.apache.cassandra.net.InboundSink.accept(InboundSink.java:122)
at org.apache.cassandra.net.InboundSink.accept(InboundSink.java:51)
```
The issue looks to be
```
private static final CMSInitializationRequest.Initiator MIGRATING = new CMSInitializationRequest.Initiator(null, null);
private static final CMSInitializationRequest.Initiator MIGRATED = new CMSInitializationRequest.Initiator(null, null);
```
so these fields are both nullable (though not documented).
This fails 100% of the time for me in `org.apache.cassandra.distributed.upgrade.ClusterMetadataUpgradeAbortMigrationTest`
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: pr-unsubscribe@cassandra.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: pr-unsubscribe@cassandra.apache.org
For additional commands, e-mail: pr-help@cassandra.apache.org
Re: [PR] CASSANDRA-20527; Avoid NPE during cms initialization abort [cassandra]
Posted by "krummas (via GitHub)" <gi...@apache.org>.
krummas closed pull request #4049: CASSANDRA-20527; Avoid NPE during cms initialization abort
URL: https://github.com/apache/cassandra/pull/4049
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: pr-unsubscribe@cassandra.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: pr-unsubscribe@cassandra.apache.org
For additional commands, e-mail: pr-help@cassandra.apache.org
Re: [PR] CASSANDRA-20527; Avoid NPE during cms initialization abort [cassandra]
Posted by "maedhroz (via GitHub)" <gi...@apache.org>.
maedhroz commented on code in PR #4049:
URL: https://github.com/apache/cassandra/pull/4049#discussion_r2029470748
##########
src/java/org/apache/cassandra/tcm/migration/Election.java:
##########
@@ -243,9 +243,11 @@ public class AbortHandler implements IVerbHandler<CMSInitializationRequest.Initi
public void doVerb(Message<CMSInitializationRequest.Initiator> message) throws IOException
{
logger.info("Received election abort message {} from {}", message.payload, message.from());
- CMSInitializationRequest.Initiator initiator = message.payload;
- if (!initiator.initiator.equals(initiator().initiator) || !updateInitiator(message.payload, null))
- logger.error("Could not clear initiator - initiator is set to {}, abort message received from {}", initiator(), message.payload);
+ CMSInitializationRequest.Initiator remoteInitiator = message.payload;
+ if (initiator() == null)
+ logger.info("Initiator already cleared, ignoring abort message from {}: {}", message.from(), remoteInitiator);
+ else if (!remoteInitiator.endpoint.equals(initiator().endpoint) || !updateInitiator(remoteInitiator, null))
Review Comment:
I don't see the NPE being generated on `trunk`. Might be a dtest JAR building issue?
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: pr-unsubscribe@cassandra.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: pr-unsubscribe@cassandra.apache.org
For additional commands, e-mail: pr-help@cassandra.apache.org
Re: [PR] CASSANDRA-20527; Avoid NPE during cms initialization abort [cassandra]
Posted by "dcapwell (via GitHub)" <gi...@apache.org>.
dcapwell commented on code in PR #4049:
URL: https://github.com/apache/cassandra/pull/4049#discussion_r2029466914
##########
src/java/org/apache/cassandra/tcm/migration/CMSInitializationRequest.java:
##########
@@ -109,12 +109,12 @@ public long serializedSize(CMSInitializationRequest t, int version)
public static class Initiator
{
public static final Serializer serializer = new Serializer();
- public final InetAddressAndPort initiator;
+ public final InetAddressAndPort endpoint;
Review Comment:
can we annotate `@Nullable`? Its null here `org.apache.cassandra.tcm.migration.Election#MIGRATING`
##########
src/java/org/apache/cassandra/tcm/migration/CMSInitializationRequest.java:
##########
@@ -109,12 +109,12 @@ public long serializedSize(CMSInitializationRequest t, int version)
public static class Initiator
{
public static final Serializer serializer = new Serializer();
- public final InetAddressAndPort initiator;
+ public final InetAddressAndPort endpoint;
public final UUID initToken;
Review Comment:
can we annotate `@Nullable`? Its null here `org.apache.cassandra.tcm.migration.Election#MIGRATING`
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: pr-unsubscribe@cassandra.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: pr-unsubscribe@cassandra.apache.org
For additional commands, e-mail: pr-help@cassandra.apache.org
Re: [PR] CASSANDRA-20527; Avoid NPE during cms initialization abort [cassandra]
Posted by "dcapwell (via GitHub)" <gi...@apache.org>.
dcapwell commented on code in PR #4049:
URL: https://github.com/apache/cassandra/pull/4049#discussion_r2029456246
##########
src/java/org/apache/cassandra/tcm/migration/Election.java:
##########
@@ -243,9 +243,11 @@ public class AbortHandler implements IVerbHandler<CMSInitializationRequest.Initi
public void doVerb(Message<CMSInitializationRequest.Initiator> message) throws IOException
{
logger.info("Received election abort message {} from {}", message.payload, message.from());
- CMSInitializationRequest.Initiator initiator = message.payload;
- if (!initiator.initiator.equals(initiator().initiator) || !updateInitiator(message.payload, null))
- logger.error("Could not clear initiator - initiator is set to {}, abort message received from {}", initiator(), message.payload);
+ CMSInitializationRequest.Initiator remoteInitiator = message.payload;
+ if (initiator() == null)
+ logger.info("Initiator already cleared, ignoring abort message from {}: {}", message.from(), remoteInitiator);
+ else if (!remoteInitiator.endpoint.equals(initiator().endpoint) || !updateInitiator(remoteInitiator, null))
Review Comment:
backported this to cep-15-accord as I was about to fix the NPE then found out about this patch. This doesn't seem to fix the NPE for me
```
Suppressed: java.lang.NullPointerException
at org.apache.cassandra.tcm.migration.Election$AbortHandler.doVerb(Election.java:246)
at org.apache.cassandra.net.InboundSink.lambda$new$0(InboundSink.java:102)
at org.apache.cassandra.net.InboundSink$Filtered.accept(InboundSink.java:70)
at org.apache.cassandra.net.InboundSink$Filtered.accept(InboundSink.java:56)
at org.apache.cassandra.net.InboundSink.accept(InboundSink.java:122)
at org.apache.cassandra.net.InboundSink.accept(InboundSink.java:51)
```
The issue looks to be
```
private static final CMSInitializationRequest.Initiator MIGRATING = new CMSInitializationRequest.Initiator(null, null);
private static final CMSInitializationRequest.Initiator MIGRATED = new CMSInitializationRequest.Initiator(null, null);
```
so these fields are both nullable (though not documented).
This fails 100% of the time for me in `org.apache.cassandra.distributed.upgrade.ClusterMetadataUpgradeAbortMigrationTest`
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: pr-unsubscribe@cassandra.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: pr-unsubscribe@cassandra.apache.org
For additional commands, e-mail: pr-help@cassandra.apache.org