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

8347039: ThreadPerTaskExecutor terminates if cancelled tasks still running #23036

Closed
wants to merge 5 commits into from

Conversation

AlanBateman
Copy link
Contributor

@AlanBateman AlanBateman commented Jan 10, 2025

The thread-per-task-executor returned by Executors.newVirtualThreadPerTaskExecutor will terminate without waiting for threads that are still executing cancelled tasks. This is different to ThreadPoolExecutor and ForkJoinPool that wait for the threads to finish executing the cancelled tasks. Note that issue with TPTE is specific to Callable tasks, Runnable tasks are not impacted. The change is to override FutureTask.run instead of FutureTask.done. Test coverage is expanded to cover this case.


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

Issue

  • JDK-8347039: ThreadPerTaskExecutor terminates if cancelled tasks still running (Bug - P3)

Reviewers

Reviewing

Using git

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

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

Using Skara CLI tools

Checkout this PR locally:
$ git pr checkout 23036

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

Using diff file

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

Using Webrev

Link to Webrev Comment

Sorry, something went wrong.

@bridgekeeper
Copy link

bridgekeeper bot commented Jan 10, 2025

👋 Welcome back alanb! 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 10, 2025

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

8347039: ThreadPerTaskExecutor terminates if cancelled tasks still running

Reviewed-by: vklang

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

  • 3e989fd: 8346986: Remove ASM from java.base
  • 3967696: 8347496: Test jdk/jfr/jvm/TestModularImage.java fails after JDK-8347124: No javac
  • 6eb83ef: 8347500: hsdis cannot be built with Capstone.next
  • c1d322f: 8347627: Compiler replay tests are failing after JDK-8346990
  • 0ae5c6b: 8342996: Enhance Attach API to support arbitrary length arguments - OSX
  • 91b63ca: 8345016: [ASAN] java.c reported ‘%s’ directive argument is null [-Werror=format-truncation=]
  • 379d05b: 8346990: Remove INTX_FORMAT and UINTX_FORMAT macros
  • d3a7ac2: 8346383: Cannot use DllMain in libdt_socket for static builds
  • 13a1775: 8344146: Remove temporary font file tracking code.
  • 61dc07c: 8346869: [AIX] Add regression test for handling 4 Byte aligned doubles in structures
  • ... and 24 more: https://git.openjdk.org/jdk/compare/3145278847428ad3a855a3e2c605b77f74ebe113...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
Copy link

openjdk bot commented Jan 10, 2025

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

  • core-libs

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 core-libs core-libs-dev@openjdk.org label Jan 10, 2025
@AlanBateman AlanBateman marked this pull request as ready for review January 14, 2025 06:51
@openjdk openjdk bot added the rfr Pull request is ready for review label Jan 14, 2025
@mlbridge
Copy link

mlbridge bot commented Jan 14, 2025

Webrevs

Copy link
Contributor

@viktorklang-ora viktorklang-ora left a comment

Choose a reason for hiding this comment

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

LGTM

@openjdk openjdk bot added the ready Pull request is ready to be integrated label Jan 14, 2025
@AlanBateman
Copy link
Contributor Author

/integrate

@openjdk
Copy link

openjdk bot commented Jan 15, 2025

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

  • 91197b3: 8347531: The signal tests are failing after JDK-8345782 due to an unrelated warning
  • 4f3dc9d: 8347352: RISC-V: Cleanup bitwise AND assembler routines
  • afc4529: 8346834: Tests failing with -XX:+UseNUMA due to "NUMA support disabled" warning
  • a3be97e: 8347761: Test tools/jimage/JImageExtractTest.java fails after JDK-8303884
  • 28e01e6: 8347762: ClassFile attribute specification refers to non-SE modules
  • be1cdd9: 8344140: Refactor the discovery of AOT cache artifacts
  • 973c630: 8342466: Improve API documentation for java.lang.classfile.attribute
  • 9782bfd: 8347620: Shenandoah: Use 'free' tag for free set related logging
  • 35be4a4: 8347173: java/net/DatagramSocket/InterruptibleDatagramSocket.java fails with virtual thread factory
  • 36b7abd: 8225763: Inflater and Deflater should implement AutoCloseable
  • ... and 57 more: https://git.openjdk.org/jdk/compare/3145278847428ad3a855a3e2c605b77f74ebe113...master

Your commit was automatically rebased without conflicts.

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

openjdk bot commented Jan 15, 2025

@AlanBateman Pushed as commit af3f5d8.

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

@fmeum
Copy link
Contributor

fmeum commented Jan 15, 2025

/backport jdk24u

@openjdk
Copy link

openjdk bot commented Jan 15, 2025

@fmeum the backport was successfully created on the branch backport-fmeum-af3f5d85-master in my personal fork of openjdk/jdk24u. To create a pull request with this backport targeting openjdk/jdk24u:master, just click the following link:

➡️ Create pull request

The title of the pull request is automatically filled in correctly and below you find a suggestion for the pull request body:

Hi all,

This pull request contains a backport of commit af3f5d85 from the openjdk/jdk repository.

The commit being backported was authored by Alan Bateman on 15 Jan 2025 and was reviewed by Viktor Klang.

Thanks!

If you need to update the source branch of the pull then run the following commands in a local clone of your personal fork of openjdk/jdk24u:

$ git fetch https://github.com/openjdk-bots/jdk24u.git backport-fmeum-af3f5d85-master:backport-fmeum-af3f5d85-master
$ git checkout backport-fmeum-af3f5d85-master
# make changes
$ git add paths/to/changed/files
$ git commit --message 'Describe additional changes made'
$ git push https://github.com/openjdk-bots/jdk24u.git backport-fmeum-af3f5d85-master

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
core-libs core-libs-dev@openjdk.org integrated Pull request has been integrated
Development

Successfully merging this pull request may close these issues.

None yet

3 participants