-
Notifications
You must be signed in to change notification settings - Fork 5.8k
8323659: LinkedTransferQueue add and put methods call overridable offer #17393
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
Conversation
👋 Welcome back chegar! A progress list of the required criteria for merging this PR into |
@ChrisHegarty The following label will be automatically applied to this pull request:
When this pull request is ready to be reviewed, an "RFR" email will be sent to the corresponding mailing list. If you would like to change these labels, use the /label pull request command. |
/issue add JDK-8323659 |
@ChrisHegarty The primary solved issue for a PR is set through the PR title. Since the current title does not contain an issue reference, it will now be updated. |
Webrevs
|
This feels more like a hazard when extending to override behavior. I think it would be useful to provide a summary on what the override wants to do, maybe there are better ways to customise by wrapping the LTQ rather than subclassing. |
A process-related comment: this PR is against mainline, but the issue's Fix Version/s is 22. This will create a bit of a mess if integrated. |
Yeah, this is certainly a potential issue with any subclass-able class. I remember seeing similar before in other areas too.
Yeah, and we can likely refactor our code to workaround this change in JDK 22. I added a summary and reproducer in the JIRA, which should help. I'll try to explain a little here. The crux of what the code is attempting to do is to scale the executor to max pool size by refusing tasks if there the pool is less than the max, then later intercepting rejections and putting the task on the queue. |
Thanks for the reminder Pavel. If accepted, then the change will be applicable to 23, 22, and 21. 0.2. I'll fix up and retarget the appropriate branches, repos, once we agree a way forward. |
I updated the fix version in JIRA, and followed the process as outlined in https://mail.openjdk.org/pipermail/jdk-dev/2023-December/008560.html |
@ChrisHegarty My 2¢—this change could impact existing classes which have extended LTQ and knowingly, or unknowingly, presume that add and put delegate to offer, which would (silently) break those classes when running on a newer JDK (presuming this change gets merged). I think the change is in principle correct, with that said, I want to make sure that the change is worth the potential compatibility risk (if any). |
Hi @viktorklang-ora , I agree with your comment regarding the potential impact, and the assumption of the implementation, however, you got it the wrong way round! ;-) The change I am proposing restores previous behaviour to pre-JDK 22. It is JDK 22 that has changed this. This is exactly why I am proposing the change |
@ChrisHegarty 😅 Well then I agree |
FTR - I agree that it's kinda annoying to be proposing this change and it is true that the consuming user code is making an assumption, but the impact of this is significant - leads to apparently vanishing tasks when Elasticsearch runs on JDK 22 EA. The proposed changes are extremely minimal. If @DougLea agrees, then I'll add a minimal test case and get the PR into a clean state. |
Additionally, we absolutely need to fix this in JDK 21.0.2 - since a patch release should not change behaviour (from 21.0.1), in this way. |
src/java.base/share/classes/java/util/concurrent/LinkedTransferQueue.java
Show resolved
Hide resolved
With my CSR hat on, JDK-8301341 should never have made the changes it did without going through a CSR request. We have been bitten by this kind of problem many times. Unless a public method is specified to utilise another public method, we should never implement one public method in terms of another (non-final one) due to the overriding problem. Backporting such a change to 21u is then potentially very damaging. |
src/java.base/share/classes/java/util/concurrent/LinkedTransferQueue.java
Outdated
Show resolved
Hide resolved
…rQueue.java Co-authored-by: Andrey Turbanov <turbanoff@gmail.com>
JDK-8301341 was a big update, a lot of refactoring to hollow out SQ and it was just an oversight that we didn't spot the methods now use an overridable method. It's something to always look out for in the collections area, just missed here. |
It's unfortunate that we're only discovering this now, since 21.0.2 is scheduled to release tomorrow, Jan 16th, and we've not yet gotten this reviewed and merged into master or jdk22 yet. We can decided how to proceed with the backports once this PR has agreed the approach and is reviewed. |
Sorry for needlessly calling overridable versions in these two cases. I should have caught that. |
No problem, easy to overlook. I assume you are ok with the changes? If so, could I please ask you to add your review. Otherwise, is there another way that we should proceed? |
@ChrisHegarty This change now passes all automated pre-integration checks. ℹ️ This project also has non-automated pre-integration requirements. Please see the file CONTRIBUTING.md for details. After integration, the commit message for the final commit will be:
You can use pull request commands such as /summary, /contributor and /issue to adjust it as needed. At the time when this comment was updated there had been no new commits pushed to the ➡️ To integrate this PR with the above commit message to the |
Yes, the change looks right to me -- changing the only two calls that could matter here. |
Thanks for the reviews @AlanBateman and @DougLea |
/integrate |
Going to push as commit ee4d9aa.
Your commit was automatically rebased without conflicts. |
@ChrisHegarty Pushed as commit ee4d9aa. 💡 You may see a message that your pull request was closed with unmerged commits. This can be safely ignored. |
We can and have run retroactive CSRs in cases like this before; I recommend we do one now. |
Yes although the issue will be mute once JDK-8323659 is integrated into jdk22. |
I just integrated the fix into jdk 22, so we’re good there now. The final piece of the puzzle is jdk 21.0.2, which we’re too late to fix. We can add a release note, and fix it in 21.0.3. Any objections or alternative suggestions? |
Update LinkedTransferQueue add and put methods to not call overridable offer.
Progress
Issue
Reviewers
Reviewing
Using
git
Checkout this PR locally:
$ git fetch https://git.openjdk.org/jdk.git pull/17393/head:pull/17393
$ git checkout pull/17393
Update a local copy of the PR:
$ git checkout pull/17393
$ git pull https://git.openjdk.org/jdk.git pull/17393/head
Using Skara CLI tools
Checkout this PR locally:
$ git pr checkout 17393
View PR using the GUI difftool:
$ git pr show -t 17393
Using diff file
Download this PR as a diff file:
https://git.openjdk.org/jdk/pull/17393.diff
Webrev
Link to Webrev Comment