Skip to content
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

Identify system threads using a Thread subclass #113562

Merged

Conversation

carlosdelest
Copy link
Member

@carlosdelest carlosdelest commented Sep 25, 2024

Part of the work in #113194

Identifies system threads by using a dedicated Thread subclass, EsThread.

EsExecutor includes a isSystem attribute that gets populated on creation according to the executor name. This attribute is used to flag the threads the executor creates.

A isSystem attribute in the EsThread class can be checked for understanding if a thread is a system thread.

@carlosdelest carlosdelest changed the title New EsThread class to Identify system threads Identify system threads using a Thread subclass Sep 26, 2024
@carlosdelest carlosdelest marked this pull request as ready for review September 30, 2024 06:37
@carlosdelest carlosdelest requested a review from a team as a code owner September 30, 2024 06:37
@elasticsearchmachine elasticsearchmachine added the needs:triage Requires assignment of a team area label label Sep 30, 2024
@carlosdelest carlosdelest added >non-issue Team:Search Foundations Meta label for the Search Foundations team in Elasticsearch and removed needs:triage Requires assignment of a team area label labels Sep 30, 2024
@elasticsearchmachine elasticsearchmachine added needs:triage Requires assignment of a team area label and removed Team:Search Foundations Meta label for the Search Foundations team in Elasticsearch labels Sep 30, 2024
@carlosdelest carlosdelest added Team:Search Foundations Meta label for the Search Foundations team in Elasticsearch :Search Foundations/Search Catch all for Search Foundations labels Sep 30, 2024
@elasticsearchmachine
Copy link
Collaborator

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

@elasticsearchmachine elasticsearchmachine removed the needs:triage Requires assignment of a team area label label Sep 30, 2024
@carlosdelest carlosdelest added needs:triage Requires assignment of a team area label auto-backport Automatically create backport pull requests when merged v8.16.0 labels Sep 30, 2024
@elasticsearchmachine elasticsearchmachine removed the needs:triage Requires assignment of a team area label label Sep 30, 2024
Copy link
Member

@original-brownbear original-brownbear left a comment

Choose a reason for hiding this comment

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

I like this. I think core-infra should also be ok with it. It would be good however if we could pass the isSystem value via a boolean. Not just for aesthetic reasons, but as mentioned I think there's other things we can do with subclassing Thread here and it would be nice to start in a clean way :)

this.namePrefix = namePrefix;
SecurityManager s = System.getSecurityManager();
group = (s != null) ? s.getThreadGroup() : Thread.currentThread().getThreadGroup();
isSystem = executorName != null && SYSTEM_THREAD_PREFIXES.contains(executorName);
Copy link
Member

Choose a reason for hiding this comment

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

I know I did this too in my prototype, but you have to admit it's a little lame? Think we could maybe pass the isSystem property through the steps of building the executor via a boolean flag?

Copy link
Member Author

Choose a reason for hiding this comment

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

Makes sense - removed dependency on naming in 71a0d28

@carlosdelest
Copy link
Member Author

@elasticmachine update branch

@carlosdelest carlosdelest added Team:Core/Infra Meta label for core/infra team :Core/Infra/Core Core issues without another label labels Oct 17, 2024
@elasticsearchmachine
Copy link
Collaborator

Pinging @elastic/es-core-infra (Team:Core/Infra)

Copy link
Member

@rjernst rjernst left a comment

Choose a reason for hiding this comment

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

Looks ok to me

@carlosdelest carlosdelest merged commit bbd887a into elastic:main Oct 25, 2024
16 checks passed
@elasticsearchmachine
Copy link
Collaborator

💔 Backport failed

The backport operation could not be completed due to the following error:

An unexpected error occurred when attempting to backport this PR.

You can use sqren/backport to manually backport by running backport --upstream elastic/elasticsearch --pr 113562

@carlosdelest
Copy link
Member Author

💚 All backports created successfully

Status Branch Result
8.x

Questions ?

Please refer to the Backport tool documentation

carlosdelest added a commit to carlosdelest/elasticsearch that referenced this pull request Oct 25, 2024
carlosdelest added a commit that referenced this pull request Oct 25, 2024
jfreden pushed a commit to jfreden/elasticsearch that referenced this pull request Nov 4, 2024
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 backport pending :Core/Infra/Core Core issues without another label >non-issue :Search Foundations/Search Catch all for Search Foundations Team:Core/Infra Meta label for core/infra team Team:Search Foundations Meta label for the Search Foundations team in Elasticsearch v8.17.0 v9.0.0
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants