Skip to content

Conversation

@prdoyle
Copy link
Contributor

@prdoyle prdoyle commented Feb 11, 2025

Adds a manage_threads entitlements covering Thread.start() as well as various set methods for changing thread properties.

See ES-10358.

@prdoyle prdoyle added >non-issue :Core/Infra/Core Core issues without another label auto-backport Automatically create backport pull requests when merged test-entitlements v8.18.1 v8.19.0 v9.0.1 v9.1.0 labels Feb 11, 2025
@prdoyle prdoyle self-assigned this Feb 11, 2025
@prdoyle prdoyle force-pushed the simple-thread-properties branch from 53d2975 to 04b6e8e Compare February 12, 2025 12:01
@prdoyle prdoyle force-pushed the simple-thread-properties branch from 04b6e8e to 99ab3d9 Compare February 12, 2025 13:32
@prdoyle prdoyle marked this pull request as ready for review February 12, 2025 13:34
@elasticsearchmachine elasticsearchmachine added the Team:Core/Infra Meta label for core/infra team label Feb 12, 2025
@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 pretty good, just a couple things I think should be split out for separate discussion.

Copy link
Contributor

@ldematte ldematte left a comment

Choose a reason for hiding this comment

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

Looks good, just a couple of comments (nothing blocking I think)

getTestEntries(FileCheckActions.class),
getTestEntries(SpiActions.class),
getTestEntries(SystemActions.class),
getTestEntries(FileStoreActions.class),
Copy link
Contributor

Choose a reason for hiding this comment

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

Thanks for ordering this; maybe mention it to everyone so we keep it ordered (and help in reducing merge conflicts)

return channel -> {
logger.info("Calling check action [{}]", actionName);
checkAction.action().run();
logger.debug("Check action [{}] returned", actionName);
Copy link
Contributor

Choose a reason for hiding this comment

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

Intentional or leftover from debugging?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

At one point, I wanted to know whether the action actually returned, as opposed to throwing. By and large, when I add log statements during debugging, I don't remove them before merging because if they're helpful once, they're likely to be helpful again.

Copy link
Contributor

Choose a reason for hiding this comment

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

👍
Should we change the "matching" logger level too? (2 lines above) (if it makes sense)

}

throw new NotEntitledException(
notEntitled(
Copy link
Contributor

Choose a reason for hiding this comment

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

I'm not the biggest fan of this change tbh; it does not make things more readable, and it adds a frame to the stack trace I think?
Not blocking, but I preferred the way it was.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I did this so the throws are all done from one place in order to switch them all to reporting only in this commit. That reporting mode was really useful; I suspect we'll end up making that "for real" somehow and merging it, but I didn't do that in this PR.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I should say... in isolation, with no context, I agree with you and probably would have left the same review comment. 😂

Copy link
Contributor

Choose a reason for hiding this comment

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

Yes! :) thanks for the context, the change makes sense now

InboundNetworkEntitlement.class,
WriteSystemPropertiesEntitlement.class,
LoadNativeLibrariesEntitlement.class
LoadNativeLibrariesEntitlement.class,
Copy link
Contributor

Choose a reason for hiding this comment

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

Same; good that you ordered them, but please share with the team so we keep doing it.

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.

LGTM

@prdoyle prdoyle merged commit f8aa047 into elastic:main Feb 13, 2025
22 checks passed
@prdoyle prdoyle deleted the simple-thread-properties branch February 13, 2025 18:45
@elasticsearchmachine
Copy link
Collaborator

💔 Backport failed

Status Branch Result
8.18 Commit could not be cherrypicked due to conflicts
8.x Commit could not be cherrypicked due to conflicts
9.0

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

prdoyle added a commit to prdoyle/elasticsearch that referenced this pull request Feb 13, 2025
* Refactor: protected -> private

* Initial thread-related entitlements

* Entitlements from manual test runs

* Refactor: notEntitled method

* Entitlements reporting mode

* Entitlements from CI

* Revert "Entitlements reporting mode"

This reverts commit 443ca76.

* Remove unnecessary EntitledActions.newThread

* Don't log in entitlements ITs by default

* Import SuppressForbidden

* Respond to PR comments

* Move manage_threads tests to their own file
prdoyle added a commit to prdoyle/elasticsearch that referenced this pull request Feb 13, 2025
* Refactor: protected -> private

* Initial thread-related entitlements

* Entitlements from manual test runs

* Refactor: notEntitled method

* Entitlements reporting mode

* Entitlements from CI

* Revert "Entitlements reporting mode"

This reverts commit 443ca76.

* Remove unnecessary EntitledActions.newThread

* Don't log in entitlements ITs by default

* Import SuppressForbidden

* Respond to PR comments

* Move manage_threads tests to their own file
elasticsearchmachine pushed a commit that referenced this pull request Feb 13, 2025
* Refactor: protected -> private

* Initial thread-related entitlements

* Entitlements from manual test runs

* Refactor: notEntitled method

* Entitlements reporting mode

* Entitlements from CI

* Revert "Entitlements reporting mode"

This reverts commit 443ca76.

* Remove unnecessary EntitledActions.newThread

* Don't log in entitlements ITs by default

* Import SuppressForbidden

* Respond to PR comments

* Move manage_threads tests to their own file
elasticsearchmachine pushed a commit that referenced this pull request Feb 13, 2025
* Entitlements: manage_threads (#122261)

* Refactor: protected -> private

* Initial thread-related entitlements

* Entitlements from manual test runs

* Refactor: notEntitled method

* Entitlements reporting mode

* Entitlements from CI

* Revert "Entitlements reporting mode"

This reverts commit 443ca76.

* Remove unnecessary EntitledActions.newThread

* Don't log in entitlements ITs by default

* Import SuppressForbidden

* Respond to PR comments

* Move manage_threads tests to their own file

* Move ForkJoinPool.setParallelism to VersionSpecificManageThreadsActions

* [CI] Auto commit changes from spotless

---------

Co-authored-by: elasticsearchmachine <infra-root+elasticsearchmachine@elastic.co>
elasticsearchmachine pushed a commit that referenced this pull request Feb 13, 2025
* Entitlements: manage_threads (#122261)

* Refactor: protected -> private

* Initial thread-related entitlements

* Entitlements from manual test runs

* Refactor: notEntitled method

* Entitlements reporting mode

* Entitlements from CI

* Revert "Entitlements reporting mode"

This reverts commit 443ca76.

* Remove unnecessary EntitledActions.newThread

* Don't log in entitlements ITs by default

* Import SuppressForbidden

* Respond to PR comments

* Move manage_threads tests to their own file

* Move ForkJoinPool.setParallelism to VersionSpecificManageThreadsActions

* [CI] Auto commit changes from spotless

---------

Co-authored-by: elasticsearchmachine <infra-root+elasticsearchmachine@elastic.co>
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 :Core/Infra/Core Core issues without another label >non-issue Team:Core/Infra Meta label for core/infra team v8.18.1 v8.19.0 v9.0.1 v9.1.0

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants