Flight Recorder uses byte code instrumentation to instrument FileOutputStream (and some other io classes). It looks like your agent and the JFR agent are causing some issues when run together. Can you put together a reproducer and give us?
- Copy the Main class and CustomAgent.jar in “C:\Test” directory and
- Execute java Application with runTestApp.cmd
(I) set JAVA_HOME=c:\java\jdk1.7.0_40
(II) set AGENT_HOME=C:\Test
(III) %JAVA_HOME%\bin\java -javaagent:%AGENT_HOME%\CustomAgent.jar -Dcom.ca.apm.agent.instrumentation.redefineclass.path=C:\Test\debugclasses\ -XX:+UnlockCommercialFeatures -XX:+FlightRecorder -cp .; Main
3. In console check Agent Error: java.lang.NullPointerException at oracle.jrockit.jfr.jdkevents.IoTracer.fileWriteBegin(IoTracer.java:260)
The path given to jar -Dcom.ca.apm.agent.instrumentation.redefineclass.path (e.g. C:\Test\debugclasses\) should be a valid existing directory where agent can write some debug class files.
Not sure if you can get it form below let me know the if i have to shared by some other channel.
Artfiacts shared at : https://communities.oracle.com/portal/server.pt?open=514&objID=226&mode=2&docID=812928&aggregatorResults=D812928D812861&sourceCommunityId=210&sourcePortletId=371&doPagination=true&pagedAggregatorPageNo=1&returnUrl=https%3A%2F%2Fcommunities.oracle.com%2Fportal%2Fserver.pt%3Fopen%3Dspace%26name%3DCommunityPage%26id%3D10%26cached%3Dtrue%26in_hi_userid%3D601671%26control%3DSetCommunity%26PageID%3D0%26CommunityID%3D210%26&Portlet=My%20Documents&PrevPage=Communities-Documents
I see the problem: While JFR is in the middle of setting itself up (especially the i/o events), your agent comes in and starts doing i/o at a location where this does not usually happen. I did some fixes to work around this, but it's still a bit brittle.
I suggest that your agent be modified to skip the oracle.jrockit.jfr.* classes.
Even skipping oracle.jrockit.jfr.* does not solve the problem . Using Custom Agent having huge number of class redefinition we see the error which is coming in other thread too but I am not sure till the time init has been called or not as we skipped it. So as per method fileWriteBegin contract JFR.init must be called to enable the events before it get called and here app may not have control over init . I think this class need to have null check for fileWriteToken and make sure it’s called only when IoTracer’s enables it.
I think this class need to have null check for fileWriteToken and make sure it’s called only when IoTracer’s enables it.
Yes, that is the fix I am looking at.
Ok, Will it be fixed in upcoming JDK 7 release update ? Do You have any target release update version ?
The earliest possible release is 7u60 in May 2014, but I don't know if the fix will make it into there.
1 person found this helpful
I have just pushed a fix for this to the 7u60 branch.
Thanks for reporting!
Thanks for fixing it . It's really good news for us.