Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.

Bug 202550

Summary: [Release Note][POG] Attach to/Detach from Agent fails with error on IBM 1.5 JVMs
Product: z_Archived Reporter: Eugene Chan <ewchan>
Component: TPTPAssignee: jkubasta
Status: CLOSED FIXED QA Contact:
Severity: major    
Priority: P1 CC: analexee, asaf.yaffe, guru.nagarajan, haggarty, jgwest, jkubasta, sluiman
Version: unspecifiedFlags: jkubasta: review? (ewchan)
asaf.yaffe: review-
Target Milestone: ---   
Hardware: PC   
OS: Windows XP   
Whiteboard:
Bug Depends on:    
Bug Blocks: 217266    

Description Eugene Chan CLA 2007-09-06 18:33:30 EDT
driver: tptp 441 0906 build
- profile a Java Application.
- detach from Agent.
- Error shown in Console view.
    [Error: Detach failed]
- Java application terminated itself after error message in Console view.
- Agent is shown with status "detached".
Comment 1 Guru Nagarajan CLA 2007-09-07 01:13:47 EDT
Alex, pls take a  look at this
Comment 2 Alexander N. Alexeev CLA 2007-09-07 09:31:51 EDT
This problems only happens with IBM JRE 1.5

BaseProf detach event handler calls DisableEventGroup from Martini API, this function exit with error, after this execution terminates.   

DisableEventGroup checks CT_CAN_ENABLE_OR_DISABLE_BCI_GENERATED_EVENTS martini capability and exit with error due it absence.  



Martini log file has next line:

Informative	09/07/07	12:20:08	6080	0	CJVMTIInterface	VM does not support class redefinition. Call-graph and heap events cannot be fully disabled



Comment 3 Asaf Yaffe CLA 2007-09-09 03:05:18 EDT
This behavior is currently "by design". Dynamic class redefinition does not work on IBM JVMs. See comments 15-18 of Bugzilla 179354 for more information.

