Skip to content

Conversation

@davidkyle
Copy link
Member

The model download code checks for an existing download task by iterating over the currently running tasks comparing the task description. The call to getDescription() can sometimes throw- see the stack trace below.

This change rearranges the conditional check so that getDescription() is only called on instances of ModelDownloadTask.

Caused by: java.lang.UnsupportedOperationException: This should not be XContent serialized
	at [email protected]/org.elasticsearch.xpack.inference.rank.textsimilarity.TextSimilarityRankBuilder.doXContent(TextSimilarityRankBuilder.java:106)
	at [email protected]/org.elasticsearch.search.rank.RankBuilder.toXContent(RankBuilder.java:70)
	at [email protected]/org.elasticsearch.xcontent.XContentBuilder.value(XContentBuilder.java:993)
	at [email protected]/org.elasticsearch.xcontent.XContentBuilder.value(XContentBuilder.java:982)
	at [email protected]/org.elasticsearch.xcontent.XContentBuilder.field(XContentBuilder.java:974)
	at [email protected]/org.elasticsearch.search.builder.SearchSourceBuilder.innerToXContent(SearchSourceBuilder.java:1713)
	at [email protected]/org.elasticsearch.search.builder.SearchSourceBuilder.toXContent(SearchSourceBuilder.java:1852)
	at [email protected]/org.elasticsearch.common.xcontent.XContentHelper.toXContent(XContentHelper.java:653)
	at [email protected]/org.elasticsearch.common.xcontent.XContentHelper.toXContent(XContentHelper.java:633)
	at [email protected]/org.elasticsearch.search.builder.SearchSourceBuilder.toString(SearchSourceBuilder.java:2177)
	at [email protected]/org.elasticsearch.action.search.SearchRequest.buildDescription(SearchRequest.java:747)
	at java.base/java.util.stream.ReferencePipeline$3$1.accept(ReferencePipeline.java:215)
	at java.base/java.util.ArrayList$ArrayListSpliterator.forEachRemaining(ArrayList.java:1709)
	at java.base/java.util.stream.AbstractPipeline.copyInto(AbstractPipeline.java:570)
	at java.base/java.util.stream.AbstractPipeline.wrapAndCopyInto(AbstractPipeline.java:560)
	at java.base/java.util.stream.ReduceOps$ReduceOp.evaluateSequential(ReduceOps.java:921)
	at java.base/java.util.stream.AbstractPipeline.evaluate(AbstractPipeline.java:265)
	at java.base/java.util.stream.ReferencePipeline.collect(ReferencePipeline.java:727)
Caused by: java.lang.UnsupportedOperationException: This should not be XContent serialized

	at [email protected]/org.elasticsearch.action.search.MultiSearchRequest$1.getDescription(MultiSearchRequest.java:381)
	at org.elasticsearch.xpack.ml.packageloader.action.TransportLoadTrainedModelPackage.handleDownloadInProgress(TransportLoadTrainedModelPackage.java:154)

@elasticsearchmachine
Copy link
Collaborator

Pinging @elastic/ml-core (Team:ML)

@elasticsearchmachine elasticsearchmachine added the Team:ML Meta label for the ML team label Mar 10, 2025
@elasticsearchmachine
Copy link
Collaborator

Hi @davidkyle, I've created a changelog YAML for you.

@davidkyle davidkyle requested a review from Mikep86 March 10, 2025 21:42
Copy link
Member

@kderusso kderusso left a comment

Choose a reason for hiding this comment

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

Thanks for the fix! Could we please also add a test for this case?

Copy link
Contributor

@Mikep86 Mikep86 left a comment

Choose a reason for hiding this comment

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

Thanks for the quick turnaround on this! Agree with Kathleen that a test would be nice, but this is such a straightforward change that we could do it in a follow-up if we just want to get the fix live ASAP.

@davidkyle davidkyle merged commit 444b8ea into elastic:main Mar 11, 2025
16 of 17 checks passed
@Mikep86
Copy link
Contributor

Mikep86 commented Mar 11, 2025

💚 All backports created successfully

Status Branch Result
8.x
9.0
8.18

Questions ?

Please refer to the Backport tool documentation

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

Labels

auto-backport Automatically create backport pull requests when merged >bug :ml Machine learning Team:ML Meta label for the ML team v8.18.0 v8.19.0 v9.0.0 v9.1.0

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants