Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 343025 - Some of the event names in the OProfile profile configuration event tab are malformed
Summary: Some of the event names in the OProfile profile configuration event tab are m...
Status: RESOLVED FIXED
Alias: None
Product: z_Archived
Classification: Eclipse Foundation
Component: LinuxTools (show other bugs)
Version: unspecified   Edit
Hardware: Other Linux
: P3 normal (vote)
Target Milestone: ---   Edit
Assignee: OProfile Inbox CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2011-04-15 19:19 EDT by Corey Ashford CLA
Modified: 2022-01-13 14:51 EST (History)
4 users (show)

See Also:


Attachments
Bug fix: 343025 - Event names in the OProfile are malformed (3.04 KB, patch)
2011-05-03 16:52 EDT, rosaliam CLA
sgehwolf: iplog+
Details | Diff
Patch generated from EGit - Bug fix: 343025 - Event names in the OProfile are malformed (1017 bytes, patch)
2011-05-04 09:04 EDT, rosaliam CLA
no flags Details | Diff
Correct Bug fix: 343025 - Event names in the OProfile are malformed (2.83 KB, patch)
2011-05-11 16:43 EDT, rosaliam CLA
sgehwolf: iplog+
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Corey Ashford CLA 2011-04-15 19:19:31 EDT
Build Identifier: M20110210-1200

Note, we are seeing this problem on POWER5,6,7.  I don't know if it's a problem on x86.

About 10 of 200 of the event names that are in the OProfile profile configuration event tab have the beginning of their names chopped off.  For example, a name that should be something like PM_LD_MISS_L1_LSU1_GRP46 is showing up in the dialog as _LD_MISS_L1_LSU1_GRP46.  Some of shortened names are much shorter, like _GRP32.


Reproducible: Always

Steps to Reproduce:
1.Build any small app (e.g. C hello_world)
2.right-click on the executable and select "Profile configurations"
3.Click on the Events tab and scroll through the event list, and note the event names which are incorrect.
Comment 1 Corey Ashford CLA 2011-04-15 19:25:05 EDT
I'm debugging into this problem now, trying to figure out where things are going astray.
Comment 2 Severin Gehwolf CLA 2011-04-19 17:26:28 EDT
So far I'm not able to reproduce this on x86_64, FWIW.
Comment 3 Corey Ashford CLA 2011-04-19 17:31:27 EDT
(In reply to comment #2)
> So far I'm not able to reproduce this on x86_64, FWIW.

Thanks for having a look at it.  I handed this bug off to another engineer here, so she will be looking into the problem on POWER.  It might be some bug in the JRE.  I hope not!
Comment 4 rosaliam CLA 2011-05-03 16:52:05 EDT
Created attachment 194649 [details]
Bug fix: 343025 - Event names in the OProfile are malformed
Comment 5 rosaliam CLA 2011-05-03 16:54:24 EDT
The issue occurs on IBM JVM, it does not occur on Oracle JVM.

DESCRIPTION OF THE SOLUTION: 
The issue could be solved by increasing the input-buffer size used by the XMLReader class which is responsible for parsing the xml. At the beginning I thought that the problem was with xml header but after adding it (xml declaration and dtd) some events were fixed and others got incorrect, so I saw that it was not the solution. 

The input-buffer size can be increased as following: 

	XMLReader reader;
	... 
	try {
		reader.setProperty("http://apache.org/xml/properties/input-buffer-size", new Integer(102400));
	} catch (SAXNotRecognizedException e1) {
		e1.printStackTrace();
	} catch (SAXNotSupportedException e1) {
		e1.printStackTrace();
	}

The default input-buffer size is 2KB. Instead of the specification
http://xerces.apache.org/xerces2-j/properties.html recommends to use 4K or 8K
for documents larger than 10K, it was so small for the xml generated by the
plug-in based on opxml created on tachyon (Power 6) which is 1.6 MB. It was
solved using the buffer-size 49KB, it did not work less than that. Just for
the contingency, I am using 100KB. I also checked that this modification does
not change the result on Oracle JVM. The fix has been verified on x86, Power6
and Power7 and worked well.
This appears to be a bug in the IBM JRE version 1.6.0. This patch is a
work-around for that bug.
Comment 6 Severin Gehwolf CLA 2011-05-03 17:59:58 EDT
Thanks, pushed (Commit d2c6aa98558db174e32f51705d4de3c25d978588).
Comment 7 rosaliam CLA 2011-05-04 09:04:20 EDT
Created attachment 194709 [details]
Patch generated from EGit - Bug fix: 343025 - Event names in the OProfile are malformed
Comment 8 rosaliam CLA 2011-05-04 09:04:48 EDT
Attaching the same patch but generated from EGit.
Comment 9 Severin Gehwolf CLA 2011-05-04 09:21:42 EDT
(In reply to comment #8)
> Attaching the same patch but generated from EGit.

Thanks, but this has been pushed already (see comment 6). Let me know if that doesn't fix your issue.
Comment 10 rosaliam CLA 2011-05-04 09:33:03 EDT
(In reply to comment #9)
> (In reply to comment #8)
> > Attaching the same patch but generated from EGit.
> 
> Thanks, but this has been pushed already (see comment 6). Let me know if that
> doesn't fix your issue.


There is no error on earlier patch. It was just recreated from EGit for users who use EGit to apply the patches.

Both have been generated from the same commit. 

Sorry for the confusion.
Comment 11 rosaliam CLA 2011-05-04 09:57:11 EDT
(In reply to comment #5)
> The issue occurs on IBM JVM, it does not occur on Oracle JVM.
> 
> DESCRIPTION OF THE SOLUTION: 
> The issue could be solved by increasing the input-buffer size used by the
> XMLReader class which is responsible for parsing the xml. At the beginning I
> thought that the problem was with xml header but after adding it (xml
> declaration and dtd) some events were fixed and others got incorrect, so I saw
> that it was not the solution. 
> 
> The input-buffer size can be increased as following: 
> 
>     XMLReader reader;
>     ... 
>     try {
>        
> reader.setProperty("http://apache.org/xml/properties/input-buffer-size", new
> Integer(102400));
>     } catch (SAXNotRecognizedException e1) {
>         e1.printStackTrace();
>     } catch (SAXNotSupportedException e1) {
>         e1.printStackTrace();
>     }
> 
> The default input-buffer size is 2KB. Instead of the specification
> http://xerces.apache.org/xerces2-j/properties.html recommends to use 4K or 8K
> for documents larger than 10K, it was so small for the xml generated by the
> plug-in based on opxml created on tachyon (Power 6) which is 1.6 MB. It was
> solved using the buffer-size 49KB, it did not work less than that. Just for
> the contingency, I am using 100KB. I also checked that this modification does
> not change the result on Oracle JVM. The fix has been verified on x86, Power6
> and Power7 and worked well.
> This appears to be a bug in the IBM JRE version 1.6.0. This patch is a
> work-around for that bug.


Just an additional information to the Comment #5, the complete JVM version is: 

java version "1.6.0"
Java(TM) SE Runtime Environment (build pxp6460sr9fp1-20110208_03(SR9 FP1))
IBM J9 VM (build 2.4, JRE 1.6.0 IBM J9 2.4 Linux ppc64-64
jvmxp6460sr9-20110203_74623 (JIT enabled, AOT enabled)
J9VM - 20110203_074623
JIT  - r9_20101028_17488ifx3
GC   - 20101027_AA)
JCL  - 20110203_01
Comment 12 rosaliam CLA 2011-05-11 16:43:05 EDT
Created attachment 195430 [details]
Correct Bug fix: 343025 - Event names in the OProfile are malformed

After reported the error to the IBM Java team, they answered with the correct 
solution of the problem.
The problem occurred because XMLReader parser split some characters into two 
or more set of characters and the plug-in was using only the last one as the 
event name. As per IBM Java team, the XMLReader is working as designed and that
behaviour is allowed per spec, so it is not an error, it is programmers 
responsibility to handle those chars correctly.
The solution that had been used for this defect was a work-around. I had
increased the parser's input buffer size and it seemed to be fixed
because the char split occurs when parser reaches the buffer size. As
more the size was increased, less (or none) event names were getting
wrong... But it is not a correct solution, it may not fix for all
situation. The correct solution is modify the OprofileSAXHandlerclass
(which implements ContentHandler interface) to manipulate those
characters correctly.

This patch removes the previous modification and adds the correct fix for the bug.

The Java Bug Report PMR number is 41320,001,866.

The patch was generated from EGit.
Comment 13 rosaliam CLA 2011-05-16 13:27:33 EDT
Do you have any information about when the new fix is planned to be included? Thanks!
Comment 14 Severin Gehwolf CLA 2011-05-16 13:47:39 EDT
Reopening, for new fix.
Comment 15 Severin Gehwolf CLA 2011-05-16 14:21:59 EDT
(In reply to comment #13)
> Do you have any information about when the new fix is planned to be included?
> Thanks!

Actual fix applied with commit 1f60ad6a4954e25d701e0a923fb09e4ebd869f7b. No regressions on my end. Please verify it fixes your issue as well.
Comment 16 rosaliam CLA 2011-05-17 10:18:30 EDT
(In reply to comment #15)
> (In reply to comment #13)
> > Do you have any information about when the new fix is planned to be included?
> > Thanks!
> 
> Actual fix applied with commit 1f60ad6a4954e25d701e0a923fb09e4ebd869f7b. No
> regressions on my end. Please verify it fixes your issue as well.

Thanks! It has verified and is ok.
Comment 17 Andrew Overholt CLA 2011-06-03 15:33:53 EDT
Closing.  Thanks.