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

8297276: Remove thread text from Subject.current #11292

Closed
wants to merge 1 commit into from

Conversation

wangweij
Copy link
Contributor

@wangweij wangweij commented Nov 22, 2022

With the introduction of Virtual Threads, the current subject is no longer guaranteed to be inherited in a new thread. Remove this requirement until we find another way to implement Subject::current.


Progress

  • Change must be properly reviewed (1 review required, with at least 1 Reviewer)
  • Change must not contain extraneous whitespace
  • Commit message must refer to an issue
  • Change requires a CSR request to be approved

Issues

  • JDK-8297276: Remove thread text from Subject.current
  • JDK-8297351: Remove thread text from Subject.current (CSR)

Reviewers

Reviewing

Using git

Checkout this PR locally:
$ git fetch https://git.openjdk.org/jdk pull/11292/head:pull/11292
$ git checkout pull/11292

Update a local copy of the PR:
$ git checkout pull/11292
$ git pull https://git.openjdk.org/jdk pull/11292/head

Using Skara CLI tools

Checkout this PR locally:
$ git pr checkout 11292

View PR using the GUI difftool:
$ git pr show -t 11292

Using diff file

Download this PR as a diff file:
https://git.openjdk.org/jdk/pull/11292.diff

@bridgekeeper
Copy link

bridgekeeper bot commented Nov 22, 2022

👋 Welcome back weijun! A progress list of the required criteria for merging this PR into master will be added to the body of your pull request. There are additional pull request commands available for use with this pull request.

@openjdk openjdk bot added the rfr Pull request is ready for review label Nov 22, 2022
@openjdk
Copy link

openjdk bot commented Nov 22, 2022

@wangweij The following label will be automatically applied to this pull request:

  • security

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.

@openjdk openjdk bot added the security security-dev@openjdk.org label Nov 22, 2022
@mlbridge
Copy link

mlbridge bot commented Nov 22, 2022

Webrevs

