Skip to content

JDK-8326496: [test] checkHsErrFileContent support printing hserr in error case #17978

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

Closed
wants to merge 3 commits into from

Conversation

MBaesken
Copy link
Member

@MBaesken MBaesken commented Feb 23, 2024

checkHsErrFileContent checks hs error files for existance and non-existance of some user provided patterns. However it should also have an option to print the hs_err file in case of a failing check, this would make error analysis easier.


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-8326496: [test] checkHsErrFileContent support printing hserr in error case (Enhancement - P4)

Reviewers

Reviewing

Using git

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

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

Using Skara CLI tools

Checkout this PR locally:
$ git pr checkout 17978

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

Using diff file

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

Webrev

Link to Webrev Comment

@bridgekeeper
Copy link

bridgekeeper bot commented Feb 23, 2024

👋 Welcome back mbaesken! 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 Pull request is ready for review label Feb 23, 2024
@openjdk
Copy link

openjdk bot commented Feb 23, 2024

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

  • hotspot-runtime

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 hotspot-runtime hotspot-runtime-dev@openjdk.org label Feb 23, 2024
@mlbridge
Copy link

mlbridge bot commented Feb 23, 2024

Webrevs

Copy link
Contributor

@RealCLanger RealCLanger left a comment

Choose a reason for hiding this comment

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

One minor remark, looks good otherwise.

