Skip to content

Conversation

@jia-wei-tang
Copy link

@jia-wei-tang jia-wei-tang commented Jan 12, 2026

Hi, I create an issue in the bug system: https://bugs.openjdk.org/browse/JDK-8375001

NativeThread.currentNativeThread(); should be replaced by NativeThread.current();. Otherwise, when using virtual thread, the program will run into a wrong state.

Now, I just changed the function used in NativeTheadSet.java, but I did not delete the currentNativeThread in src/java.base/unix/classes/sun/nio/ch/NativeThread.java and src/java.base/windows/classes/sun/nio/ch/NativeThread.java . I am wondering if I should delete these functions since they are useless now. I hope to get some advice. Thank you!

Besides, the jtreg testcases which can produce this issue is from JDK-8310902 (with option: -testThreadFactory:Virtual -testThreadFactoryPath:./jtregTestThreadFactory.jar). Do I need to bring the testcase test/jdk/java/nio/channels/FileChannel/CloseDuringTransfer.java here?


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
  • JDK-8375001 needs maintainer approval

Issue

  • JDK-8375001: NativeThreadSet get wrong currentNativeThread when using virtual thread (Bug - P4)

Reviewing

Using git

Checkout this PR locally:
$ git fetch https://git.openjdk.org/jdk21u-dev.git pull/2542/head:pull/2542
$ git checkout pull/2542

Update a local copy of the PR:
$ git checkout pull/2542
$ git pull https://git.openjdk.org/jdk21u-dev.git pull/2542/head

Using Skara CLI tools

Checkout this PR locally:
$ git pr checkout 2542

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

Using diff file

Download this PR as a diff file:
https://git.openjdk.org/jdk21u-dev/pull/2542.diff

Using Webrev

Link to Webrev Comment

@bridgekeeper
Copy link

bridgekeeper bot commented Jan 12, 2026

👋 Welcome back jwtang! 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
Copy link

openjdk bot commented Jan 12, 2026

❗ This change is not yet ready to be integrated.
See the Progress checklist in the description for automated requirements.

@openjdk openjdk bot added the rfr Pull request is ready for review label Jan 12, 2026
@mlbridge
Copy link

mlbridge bot commented Jan 12, 2026

Webrevs

@jerboaa
Copy link
Contributor

jerboaa commented Jan 13, 2026

This should probably fixed with a backport of https://bugs.openjdk.org/browse/JDK-8321594 instead.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

rfr Pull request is ready for review

Development

Successfully merging this pull request may close these issues.

2 participants