Comment 4 Harm Sluiman CLA 2007-09-10 08:14:54 EDT
(In reply to comment #3)
> This behavior is currently "by design". Dynamic class redefinition does not
> work on IBM JVMs. See comments 15-18 of Bugzilla 179354 for more information.
> 

My understanding is that this will be reduced to just a problem with Class, Object and Thread classes once the IBM service pack is delivered. Will this limitation be acceptable?

It also seems a bit odd based on the message that removing instrumentation is the problem, since that implies instrumentation has already been added.
Comment 5 Asaf Yaffe CLA 2007-09-10 09:57:05 EDT
(In reply to comment #4)
> 
> My understanding is that this will be reduced to just a problem with Class,
> Object and Thread classes once the IBM service pack is delivered. Will this
> limitation be acceptable?

Correct. We need to have a list of classes that cannot be redefined on the IBM JVM and completely exclude them from instrumentation. Personally, I think this is acceptable for the CPU and Heap Profilers since these classes are excluded anyhow by the default filter.

> 
> It also seems a bit odd based on the message that removing instrumentation is
> the problem, since that implies instrumentation has already been added.
> 

In the use-case described in this bug, instrumentation was added at "load time" (this does not require dynamic redefinition of classes). Upon detach, all instrumented classes must be dynamically redefined to remove instrumentation. In this sense, the log message is correct IMHO.
Comment 6 Asaf Yaffe CLA 2007-09-11 10:21:26 EDT
To fully resolve this issue:
1. Need a fix for the IBM JVM that resolves all open issues with the RedefineClasses JVMTI function
2. Prepare a list of classes that cannot be redefined and completely exclude them from instrumentation. PMC should verify that this is an acceptable approach.

Recommend to defer this bug for 4.5.
Comment 7 Eugene Chan CLA 2007-09-11 10:24:07 EDT
This is a regression in TPTP 441.
Comment 8 Asaf Yaffe CLA 2007-09-11 10:29:02 EDT
(In reply to comment #7)
> This is a regression in TPTP 441.
> 

Of-course it is. It is a result of re-enabling dynamic instrumentation for attach/detach (which was disabled up to 4.4.1). This was done in order to fix bug 179354 and bug 190802 which were classified as Major/P1 issues for 4.4.1. PMC was aware of the potential regressions with regard to the IBM JVM and decided to approved these fixes.
Comment 9 Guru Nagarajan CLA 2007-09-11 11:36:13 EDT
As Asaf has called out in his comments - the issue is releated to an addition that was made to enabling dynamic instrumentation for attach/detach. This posted to the mailing list (Platform) earlier and agreed to be called as a release note entry.

Eugene,
Pls lower the defect from Blocker to major to reflect the issue in context
Comment 10 Eugene Chan CLA 2007-09-11 11:41:09 EDT
Lower severity to major. Alex/Guru/Joanna, would you please also add the tracking number of the IBM JVM fix here, and referencing it in the 441 release note.
Comment 11 Guru Nagarajan CLA 2007-09-12 00:08:16 EDT
*** Bug 203013 has been marked as a duplicate of this bug. ***
Comment 12 Asaf Yaffe CLA 2007-10-15 09:15:19 EDT
*** Bug 203018 has been marked as a duplicate of this bug. ***
Comment 13 jkubasta CLA 2007-12-09 10:57:16 EST
<readme>
		<title>Detach from Agent fails with error on IBM JRE 1.5</title>
		<category>Profiling Tool</category>
		<bugzilla>202550</bugzilla>
		<description>
		<p>
              <b>Symptom:</b> Detaching from the agent while profiling a Java application results in a "Detach failed" message in the Console View, 
              yet the Java application terminates and the agent is shown with status "detached". 
           </p>

           <p>
              <b>Resolution:</b> Ensure that you are using IBM JRE 1.5 SR6.  This problem, however, is a known limitation and will still exist
              with Class, Object and Thread classes.
          </p>
		</description>
	</readme>
Comment 14 jkubasta CLA 2007-12-09 10:58:26 EST
Please review the draft readme entry
Comment 15 Asaf Yaffe CLA 2007-12-11 05:37:47 EST
(In reply to comment #13)
>               <b>Symptom:</b> Detaching from the agent while profiling a Java
> application results in a "Detach failed" message in the Console View, 
>               yet the Java application terminates and the agent is shown with
> status "detached". 

There is a problem with this sentence. Is the word "yet" really needed here?

>               <b>Resolution:</b> Ensure that you are using IBM JRE 1.5 SR6. 
> This problem, however, is a known limitation and will still exist
>               with Class, Object and Thread classes.

Is this resolution correct? Is upgrading to 1.5 SR6 solves this problem? Was it tested?

My suggestion:
If detach is possible with SR6 when the problematic classes (e.g., Object, Class, Thread, etc...) are *excluded* from profiling (by a filter), then the resolution should specifically state what needs to be done in order to workaround this "detach" problem.

If detach is not possible with SR6 even when the problematic classes are excluded from profiling, then either say that this is a known problem or recommend the user to try another JVM which does not have this limitation (Sun 1.5/1.6, JRockit 1.5/1.6).
Comment 16 Alexander N. Alexeev CLA 2007-12-17 10:00:06 EST
Eugene, could you check that SR6 solve this problem?
Also additional bugzilla should be created about adding list on uninstrumented IBM's classes to BCI implemenation.

Joanna, how should be tracked this release notes requirement regrading bug in 4.5 release? What is adopted process?

Thanks,
Alex.
Comment 17 Alexander N. Alexeev CLA 2007-12-17 10:02:24 EST
(In reply to comment #10)
> Lower severity to major. Alex/Guru/Joanna, would you please also add the
> tracking number of the IBM JVM fix here, and referencing it in the 441 release
> note.
> 

Do you mean this one? "IZ01335"
http://www-1.ibm.com/support/docview.wss?rs=3068&context=SSNVBF&dc=DB550&uid=swg1IZ01335&loc=en_US&cs=UTF-8&lang=en&rss=ct3068websphere 
Comment 18 Asaf Yaffe CLA 2007-12-18 07:13:18 EST
Modified summary to better describe the issue.

The Release Notes text should be updated to cover for attach cases as well (not just detach).
Comment 19 Asaf Yaffe CLA 2007-12-25 07:21:06 EST
I tested the current code (4.4.0.3, as well as the 4.1 and 4.5 branches) with SR6 (build pwi32devifx-20071025)on Windows.

The JVM RedefineClasses functionality was indeed fixed. However, the code is still not working with this version, because the code requires the JVMTI "can redefine any class" capability to be supported, which is not the case with SR6 (there are still some bootstrap classes which cannot be redefined).

Therefore, upgrading to SR6 will not resolve this issue. Some code modifications to Martini are required in order to enable this functionality for SR6.

Comment 20 jkubasta CLA 2008-01-16 08:18:26 EST
How would you update the readme text? It does stated that problems will still exist in SR6 with Class, Object and Thread classes.
Comment 21 Asaf Yaffe CLA 2008-01-16 08:27:55 EST
(In reply to comment #20)
> How would you update the readme text? It does stated that problems will still
> exist in SR6 with Class, Object and Thread classes.
> 

Where is the most up-to-date text? Can you attach it to this bug? I will take another look.
Comment 22 jkubasta CLA 2008-01-16 08:38:05 EST
<readme>
                <title>Detach from Agent fails with error on IBM JRE
1.5</title>
                <category>Profiling Tool</category>
                <bugzilla>202550</bugzilla>
                <description>
                <p>
              <b>Symptom:</b> Detaching from the agent while profiling a Java
application results in a "Detach failed" message in the Console View, 
              the Java application terminates and the agent is shown with
status "detached". 
           </p>

           <p>
              <b>Resolution:</b> Ensure that you are using IBM JRE 1.5 SR6. 
This problem, however, is a known limitation and will still exist
              with Class, Object and Thread classes.
          </p>
                </description>
        </readme>
Comment 23 Asaf Yaffe CLA 2008-01-17 07:15:59 EST
(In reply to comment #22)
I suggest to use the following text:

<readme>
<title>
Attaching to or detaching from Agent fails with error on IBM JRE 1.5
</title>
<category>Profiling Tool</category>
<bugzilla>202550</bugzilla>
<description>
<p>
<b>Symptom:</b> Attaching to or detaching from the Profiling Agent while profiling a Java application running on IBM JRE 1.5 results in a "Attach/Detach failed" message in the Console View, the Java application terminates and the agent is shown with status "detached". 
</p>
<p>
<b>Resolution:</b> This is a known limitation that affects all versions of IBM JRE 1.5.
</p>
</description>
</readme>
Comment 24 Harm Sluiman CLA 2008-01-17 07:58:06 EST
I thought we agreed on the PMC call to find some way to support this better and not just provide a readme that says basically the profiler doesn't work with IBM 1.5
Comment 25 jkubasta CLA 2008-01-17 08:25:36 EST
I raised this defect in the PMC discussion of the profiler yesterday. It will be resolved as wontfix if we resolve the attach/detach problems in the 441 release.
Comment 26 Asaf Yaffe CLA 2008-01-29 08:53:57 EST
Based on the patch submitted for bug 215437, I suggest the following text for the Release Notes:

<readme>
<title>
Attaching to or detaching from Agent fails with error on IBM JRE 1.5
</title>
<category>Profiling Tool</category>
<bugzilla>202550</bugzilla>
<description>
<p>
<b>Symptom:</b> Attaching to or detaching from the Profiling Agent while
profiling a Java application running on IBM JRE 1.5 results in a "Attach/Detach
failed" message in the Console View, the Java application terminates and the
agent is shown with status "detached". 
</p>
<p>
<b>Resolution:</b> This is a known limitation that affects IBM
JRE 1.5 version SR5 and below. Please upgrade the IBM JRE to version 1.5 SR6 or later.
If the problem persists with the latest IBM JRE 1.5, try to exclude Java core classes in the ibm.* and java.lang.* packages from profiling. This workaround should work well with the "Execution Time Analysis" data collector. 
Note that Attach/detach failures with the "Heap Analysis" data collector may still occur with the latest IBM JRE 1.5.
</p>
</description>
</readme>

Comment 27 jkubasta CLA 2008-01-29 10:25:45 EST
Thanks Asaf.  Eugene, pls review the attached readme text.  If you are okay with the wording, I will request PMC approval
Comment 28 Eugene Chan CLA 2008-01-29 10:51:04 EST
(In reply to comment #27)
> Thanks Asaf.  Eugene, pls review the attached readme text.  If you are okay
> with the wording, I will request PMC approval
> 

HI Asaf, the release note addressed the potential problem with Attach/Detach actions that has partly fixed in bug 215437; however, it doesn't mention about the problem of start/stop monitoring post attach action.
Comment 29 Asaf Yaffe CLA 2008-01-30 02:35:14 EST
(In reply to comment #28)
> HI Asaf, the release note addressed the potential problem with Attach/Detach
> actions that has partly fixed in bug 215437; however, it doesn't mention about
> the problem of start/stop monitoring post attach action.
> 

How is start/stop monitoring related to this issue?
Maybe consider adding another Release Note?
Comment 30 Alexander N. Alexeev CLA 2008-01-30 05:26:42 EST
(In reply to comment #28)
> HI Asaf, the release note addressed the potential problem with Attach/Detach
> actions that has partly fixed in bug 215437; however, it doesn't mention about
> the problem of start/stop monitoring post attach action.
> 

Eugene, start/stop isn't a real problem but difference in TI and PI, it should be rather documented then put to release note as exception. 

Comment 31 Eugene Chan CLA 2008-01-30 07:15:32 EST
I see. I suggest we should at lease note the behavior change between PI and TI in a release note.
Comment 32 Alexander N. Alexeev CLA 2008-01-31 03:41:35 EST
(In reply to comment #31)
> I see. I suggest we should at lease note the behavior change between PI and TI
> in a release note.
> 

Anyway it should be separated item on release notes. So if you think that such note should be included please open new bugzilla.

Alex.
Comment 33 Eugene Chan CLA 2008-01-31 09:40:29 EST
I have opened bug 217266 as suggested.
Comment 34 jkubasta CLA 2008-02-01 15:23:03 EST
Checked into CVS
Comment 35 Alexander N. Alexeev CLA 2008-02-07 04:17:58 EST
Classes banned for instrumentation at fix for Bug 217717 should be included in release notes.
Comment 36 Alexander N. Alexeev CLA 2008-02-07 04:46:01 EST
New suggested text: 

<readme>
<title>
Attaching to or detaching from Agent fails with error on IBM JRE 1.5
</title>
<category>Profiling Tool</category>
<bugzilla>202550</bugzilla>
<description>
<p>
<b>Symptom:</b> Attaching to or detaching from the Profiling Agent while
profiling a Java application running on IBM JRE 1.5 results in a "Attach/Detach
failed" message in the Console View, the Java application terminates and the
agent is shown with status "detached". 
</p>
<p>
<b>Resolution:</b> This is a known limitation that affects IBM
JRE 1.5 version SR5 and below. Please upgrade the IBM JRE to version 1.5 SR6 or
later.
If the problem persists with the latest IBM JRE 1.5, try to exclude the following list of Java core classes from profiling: 
<ul>
<li>ibm.*</li>
<li>java.lang.*</li>
<li>java.security.*</li>
<li>java.awt.*</li>
<li>javax.swing.*</li>
<li>com.ibm.jvm.*</li>
<li>com.ibm.misc.*</li>
<li>com.ibm.oti.*</li>
<li>sun.security.*</li>
<li>sun.misc.*</li>
<li>sun.awt.*</li>
<li>sun.java2d.*</li>
</ul>
This workaround should work well with the "Execution Time Analysis" data collector. 
Note that Attach/detach failures with the "Heap Analysis" data collector may
still occur with the latest IBM JRE 1.5.
</p>
</description>
</readme>
Comment 37 jkubasta CLA 2008-02-07 08:54:50 EST
Updates checked into 4.4 and 4.5 release notes
Comment 38 Eugene Chan CLA 2009-02-24 17:09:12 EST
CLOSE BUG