JDK-8248194 : Need better support for running SA tests on core files
  • Type: Bug
  • Component: hotspot
  • Sub-Component: svc-agent
  • Affected Version: 16
  • Priority: P3
  • Status: Resolved
  • Resolution: Fixed
  • Submitted: 2020-06-24
  • Updated: 2024-11-13
  • Resolved: 2020-07-07
The Version table provides details related to the release that this issue/RFE will be addressed.

Unresolved : Release in which this issue/RFE will be addressed.
Resolved: Release in which this issue/RFE has been resolved.
Fixed : Release in which this issue/RFE has been fixed. The release containing this fix may be available for download as an Early Access Release or a General Availability Release.

To download the current JDK release, click here.
JDK 11 JDK 16
11.0.24Fixed 16 b05Fixed
Related Reports
Blocks :  
Blocks :  
Duplicate :  
Relates :  
Relates :  
Description
Right now there are only 3 SA tests that run on core files, and 2 are basically the same:

open/test/hotspot/jtreg/serviceability/sa/ClhsdbCDSCore.java
open/test/hotspot/jtreg/serviceability/sa/TestJmapCore.java
open/test/hotspot/jtreg/serviceability/sa/TestJmapCoreMetaspace.java

We need to add more. I looked into adding some core file support to ClhsdbFindPC and found that it would be a fair amount of work, and much of it replicated from existing tests. We should have support for SA core files tests in common code like SATestUtils.java and LingeredApp.java. The 3 major areas of support I can think of are:

1. Add a shared API for locating the path to the core file. This includes parsing the output of the crashed process to locate where the core file was saved, and returning this location to the user. This API will be placed in the new CoreUtils class.

2. Add a shared API to support for adding the "ulimit -c unlimited" prefix to the command that will produce the core file, allowing the overriding of any lower limit so we can be sure the core file will be produced. This API will also be placed in the new CoreUtils class

3. LingeredApp should include support for producing a core file.

Note, ClhsdbLauncher already has support for debugging a core file.

With these three things in place, it should be fairly easy to modify existing ClhsdbLauncher based tests to run both on a live process and on a core file.
Comments
Fix request [11u] I backport this for parity with 11.0.24-oracle. No risk, only tests change. Some small change. Test pass. SAP nightly testing passed.
18-03-2024

A pull request was submitted for review. URL: https://git.openjdk.org/jdk11u-dev/pull/2591 Date: 2024-03-11 05:25:57 +0000
11-03-2024

Git URL: https://github.com/openjdk/jdk/commit/db2d4e8f5af1274d82242d3d86b922656954e1ef
28-02-2024

The changes in this CR involved taking some core file support from existing tests and moving it to library code to be shared by multiple tests. I noitced in TestJMapCore.java, the following was removed and was not included in the library code: - if (Platform.isWindows()) { - return true; - } I'm not sure of all the reasons why, but at the time I probably suspected the reason for this code was to avoid issues with quoting on Windows, but this was fixed in the shared version: + if (Platform.isWindows()) { + // In order to launch on Windows using "sh -c", we need to first + // convert the path to use forward slashes and do some extra quoting. + cmd = cmd.replace('\\', '/').replace(";", "\\;").replace("|", "\\|"); + }
16-03-2023

URL: https://hg.openjdk.java.net/jdk/jdk/rev/983733bfb7ce User: cjplummer Date: 2020-07-07 20:10:56 +0000
07-07-2020