@@ -63,12 +63,10 @@ public static File openHsErrFileFromOutput(OutputAnalyzer output) {
* if patterns are missing, or if the END marker is missing.
* @param f Input file
* @param patterns An array of patterns that need to match, in that order
* @param verbose If true, the content of the hs-err file is printed while matching. If false, only the matched patterns
* are printed.
* @throws RuntimeException, {@link IOException}
Copy link
Contributor

Choose a reason for hiding this comment

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

The Javadoc of parameter "verbose" should not be removed here.

Copy link
Member Author

Choose a reason for hiding this comment

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

okay I added it again; but it was already not documented in the same way before my change, once "the matched patterns are printed" once "only important information are printed" . Should we adjust it and to what ?

Copy link
Contributor

Choose a reason for hiding this comment

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

Looking at what "verbose" does, I'd say the correct description would be "only the matched patterns are printed"

Copy link
Member Author

Choose a reason for hiding this comment

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

Looking at what "verbose" does, I'd say the correct description would be "only the matched patterns are printed"

Mostly correct, but there could be also "Lazily skipping the rest of the hs-err file..." for example; but mostly (almost all) output is about the patterns ("Matches ..." or "Forbidden pattern found ..." ).

@openjdk
Copy link

openjdk bot commented Feb 23, 2024

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

8326496: [test] checkHsErrFileContent support printing hserr in error case

Reviewed-by: clanger, lucy

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

  • 8f6edd8: 8326975: Parallel: Remove redundant PSOldGen::is_allocated
  • 4302900: 8319673: Few security tests ignore VM flags
  • e772e78: 8326948: Force English locale for timeout formatting
  • d9ef16d: 8326140: src/jdk.accessibility/windows/native/libjavaaccessbridge/AccessBridgeJavaEntryPoints.cpp ReleaseStringChars might be missing in early returns
  • 998d0ba: 8324799: Use correct extension for C++ test headers
  • 0735c8a: 8318302: ThreadCountLimit.java failed with "Native memory allocation (mprotect) failed to protect 16384 bytes for memory to guard stack pages"
  • 5fa2bdc: 8326953: Race in creation of win-exports.def with static-libs
  • be2b92b: 8326694: Defer setting of autocapitalize attribute
  • 38ad514: 8326687: Inconsistent use of "ZIP", "Zip" and "zip" in java.util.zip/jar zipfs javadoc
  • b938a5c: 8324969: C2: prevent elimination of unbalanced coarsened locking regions
  • ... and 68 more: https://git.openjdk.org/jdk/compare/9f9a732c38072b8168b3c0caee9069f34f6655a8...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 Feb 23, 2024
Copy link
Member

@dholmes-ora dholmes-ora left a comment

Choose a reason for hiding this comment

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

Sorry I'm struggling to understand under exactly what conditions the hs_err file will now be printed. Can you give some concrete examples, and why you want to print a potentially very large file as part of the tests main output (which may overflow the jtreg output buffer). Thanks

@MBaesken
Copy link
Member Author

Sorry I'm struggling to understand under exactly what conditions the hs_err file will now be printed.

It will be printed in case the checkHsErrFileContent fails, So we do not have to set 'verbose' and print the content always (because in the successful case it is not really needed) but only in failure case.

Can you give some concrete examples, and why you want to print a potentially very large file as part of the tests main output (which may overflow the jtreg output buffer). Thanks

I want to print it to see what was wrong with the hserr file content. Especially in the SecondaryErrorTest we had errors where we missed the hserr content to look WHAT exactly was really bad/failing.

@dholmes-ora
Copy link
Member

Sorry but when you see an error like:

Forbidden pattern found at line " + lineNo + ": " + negativePattern)

why does that not suffice? And if it doesn't suffice why don't you just grab the hs_err file from the test artifacts and examine it directly?

@RealCLanger
Copy link
Contributor

Hi David,

we sometimes see error output like this:

[2024-02-09T01:23:06.112705412Z] Gathering output for process 47059
Will crash now (TestCrashInErrorHandler=14)...
^^^ Matches Will crash now \(TestCrashInErrorHandler=14\)... at line 2^^^
[error occurred during error reporting (test secondary crash 1), id 0xb, SIGSEGV (0xb) at pc=0x000074d8362e1664]
^^^ Matches \[error occurred during error reporting \(test secondary crash 1\).\] at line 4^^^
[siginfo: si_signo: 11 (SIGSEGV), si_code: 1 (SEGV_MAPERR), si_addr: 0x0000000000000400]
^^^ Matches \[siginfo:.
\(SIGSEGV\).\] at line 5^^^
[stack: Native frames: (J=compiled Java code, j=interpreted, Vv=VM code, C=native code)
^^^ Matches \[stack: Native frames:.
at line 6^^^
V [libjvm.so+0x1d01664] VMError::controlled_crash(int)+0x194
^^^ Matches .VMError::controlled_crash. at line 7^^^
Will crash now (TestCrashInErrorHandler=14)...
^^^ Matches Will crash now \(TestCrashInErrorHandler=14\)... at line 9^^^
[error occurred during error reporting (test secondary crash 2), id 0xb, SIGSEGV (0xb) at pc=0x000074d8362e1664]
^^^ Matches \[error occurred during error reporting \(test secondary crash 2\).\] at line 11^^^
----------System.err:(12/723)
----------
java.lang.RuntimeException: hs-err file incomplete (first missing pattern: \[siginfo:.\(SIGSEGV\).\])
at HsErrFileUtils.checkHsErrFileContent(HsErrFileUtils.java:135)
at HsErrFileUtils.checkHsErrFileContent(HsErrFileUtils.java:71)
at SecondaryErrorTest.main(SecondaryErrorTest.java:125)
at java.base/jdk.internal.reflect.DirectMethodHandleAccessor.invoke(DirectMethodHandleAccessor.java:103)
at java.base/java.lang.reflect.Method.invoke(Method.java:580)
at com.sun.javatest.regtest.agent.MainActionHelper$AgentVMRunnable.run(MainActionHelper.java:333)
at java.base/java.lang.Thread.run(Thread.java:1570)

So in that case (pattern missing) I'd really like to have the full hs_err file to see what happened.

But I agree that for things like Forbidden pattern found, as you mentioned above, one would not need to print the whole hs_err file. Maybe the change could be checked/modified to only print the hs_err content if something is missing?

@MBaesken
Copy link
Member Author

MBaesken commented Feb 28, 2024

Hi David,

why does that not suffice?
And if it doesn't suffice why don't you just grab the hs_err file from the test artifacts and examine it directly?

For the forbidden patterns it might indeed suffice (however having more information understanding the context of why a forbidden pattern occurs is still often necessary).
On some shielded containers / Jenkins setups I usually only have the log and cannot 'collect' additional information. This is not the exception but a very common thing.
(In my local environment I do not see the error , so no hserr is printed)
Btw. we are totally fine with a verbose parameter of the check function (prints the hserr content even in case of success) .

@MBaesken
Copy link
Member Author

MBaesken commented Feb 28, 2024

Btw. regarding negative/forbidden patterns, SecondaryErrorTest checks only for positive patterns, so your case does not occur in that test.
And the other few tests calling checkHsErrFileContent that use the check for negative patterns (e.g. ReattemptErrorTest seems to be one) do not use the feature I added. So nothing changes there.

@dholmes-ora
Copy link
Member

I remain concerned that printing the hs_err file within the log file may actually cause more problems than it fixes. Test environments should gather up all test artifacts for examination upon failure so the actual hs_err file should be available IMO. But if you think you need this ...

Copy link
Contributor

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

@MBaesken
Copy link
Member Author

MBaesken commented Mar 1, 2024

/integrate

@openjdk
Copy link

openjdk bot commented Mar 1, 2024

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

  • 0899b3b: 8326612: Parallel: remove redundant assertion from ScavengeRootsTask
  • 12404a5: 8324790: ifnode::fold_compares_helper cleanup
  • 0d35450: 8327040: Problemlist ActionListenerCalledTwiceTest.java test failing in macos14
  • 8d6f784: 8327056: Remove unused static char array in JvmtiAgentList::lookup
  • 43af120: 8326959: Improve JVMCI option help
  • 742c776: 8322743: C2: prevent lock region elimination in OSR compilation
  • d29cefb: 8326838: JFR: Native mirror events
  • b8fc418: 8326525: com/sun/tools/attach/BasicTests.java does not verify AgentLoadException case
  • d9aa1de: 8318605: Enable parallelism in vmTestbase/nsk/stress/stack tests
  • bbfda65: 8326897: (fs) The utility TestUtil.supportsLinks is wrongly used to check for hard link support
  • ... and 79 more: https://git.openjdk.org/jdk/compare/9f9a732c38072b8168b3c0caee9069f34f6655a8...master

Your commit was automatically rebased without conflicts.

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

openjdk bot commented Mar 1, 2024

@MBaesken Pushed as commit a065eba.

💡 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
hotspot-runtime hotspot-runtime-dev@openjdk.org integrated Pull request has been integrated
Development

Successfully merging this pull request may close these issues.

4 participants