Skip to content

Commit

Permalink
8232839: JDI AfterThreadDeathTest.java failed due to "FAILED: Did not…
Browse files Browse the repository at this point in the history
… get expected IllegalThreadStateException on a StepRequest.enable()"

Reviewed-by: sspitsyn, kevinw
  • Loading branch information
plummercj committed Jun 9, 2023
1 parent 679a6d8 commit 84184f9
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 13 deletions.
2 changes: 0 additions & 2 deletions test/jdk/ProblemList.txt
Expand Up @@ -701,8 +701,6 @@ com/sun/jdi/RepStep.java 8043571 generic-

com/sun/jdi/InvokeHangTest.java 8218463 linux-all

com/sun/jdi/AfterThreadDeathTest.java 8232839 linux-all

############################################################################

# jdk_time
Expand Down
32 changes: 21 additions & 11 deletions test/jdk/com/sun/jdi/AfterThreadDeathTest.java
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2001, 2015, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2001, 2023, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
Expand Down Expand Up @@ -51,9 +51,9 @@ public static void main(String[] args){
public class AfterThreadDeathTest extends TestScaffold {
ReferenceType targetClass;
ThreadReference mainThread;
StepRequest stepRequest = null;
EventRequestManager erm;
boolean mainIsDead;
volatile boolean mainIsDead = false;
volatile boolean gotExpectedThreadStart = false;

AfterThreadDeathTest (String args[]) {
super(args);
Expand All @@ -68,20 +68,23 @@ public static void main(String[] args) throws Exception {
public void threadStarted(ThreadStartEvent event) {
println("Got ThreadStartEvent: " + event);

if (stepRequest != null) {
erm.deleteEventRequest(stepRequest);
stepRequest = null;
println("Deleted stepRequest");
// We don't want to attempt the StepRequest.enable() until we recieve
// the ThreadStartEvent for the "DestroyJavaVM" thread. See JDK-8232839.
if (!event.thread().name().equals("DestroyJavaVM")) {
return;
}
gotExpectedThreadStart = true;

if (mainIsDead) {
if (!mainIsDead) {
failure("FAILED: Got expected ThreadStartEvent before \"main\" ThreadDeathEvent");
} else {
// Here is the odd thing about this test; whatever thread this event
// is for, we do a step on the mainThread. If the mainThread is
// already dead, we should get the exception. Note that we don't
// come here for the start of the main thread.
stepRequest = erm.createStepRequest(mainThread,
StepRequest.STEP_LINE,
StepRequest.STEP_OVER);
StepRequest stepRequest = erm.createStepRequest(mainThread,
StepRequest.STEP_LINE,
StepRequest.STEP_OVER);
stepRequest.addCountFilter(1);
stepRequest.setSuspendPolicy (EventRequest.SUSPEND_ALL);
try {
Expand Down Expand Up @@ -146,6 +149,13 @@ protected void runTests() throws Exception {
*/
listenUntilVMDisconnect();

if (!gotExpectedThreadStart) {
failure("FAILED: never got expected ThreadStartEvent");
}
if (!mainIsDead) {
failure("FAILED: never got ThreadDeathEvent for \"main\" thread");
}

/*
* deal with results of test
* if anything has called failure("foo") testFailed will be true
Expand Down

5 comments on commit 84184f9

@openjdk-notifier
Copy link

Choose a reason for hiding this comment

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

@GoeLin
Copy link
Member

@GoeLin GoeLin commented on 84184f9 Oct 5, 2023

Choose a reason for hiding this comment

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

/backport jdk17u-dev

@openjdk
Copy link

@openjdk openjdk bot commented on 84184f9 Oct 5, 2023

Choose a reason for hiding this comment

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

@GoeLin the backport was successfully created on the branch GoeLin-backport-84184f94 in my personal fork of openjdk/jdk17u-dev. To create a pull request with this backport targeting openjdk/jdk17u-dev: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 84184f94 from the openjdk/jdk repository.

The commit being backported was authored by Chris Plummer on 9 Jun 2023 and was reviewed by Serguei Spitsyn and Kevin Walls.

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/jdk17u-dev:

$ git fetch https://github.com/openjdk-bots/jdk17u-dev.git GoeLin-backport-84184f94:GoeLin-backport-84184f94
$ git checkout GoeLin-backport-84184f94
# make changes
$ git add paths/to/changed/files
$ git commit --message 'Describe additional changes made'
$ git push https://github.com/openjdk-bots/jdk17u-dev.git GoeLin-backport-84184f94

@GoeLin
Copy link
Member

@GoeLin GoeLin commented on 84184f9 Oct 6, 2023

Choose a reason for hiding this comment

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

/backport jdk21u

@openjdk
Copy link

@openjdk openjdk bot commented on 84184f9 Oct 6, 2023

Choose a reason for hiding this comment

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

@GoeLin the backport was successfully created on the branch GoeLin-backport-84184f94 in my personal fork of openjdk/jdk21u. To create a pull request with this backport targeting openjdk/jdk21u: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 84184f94 from the openjdk/jdk repository.

The commit being backported was authored by Chris Plummer on 9 Jun 2023 and was reviewed by Serguei Spitsyn and Kevin Walls.

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/jdk21u:

$ git fetch https://github.com/openjdk-bots/jdk21u.git GoeLin-backport-84184f94:GoeLin-backport-84184f94
$ git checkout GoeLin-backport-84184f94
# make changes
$ git add paths/to/changed/files
$ git commit --message 'Describe additional changes made'
$ git push https://github.com/openjdk-bots/jdk21u.git GoeLin-backport-84184f94

Please sign in to comment.