Skip to content

Prevent NullPointerException in TransportRolloverAction #43353

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

Merged
merged 1 commit into from
Jun 19, 2019

Conversation

dakrone
Copy link
Member

@dakrone dakrone commented Jun 18, 2019

It's possible for the passed in IndexMetaData to be null (for
instance, cluster state passed in does not have the index in its
metadata) which in turn can cause a NullPointerException when
evaluating the conditions for an index. This commit adds null protection
and unit tests for this case.

Resolves #43296

It's possible for the passed in `IndexMetaData` to be null (for
instance, cluster state passed in does not have the index in its
metadata) which in turn can cause a `NullPointerException` when
evaluating the conditions for an index. This commit adds null protection
and unit tests for this case.

Resolves elastic#43296
@elasticmachine
Copy link
Collaborator

Pinging @elastic/es-core-features

Copy link
Member

@martijnvg martijnvg left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

I don't think we need to backport top the 7.0 branch? That version line is no longer maintained.
Does this problem also exist in 6.8.0? If so then I think we should also backport to the 6.x branch.

Copy link
Member

@dnhatn dnhatn left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks @dakrone. I left a question.

@dakrone dakrone added v6.8.2 and removed v7.0.2 labels Jun 19, 2019
Copy link
Member

@dnhatn dnhatn left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@dakrone dakrone merged commit 4b1c133 into elastic:master Jun 19, 2019
dakrone added a commit to dakrone/elasticsearch that referenced this pull request Jun 19, 2019
It's possible for the passed in `IndexMetaData` to be null (for
instance, cluster state passed in does not have the index in its
metadata) which in turn can cause a `NullPointerException` when
evaluating the conditions for an index. This commit adds null protection
and unit tests for this case.

Resolves elastic#43296
dakrone added a commit to dakrone/elasticsearch that referenced this pull request Jun 19, 2019
It's possible for the passed in `IndexMetaData` to be null (for
instance, cluster state passed in does not have the index in its
metadata) which in turn can cause a `NullPointerException` when
evaluating the conditions for an index. This commit adds null protection
and unit tests for this case.

Resolves elastic#43296
@dakrone dakrone deleted the fix-rollover-npe branch June 19, 2019 21:59
dakrone added a commit that referenced this pull request Jun 19, 2019
#43397)

It's possible for the passed in `IndexMetaData` to be null (for
instance, cluster state passed in does not have the index in its
metadata) which in turn can cause a `NullPointerException` when
evaluating the conditions for an index. This commit adds null protection
and unit tests for this case.

Resolves #43296
dakrone added a commit that referenced this pull request Jun 19, 2019
#43398)

It's possible for the passed in `IndexMetaData` to be null (for
instance, cluster state passed in does not have the index in its
metadata) which in turn can cause a `NullPointerException` when
evaluating the conditions for an index. This commit adds null protection
and unit tests for this case.

Resolves #43296
dakrone added a commit to dakrone/elasticsearch that referenced this pull request Aug 23, 2019
It's possible for the passed in `IndexMetaData` to be null (for
instance, cluster state passed in does not have the index in its
metadata) which in turn can cause a `NullPointerException` when
evaluating the conditions for an index. This commit adds null protection
and unit tests for this case.

Resolves elastic#43296
@dakrone dakrone added the v6.8.3 label Aug 23, 2019
dakrone added a commit that referenced this pull request Aug 23, 2019
)

It's possible for the passed in `IndexMetaData` to be null (for
instance, cluster state passed in does not have the index in its
metadata) which in turn can cause a `NullPointerException` when
evaluating the conditions for an index. This commit adds null protection
and unit tests for this case.

Resolves #43296
@cdenneen
Copy link

cdenneen commented Oct 2, 2020

@dakrone still seeing this in 6.8.6 is there any chance this was possibly reintroduced back after the 6.8.3 fix?

{
  "indices" : {
    "shrink-logstash-apfeed-000361" : {
      "index" : "shrink-logstash-apfeed-000361",
      "managed" : true,
      "policy" : "logging_policy",
      "lifecycle_date_millis" : 1599708150241,
      "phase" : "warm",
      "action" : "forcemerge",
      "action_time_millis" : 1599722444069,
      "step" : "ERROR",
      "step_time_millis" : 1600195055113,
      "failed_step" : "segment-count",
      "step_info" : {
        "type" : "null_pointer_exception",
        "reason" : null,
        "stack_trace" : """
java.lang.NullPointerException
	at org.elasticsearch.xpack.core.indexlifecycle.SegmentCountStep.lambda$evaluateCondition$2(SegmentCountStep.java:45)
	at org.elasticsearch.action.ActionListener$1.onResponse(ActionListener.java:61)
	at org.elasticsearch.action.support.ContextPreservingActionListener.onResponse(ContextPreservingActionListener.java:43)
	at org.elasticsearch.action.support.TransportAction$1.onResponse(TransportAction.java:85)
	at org.elasticsearch.action.support.TransportAction$1.onResponse(TransportAction.java:81)
	at org.elasticsearch.action.support.broadcast.node.TransportBroadcastByNodeAction$AsyncAction.onCompletion(TransportBroadcastByNodeAction.java:393)
	at org.elasticsearch.action.support.broadcast.node.TransportBroadcastByNodeAction$AsyncAction.onNodeFailure(TransportBroadcastByNodeAction.java:378)
	at org.elasticsearch.action.support.broadcast.node.TransportBroadcastByNodeAction$AsyncAction$1.handleException(TransportBroadcastByNodeAction.java:339)
	at org.elasticsearch.transport.TransportService$ContextRestoreResponseHandler.handleException(TransportService.java:1114)
	at org.elasticsearch.transport.TransportService.lambda$onConnectionClosed$8(TransportService.java:963)
	at org.elasticsearch.common.util.concurrent.ThreadContext$ContextPreservingRunnable.run(ThreadContext.java:681)
	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
	at java.lang.Thread.run(Thread.java:748)

"""
      }
    }
  }
}

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

Successfully merging this pull request may close these issues.

Rollover API errors out with NPE in some cases
6 participants