@openjdk openjdk bot added the csr Pull request needs approved CSR before integration label Nov 22, 2022
@@ -325,10 +325,6 @@ public Subject run() {
* retrieved by this method. After {@code action} is finished, the current
* subject is reset to its previous value. The current
* subject is {@code null} before the first call of {@code callAs()}.
* <p>
* When a new thread is created, its current subject is the same as
Copy link
Member

Choose a reason for hiding this comment

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

what about change from"when" to "if", in case some implementation still create a new thread?

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 is not about the implementation of this method, which might or might not allow the current subject to be inherited in a new thread. The spec change is telling the users of this method that such inheritance is no longer guaranteed. We are still not sure if the future implementation of this method can guarantee that, but given it's already broken now, we'd better remove this requirement. We can add if later if we can do that.

Copy link
Member

Choose a reason for hiding this comment

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

Hm, it may still apply if the current subject to be inherited in a new thread. I fine to remove this section. A release note and known issue may be filed to notify the behavior change and issue.

Copy link
Contributor

@RogerRiggs RogerRiggs left a comment

Choose a reason for hiding this comment

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

LGTM, dropping the inaccurate text. A release note is a good idea.

@AlanBateman
Copy link
Contributor

Just re-reading the javadoc for Subject.callAs. It doesn't say anything about inheritance so there shouldn't be any expectation that Subject is inherited, so I think the change proposed here is okay. For another PR but I think the callAs javadoc could say a bit more about the Subject being set for the bounded execution of the given task. When the task completes, the current Subject is null or reverts to its previous value in the current thread.

@wangweij
Copy link
Contributor Author

@AlanBateman You are right. The callAs method is very short and only mentions "the current subject". My original idea is to describe everything about what "the current subject" means inside the current() method, which now talks about how it's set and reset. Do you think it's clearer to duplicate some of these words in callAs as well? Both the two methods currently have a @see pointing to the other.

@openjdk openjdk bot removed the csr Pull request needs approved CSR before integration label Nov 28, 2022
@openjdk
Copy link

openjdk bot commented Nov 28, 2022

@wangweij 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:

8297276: Remove thread text from Subject.current

Reviewed-by: xuelei, rriggs, mullan

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 72 new commits pushed to the master branch:

  • cdf9ed0: 8297528: java/io/File/TempDirDoesNotExist.java test failing on windows-x64
  • 105d9d7: 8295351: java/lang/Float/Binary16Conversion.java fails with "Unexpected result of converting"
  • a80552e: 8236919: Refactor com.sun.tools.javac.main.CommandLine into a reusable module for other JDK tools
  • a249a52: 8296754: AutoCreateSharedArchive in JDK 20 is not compatible with JDK 19
  • 405b188: 8297570: jdk/jfr/threading/TestDeepVirtualStackTrace.java fails with -XX:-UseTLAB
  • ba0a252: 8297717: Remove jdk/internal/misc/TerminatingThreadLocal/TestTerminatingThreadLocal.java from ProblemList
  • c05dc80: 8297660: x86: Redundant test+jump in C1 allocateArray
  • eff4c03: 8297343: TestStress*.java fail with "got different traces for the same seed"
  • 6a856bc: 8297499: Parallel: Missing iteration over klass when marking objArrays/objArrayOops during Full GC
  • b80f5af: 8297309: Memory leak in ShenandoahFullGC
  • ... and 62 more: https://git.openjdk.org/jdk/compare/0ac5b55311222d0531c9cfcec8c74932661b1750...master

As there are no conflicts, your changes will automatically be rebased on top of these commits when integrating. If you prefer to avoid this automatic rebasing, please check the documentation for the /integrate command for further details.

➡️ To integrate this PR with the above commit message to the master branch, type /integrate in a new comment.

@openjdk openjdk bot added the ready Pull request is ready to be integrated label Nov 28, 2022
@wangweij
Copy link
Contributor Author

/integrate

@openjdk
Copy link

openjdk bot commented Nov 28, 2022

Going to push as commit d450314.
Since your change was applied there have been 72 commits pushed to the master branch:

  • cdf9ed0: 8297528: java/io/File/TempDirDoesNotExist.java test failing on windows-x64
  • 105d9d7: 8295351: java/lang/Float/Binary16Conversion.java fails with "Unexpected result of converting"
  • a80552e: 8236919: Refactor com.sun.tools.javac.main.CommandLine into a reusable module for other JDK tools
  • a249a52: 8296754: AutoCreateSharedArchive in JDK 20 is not compatible with JDK 19
  • 405b188: 8297570: jdk/jfr/threading/TestDeepVirtualStackTrace.java fails with -XX:-UseTLAB
  • ba0a252: 8297717: Remove jdk/internal/misc/TerminatingThreadLocal/TestTerminatingThreadLocal.java from ProblemList
  • c05dc80: 8297660: x86: Redundant test+jump in C1 allocateArray
  • eff4c03: 8297343: TestStress*.java fail with "got different traces for the same seed"
  • 6a856bc: 8297499: Parallel: Missing iteration over klass when marking objArrays/objArrayOops during Full GC
  • b80f5af: 8297309: Memory leak in ShenandoahFullGC
  • ... and 62 more: https://git.openjdk.org/jdk/compare/0ac5b55311222d0531c9cfcec8c74932661b1750...master

Your commit was automatically rebased without conflicts.

@openjdk openjdk bot added the integrated Pull request has been integrated label Nov 28, 2022
@openjdk openjdk bot closed this Nov 28, 2022
@openjdk openjdk bot removed ready Pull request is ready to be integrated rfr Pull request is ready for review labels Nov 28, 2022
@openjdk
Copy link

openjdk bot commented Nov 28, 2022

@wangweij Pushed as commit d450314.

💡 You may see a message that your pull request was closed with unmerged commits. This can be safely ignored.

@wangweij wangweij deleted the 8297276 branch November 29, 2022 13:42
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
integrated Pull request has been integrated security security-dev@openjdk.org
Development

Successfully merging this pull request may close these issues.

5 participants