Skip to content

Prevent large CancelTasksRequest descriptions by truncating nodes and actions#141815

Merged
drempapis merged 4 commits intoelastic:mainfrom
drempapis:fix/limit-cancel-tasks-description-size
Feb 4, 2026
Merged

Prevent large CancelTasksRequest descriptions by truncating nodes and actions#141815
drempapis merged 4 commits intoelastic:mainfrom
drempapis:fix/limit-cancel-tasks-description-size

Conversation

@drempapis
Copy link
Contributor

Problem
When cancelling a potentially large number of tasks, CancelTasksRequest#getDescription() may return very large logging the full nodes and actions arrays. This can lead to unnecessary memory usage and increased GC pressure.

This change limits the number of elements included in the description to 10 items per array, appending a "... (N more)" suffix when truncation occurs.

closes #141740

@drempapis drempapis added >bug Team:Search Foundations Meta label for the Search Foundations team in Elasticsearch :Search Foundations/Search Catch all for Search Foundations v9.4.0 labels Feb 4, 2026
@drempapis drempapis requested a review from tteofili February 4, 2026 10:16
@elasticsearchmachine
Copy link
Collaborator

Pinging @elastic/es-search-foundations (Team:Search Foundations)

Copy link
Contributor

@tteofili tteofili left a comment

Choose a reason for hiding this comment

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

LGTM ;)

@drempapis drempapis added auto-backport Automatically create backport pull requests when merged v9.2.0 v9.3.0 v8.19.0 labels Feb 4, 2026
@drempapis
Copy link
Contributor Author

💔 Some backports could not be created

Status Branch Result
9.3
9.2
8.19 An unhandled error occurred. Please see the logs for details

Manual backport

To create the backport manually run:

backport --pr 141815

Questions ?

Please refer to the Backport tool documentation

drempapis added a commit to drempapis/elasticsearch that referenced this pull request Feb 4, 2026
drempapis added a commit to drempapis/elasticsearch that referenced this pull request Feb 4, 2026
kosabogi pushed a commit to kosabogi/elasticsearch that referenced this pull request Feb 4, 2026
elasticsearchmachine pushed a commit that referenced this pull request Feb 4, 2026
Copy link
Contributor

@DaveCTurner DaveCTurner left a comment

Choose a reason for hiding this comment

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

A possible alternative would be to use org.elasticsearch.common.Strings.BoundedDelimitedStringCollector (limits by string length rather than item count)

@drempapis
Copy link
Contributor Author

A possible alternative would be to use org.elasticsearch.common.Strings.BoundedDelimitedStringCollector (limits by string length rather than item count)

Thank you @DaveCTurner for the feedback. This approach sounds more appropriate. I’ll rework it based on this implementation.

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 :Search Foundations/Search Catch all for Search Foundations Team:Search Foundations Meta label for the Search Foundations team in Elasticsearch v8.19.0 v9.2.0 v9.3.0 v9.4.0

4 participants