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

8262080: vmTestbase/nsk/jdi/Event/request/request001/TestDescription.java failed with "ERROR: new event is not ThreadStartEvent" #2927

Closed
wants to merge 4 commits into from

Conversation

@alexmenkov
Copy link

@alexmenkov alexmenkov commented Mar 10, 2021

The fix updates the test to skip ThreadStartEvent/ThreadDeathEvent from other threads


Progress

  • Change must not contain extraneous whitespace
  • Commit message must refer to an issue
  • Change must be properly reviewed

Issue

  • JDK-8262080: vmTestbase/nsk/jdi/Event/request/request001/TestDescription.java failed with "ERROR: new event is not ThreadStartEvent"

Reviewers

Download

$ git fetch https://git.openjdk.java.net/jdk pull/2927/head:pull/2927
$ git checkout pull/2927

@bridgekeeper
Copy link

@bridgekeeper bridgekeeper bot commented Mar 10, 2021

👋 Welcome back amenkov! 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 label Mar 10, 2021
@openjdk
Copy link

@openjdk openjdk bot commented Mar 10, 2021

@alexmenkov 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.

@mlbridge
Copy link

@mlbridge mlbridge bot commented Mar 10, 2021

@@ -164,4 +166,46 @@ protected void breakpointForCommunication() throws JDITestRuntimeException {
throw new JDITestRuntimeException("** event '" + event + "' IS NOT a breakpoint **");
}

// Waiting for ThreadStart and ThreadDeath event we can get events from system threads,
// so need to ensure we get the event from the desired thread.
protected void waitThreadStart(String threadName) throws JDITestRuntimeException {
Copy link
Contributor

@plummercj plummercj Mar 10, 2021

Choose a reason for hiding this comment

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

I think this API is misnamed. It's not just waiting for a ThreadStart for the specified thread. It's waiting for any event other than ThreadStart for some other thread or ThreadDeath for any thread. That's a bit of an odd combination, and certainly not obvious based on the method name and description.

Copy link
Author

@alexmenkov alexmenkov Mar 11, 2021

Choose a reason for hiding this comment

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

I reworked the fix. Hope now it's clearer.

break;
}
// log the event and wait for next one
log2("Waiting for ThreadStartEvent, got " + event);
Copy link
Contributor

@plummercj plummercj Mar 10, 2021

Choose a reason for hiding this comment

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

This message is misleading. It could in fact be a ThreadStart, but for some other thread other than the named thread. I think the code would be clearer if there was no fall-through case. Put this code in an else, but also include a different message as part of the else for the if (evt.thread().name().equals(threadName)) section. Maybe say something like "...got ThreadStartEvent for wrong thread".

// not ThreadStartEvent nor ThreadDeathEvent
gotDesiredEvent = true;
Copy link
Contributor

@plummercj plummercj Mar 11, 2021

Choose a reason for hiding this comment

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

Do you think it would be better if you only set gotDesiredEvent = true if the event came in on the named thread? If the event came in on another thread, it seems it should be ignored. If it came in on the named thread, then it is probably an error since the test is expecting ThreadStart or ThreadDeath, so in that case return and let the caller complain.

Copy link
Author

@alexmenkov alexmenkov Mar 11, 2021

Choose a reason for hiding this comment

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

Not sure I got the idea.
gotDesiredEvent is a flag to exit the cycle, so if the event is not ThreadStart/Death event, we set the flag, leave the cycle and return the event to the caller. In case of request001 test it's an error and the test will fail, but this is desired behaviour

Copy link
Contributor

@plummercj plummercj Mar 12, 2021

Choose a reason for hiding this comment

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

The purpose is to ignore all events on other threads (not just ThreadStart and ThreadDeath) rather than let result in the test failing. However, I can see now that determining the thread of the event is not easy (lots of instanceOf checks of the event type and casts to the proper type), so probably this is not worth doing unless it proves necessary at some point.

// Special version of getEventSet for ThreadStartEvent/ThreadDeathEvent.
// When ThreadStartRequest and/or ThreadDeathRequest are enabled, we can get the events from system threads
// unexpected for tests.
// The method skips ThreadStartEvent/ThreadDeathEvent events for all threads except the expected one.
Copy link
Contributor

@plummercj plummercj Mar 11, 2021

Choose a reason for hiding this comment

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

Can you clean up the line lengths so they are close to being even.

Copy link
Author

@alexmenkov alexmenkov Mar 11, 2021

Choose a reason for hiding this comment

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

done

@openjdk
Copy link

@openjdk openjdk bot commented Mar 12, 2021

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

8262080: vmTestbase/nsk/jdi/Event/request/request001/TestDescription.java failed with "ERROR: new event is not ThreadStartEvent"

Reviewed-by: cjplummer, 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 120 new commits pushed to the master branch:

  • 5069796: 8263164: assert(_base >= VectorA && _base <= VectorZ) failed: Not a Vector while calling StoreVectorNode::memory_size()
  • 996079b: 8260650: test failed with "assert(false) failed: infinite loop in PhaseIterGVN::optimize"
  • 9cb9af6: 8260959: remove RECORDS from PreviewFeature.Feature enum
  • 05fe06a: 8255790: GTKL&F: Java 16 crashes on initialising GTKL&F on Manjaro Linux
  • 422eba8: 8263536: Add @build tags to jpackage tests
  • 0d2f87e: 8263562: Checking if proxy_klass_head is still lambda_proxy_is_available
  • a67a679: 8263679: C1: Remove vtable call
  • 11c8c78: 8248904: Add support to jpackage for the Mac App Store
  • dc93138: 8256732: Zero: broken +ZeroTLAB exposes badly initialized memory
  • e33bfb3: 8263450: Simplify LambdaForm.useCount
  • ... and 110 more: https://git.openjdk.java.net/jdk/compare/eb4a8af559cae9374d29617053a1113ac4b7de2e...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 label Mar 12, 2021
Copy link
Contributor

@sspitsyn sspitsyn left a comment

Alex,

The fix looks good.
One minor suggestion about the messages:

+                    log2("Got ThreadStartEvent for wrong thread: " + event);
+                    log2("Got ThreadDeathEvent for wrong thread: " + event);

More clear message would be something like:
"Thread is not expected, skipping XXX event: " + ...

Thanks,
Serguei

@alexmenkov
Copy link
Author

@alexmenkov alexmenkov commented Mar 17, 2021

More clear message would be something like:
"Thread is not expected, skipping XXX event: " + ...

To me this version does not look clearer :)
I suppose you want to see a note that the event is skipped.
What do you think about
log2("Got XXXEvent for wrong thread, skipping the event: " + event);

@alexmenkov
Copy link
Author

@alexmenkov alexmenkov commented Mar 19, 2021

/integrate

@openjdk openjdk bot closed this Mar 19, 2021
@openjdk openjdk bot added integrated and removed ready rfr labels Mar 19, 2021
@openjdk
Copy link

@openjdk openjdk bot commented Mar 19, 2021

@alexmenkov Since your change was applied there have been 181 commits pushed to the master branch:

Your commit was automatically rebased without conflicts.

Pushed as commit 57fc8e9.

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

@alexmenkov alexmenkov deleted the jdiUsageTracker branch Mar 19, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
3 participants