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

Update ExecutorScalingQueue to workaround LinkedTransferQueue JDK bug #104347

Merged
merged 11 commits into from
Jan 16, 2024

Conversation

ChrisHegarty
Copy link
Contributor

@ChrisHegarty ChrisHegarty commented Jan 13, 2024

This commit adds a few overrides to ExecutorScalingQueue (subclass of LinkedTransferQueue) to workaround a JDK bug in LinkedTransferQueue [1]. Without this change tasks submitted to the executor service vanish!

The underlying issue is a JDK bug (or at least an unexpected change in behaviour), regardless of whether or not that JDK bug gets fixed, the next scheduled JDK update release, 21.0.2, has the issue. So for ES to run on this JDK release we'll need the workaround proposed in this PR.

relates #103963

Closes #104067
Closes #104103

[1] https://bugs.openjdk.org/browse/JDK-8323659

@elasticsearchmachine
Copy link
Collaborator

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

@Override
public void put(E e) {
boolean added = super.offer(e);
assert added;
Copy link
Contributor Author

Choose a reason for hiding this comment

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

This works because LTQ is unbounded, offer will always succeed.

Copy link
Contributor

Choose a reason for hiding this comment

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

👍 maybe add this as a code comment

@ChrisHegarty
Copy link
Contributor Author

@elasticmachine update branch

@ChrisHegarty
Copy link
Contributor Author

@elasticmachine update branch

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.

Since this is delicate, you probably want to wait for approval from the people you listed. Anyway thanks to the linked docs I was able to figure out why the change is needed, and it looks good to me.

@ChrisHegarty
Copy link
Contributor Author

@elasticmachine update branch

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.

Looks good to me too, I left a few superficial suggestions/comments

@Override
public void put(E e) {
boolean added = super.offer(e);
assert added;
Copy link
Contributor

Choose a reason for hiding this comment

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

👍 maybe add this as a code comment

ChrisHegarty and others added 4 commits January 16, 2024 09:50
…EsExecutorsTests.java

Co-authored-by: David Turner <david.turner@elastic.co>
…EsExecutorsTests.java

Co-authored-by: David Turner <david.turner@elastic.co>
…EsExecutorsTests.java

Co-authored-by: David Turner <david.turner@elastic.co>
@ChrisHegarty
Copy link
Contributor Author

Thanks for the detailed review comments @DaveCTurner, I think that I've addressed all of them. Please take another look.

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.

LGTM

@ChrisHegarty
Copy link
Contributor Author

@elasticmachine update branch

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

@ChrisHegarty ChrisHegarty merged commit 81ec404 into elastic:main Jan 16, 2024
15 checks passed
@ChrisHegarty ChrisHegarty added the auto-backport Automatically create backport pull requests when merged label Jan 16, 2024
ChrisHegarty added a commit to ChrisHegarty/elasticsearch that referenced this pull request Jan 16, 2024
…elastic#104347)

This commit adds a few overrides to ExecutorScalingQueue (subclass of LinkedTransferQueue) to workaround a JDK bug in LinkedTransferQueue.
@elasticsearchmachine
Copy link
Collaborator

💚 Backport successful

Status Branch Result
7.17
8.12
8.11

ChrisHegarty added a commit to ChrisHegarty/elasticsearch that referenced this pull request Jan 16, 2024
…elastic#104347)

This commit adds a few overrides to ExecutorScalingQueue (subclass of LinkedTransferQueue) to workaround a JDK bug in LinkedTransferQueue.
ChrisHegarty added a commit to ChrisHegarty/elasticsearch that referenced this pull request Jan 16, 2024
…elastic#104347)

This commit adds a few overrides to ExecutorScalingQueue (subclass of LinkedTransferQueue) to workaround a JDK bug in LinkedTransferQueue.
costin pushed a commit to costin/elasticsearch that referenced this pull request Jan 17, 2024
…elastic#104347)

This commit adds a few overrides to ExecutorScalingQueue (subclass of LinkedTransferQueue) to workaround a JDK bug in LinkedTransferQueue.
jedrazb pushed a commit to jedrazb/elasticsearch that referenced this pull request Jan 17, 2024
…elastic#104347)

This commit adds a few overrides to ExecutorScalingQueue (subclass of LinkedTransferQueue) to workaround a JDK bug in LinkedTransferQueue.
ChrisHegarty added a commit that referenced this pull request Jan 17, 2024
…#104347) (#104426)

This commit adds a few overrides to ExecutorScalingQueue (subclass of LinkedTransferQueue) to workaround a JDK bug in LinkedTransferQueue.
ChrisHegarty added a commit that referenced this pull request Jan 17, 2024
…#104347) (#104427)

This commit adds a few overrides to ExecutorScalingQueue (subclass of LinkedTransferQueue) to workaround a JDK bug in LinkedTransferQueue.
elasticsearchmachine pushed a commit that referenced this pull request Jan 17, 2024
…JDK bug (#104347) (#104425)

* Update ExecutorScalingQueue to workaround LinkedTransferQueue JDK bug (#104347)

This commit adds a few overrides to ExecutorScalingQueue (subclass of LinkedTransferQueue) to workaround a JDK bug in LinkedTransferQueue.

* remove usage of var

* fix compilation
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 >refactoring Team:Core/Infra Meta label for core/infra team v7.17.17 v8.11.5 v8.12.1 v8.13.0
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[CI] ClientYamlTestSuiteIT classMethod failing [CI] XPackRestIT classMethod failing
6 participants