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

8306758: com/sun/jdi/ConnectedVMs.java fails with "Non-zero debuggee exitValue: 143" #13848

Closed
wants to merge 2 commits into from

Conversation

plummercj
Copy link
Contributor

@plummercj plummercj commented May 5, 2023

This test was very rarely failing with a exitValue 143 from the debuggee. It only happened when the machine was under a lot of stress. After some investigation it was realized that on unix OSes it should always expect exitValue 143, but for some reason was normally getting exitValue 0. The reason 143 should be expected is because Process.destroy() is used on the debuggee, which results in a SIGTERM, which should produce exitValue 143. The reason we were not normally seeing this is because the Process.destroy() was done while the debuggee was suspended at a breakpoint. Nothing can be done with the SIGTERM while all threads are suspended, but once the debugger does the vm.resume() the SIGTERM can be handled. But by that time it is a race between some thread handling SIGTERM and doing the exit(143), and the main debuggee thread resuming and exiting cleanly (producing exitValue 0). In almost all cases the clean exit was winning. By adding a 5 second sleep before exiting, I made it so the SIGTERM exit always wins. Once this was in place, I had to make changes so the test would pass with exitCode 143. This was done by adding a TestScaffold.allowExitValue() method, which the test can override. Note I'll have more uses for this in the future, as I plan to no longer by default allow exitValue 1 (exit with an uncaught exception) and requiring tests to override this method if needed. That will be done by JDK-8307559.

Tested by running all of test/jdk/com/sun/jdi with and without virtual threads, 10x times on each platform.


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-8306758: com/sun/jdi/ConnectedVMs.java fails with "Non-zero debuggee exitValue: 143"

Reviewers

Reviewing

Using git

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

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

Using Skara CLI tools

Checkout this PR locally:
$ git pr checkout 13848

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

Using diff file

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

Webrev

Link to Webrev Comment

@bridgekeeper
Copy link

bridgekeeper bot commented May 5, 2023

👋 Welcome back cjplummer! 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 changed the title 8306758 8306758: com/sun/jdi/ConnectedVMs.java fails with "Non-zero debuggee exitValue: 143" May 5, 2023
Comment on lines +99 to +101
BreakpointEvent bp = startToMain("InstTarg");
waitForVMStart();
StepEvent stepEvent = stepIntoLine(bp.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.

These changes were needed for virtual thread support. startToMain("InstTarg") causes the debuggee to run until it it is suspended at a breakpoint in InstTarg.main(). waitForVMStart() will return right away since the VM has already started, and will return the main thread of the debuggee, but this is the thread running TestScaffold.main(), which started up InstTarg.main() in a virtual thread. If we single step in the main thread in this case, the single step is not in InstTarg.main() as it should be, but is instead in main thread, which is blocked in the join() call waiting for the virtual thread to complete. The single step resumes all threads, but can't complete until the virtual thread exits. So before the test ever gets to do the Process.destroy(), InstTarg.main() has already exited

Fortunately it was easy to find the proper thread to single step in, since the virtual thread is the BreakpointEvent thread.

@plummercj plummercj marked this pull request as ready for review May 5, 2023 23:07
@plummercj plummercj closed this May 5, 2023
@plummercj plummercj reopened this May 5, 2023
@openjdk openjdk bot added the rfr Pull request is ready for review label May 6, 2023
@openjdk
Copy link

openjdk bot commented May 6, 2023

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

  • serviceability

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 serviceability serviceability-dev@openjdk.org label May 6, 2023
@mlbridge
Copy link

mlbridge bot commented May 6, 2023

Webrevs

@openjdk
Copy link

openjdk bot commented May 8, 2023

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

8306758: com/sun/jdi/ConnectedVMs.java fails with "Non-zero debuggee exitValue: 143"

Reviewed-by: amenkov, sspitsyn

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

  • d3e6d04: 8307651: RISC-V: stringL_indexof_char instruction has wrong format string
  • 2be1f10: 8307399: get rid of compatibility ThreadStart/ThreadEnd events for virtual threads
  • f5a6b7f: 8306027: Clarify JVMTI heap functions spec about virtual thread stack.
  • a1c3adb: 8307370: Add tier1 testing with thread factory in CI
  • 356667f: 8307466: java.time.Instant calculation bug in until and between methods
  • 723582c: 8306881: Update FreeType to 2.13.0
  • 9829424: 8307128: Open source some drag and drop tests 4
  • 7f05f6f: 8307307: Improve ProcessTools.java to don't try to run Virtual wrapper for incompatible processes
  • dde557e: 8304148: Remapping a class with Invokedynamic constant loses static bootstrap arguments
  • 82bcee7: 8159337: Introduce a method in Locale class to return the language tags as per RFC 5646 convention
  • ... and 64 more: https://git.openjdk.org/jdk/compare/1b143ba78712e7ac98ca9873c50989b3fba07394...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 May 8, 2023
@openjdk openjdk bot added ready Pull request is ready to be integrated and removed ready Pull request is ready to be integrated labels May 9, 2023
Copy link
Contributor

@sspitsyn sspitsyn 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.
Thanks,
Serguei

@plummercj
Copy link
Contributor Author

Thanks for the reviews Alex and Serguei!

/integrate

@openjdk
Copy link

openjdk bot commented May 10, 2023

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

  • 1964954: 8307194: Add make target for optionally building a complete set of all JDK and hotspot libjvm static libraries
  • 9af1787: 8307244: Remove redundant class RMIIIOPServerImpl
  • 8a95020: 8151531: Add notes to BaseStream.spliterator/iterator docs regarding them being escape hatches
  • 0198afc: 8305748: Clarify reentrant behavior of close() in FileInputStream, FileOutputStream, and RandomAccessFile
  • 1bca05e: 8307799: Newly added java/awt/dnd/MozillaDnDTest.java has invalid jtreg @requires clause
  • cc39689: 8300245: Replace NULL with nullptr in share/jfr/
  • 4251b56: 8306843: JVMTI tag map extremely slow after JDK-8292741
  • ab34cb9: 8305082: Remove finalize() from test/hotspot/jtreg/runtime/linkResolver/InterfaceObjectTest.java
  • 0da48f1: 8307732: build-test-lib is broken
  • 4aa65cb: 8285932: Implementation of JEP 430 String Templates (Preview)
  • ... and 78 more: https://git.openjdk.org/jdk/compare/1b143ba78712e7ac98ca9873c50989b3fba07394...master

Your commit was automatically rebased without conflicts.

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

openjdk bot commented May 10, 2023

@plummercj Pushed as commit 2688364.

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

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 serviceability serviceability-dev@openjdk.org
3 participants