JDK-8226779 : [TESTBUG] Test JFR API from Java agent
  • Type: Enhancement
  • Component: hotspot
  • Sub-Component: jfr
  • Affected Version: 11,12,13,14
  • Priority: P3
  • Status: Resolved
  • Resolution: Fixed
  • Submitted: 2019-06-25
  • Updated: 2022-06-27
  • Resolved: 2019-08-22
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 13 JDK 14 Other
11.0.6Fixed 13.0.4Fixed 14 b12Fixed openjdk8u262Fixed
Related Reports
Relates :  
Relates :  
Description
Today, there is no testing of JFR API from a Java agent. There is a test caledl EvilInstrument.java, but It doesn't start JFR programmatically It only instruments JDK code that JFR also tries to instrument.

The new test:

- Should start a recording
- Commit 1 000 000 events from 5 different threads. This will fill some global buffers and provoke a chunk rotation. The events should contain:
  - stack trace 
  - a class field
  - a thread field (assigned with a started thread)
  - a string field (assigned with a string of more than 20 characters)
  The above will provoke constant pools early. 
- Stop the recording 
- Dump the file
- Verify the file is correct (in process)
- Transfer recording over JMX to another process and verify that it is correct.

All operations should happen before the main method is started. 

Using a Java agent is a common scenario for tools vendors and should explicitly be tested.


Comments
Fix Request This patch applies cleanly to 13u, the related testcases are passed.
29-05-2020

Replacing jdk8u-fix-request with link to JDK-8239140
17-02-2020

RFC: https://mail.openjdk.java.net/pipermail/jdk8u-dev/2020-January/011063.html
30-01-2020

Fix Request This patch applies cleanly to 11u, the related testcases are passed.
18-09-2019

URL: https://hg.openjdk.java.net/jdk/jdk/rev/d6a422987d86 User: mseledtsov Date: 2019-08-22 17:36:09 +0000
22-08-2019

Updated webrev: http://cr.openjdk.java.net/~mseledtsov/8226779.03/
21-08-2019

http://cr.openjdk.java.net/~mseledtsov/8226779.00/ Testing: ran this test on usual set of platforms many times - All PASS
26-07-2019

It's probably best to make two tests, one in process and out of process. It may make sense to enable the "jdk.JavaExceptionThrow" event (recording.enable(....)), so if something goes wrong it is likely in the recording
26-07-2019

Preliminary WebRev: http://cr.openjdk.java.net/~mseledtsov/8226779.pre.01/
19-07-2019