Skip to content

Commit c977360

Browse files
authored
[8.15][ML] Prevent NPE if model assignment is removed while waiting to start (#115430) (#116191)
1 parent 9647853 commit c977360

File tree

2 files changed

+10
-1
lines changed

2 files changed

+10
-1
lines changed

docs/changelog/115430.yaml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
pr: 115430
2+
summary: Prevent NPE if model assignment is removed while waiting to start
3+
area: Machine Learning
4+
type: bug
5+
issues: []

x-pack/plugin/ml/src/main/java/org/elasticsearch/xpack/ml/action/TransportStartTrainedModelDeploymentAction.java

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -668,7 +668,11 @@ public boolean test(ClusterState clusterState) {
668668
deploymentId
669669
).orElse(null);
670670
if (trainedModelAssignment == null) {
671-
// Something weird happened, it should NEVER be null...
671+
// The assignment may be null if it was stopped by another action while waiting
672+
this.exception = new ElasticsearchStatusException(
673+
"Error waiting for the model deployment to start. The trained model assignment was removed while waiting",
674+
RestStatus.BAD_REQUEST
675+
);
672676
logger.trace(() -> format("[%s] assignment was null while waiting for state [%s]", deploymentId, waitForState));
673677
return true;
674678
}

0 commit comments

Comments
 (0)