Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 278437 - Apache Tomcat profiling crashes with Thread Analysis
Summary: Apache Tomcat profiling crashes with Thread Analysis
Status: CLOSED FIXED
Alias: None
Product: z_Archived
Classification: Eclipse Foundation
Component: TPTP (show other bugs)
Version: unspecified   Edit
Hardware: PC Windows XP
: P1 blocker (vote)
Target Milestone: ---   Edit
Assignee: Yunan, He CLA
QA Contact: Kathy Chan CLA
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2009-05-29 14:46 EDT by Eugene Chan CLA
Modified: 2016-05-05 10:42 EDT (History)
8 users (show)

See Also:
ewchan: pmc_approved? (oec)
ewchan: pmc_approved? (chris.l.elford)
sluiman: pmc_approved+
ernest: pmc_approved+
kathy: pmc_approved+
paulslau: pmc_approved+
ewchan: pmc_approved+
jgwest: review+
ewchan: review+


Attachments
snap of Java crash report (36.01 KB, image/jpeg)
2009-06-01 11:15 EDT, Eugene Chan CLA
no flags Details
Patch to solve thread profiling crash on Apache Tomcat (4.75 KB, patch)
2009-06-11 04:54 EDT, Chengrui Deng CLA
chengrui.deng: review?
Details | Diff
Profilers binary files for testing usage on WindowsXP (1.08 MB, application/x-zip-compressed)
2009-06-11 04:56 EDT, Chengrui Deng CLA
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description Eugene Chan CLA 2009-05-29 14:46:28 EDT
driver: TPTP-4.6.0-200905281626
This problem happens on both Sun and IBM JVM 1.5 and 1.6.

To reproduce:
Tomcat Server version:
	Tomcat v6.x 	(http://tomcat.apache.org/download-60.cgi)

Setup:
	TPTP driver with packages for TPTP-WTP integration as listed on TPTP download page
	- TPTP runtime
	- EMF,XSD
	- WTP
	- GEF
	- DTP

To reproduce:
1. Setup TPTP driver with WTP integration.
2. Start TPTP, and configure a Tomcat server in Window>Preferences>Server>Runtime Environments.
3. Open Servers view in perspective by Windows>Show View>Other...>Server>Servers view.
4. Add the Tomcat instance in Servers view.
5. Right click on the server instance in Servers view and select 'Open' to open the server configuration.
6. In the server configuration editor, change 'Server Location' to 'Use TomcatInstallation'.
7. In the server configuration editor, set TimeOuts for start to 180 sec or higher.
8. Start server in Profile mode.
9. In Profile on Server dialog, configure the following:
		- Profiler:	select 'Java Profiler - JRE 1.5 or newer'.
		- Analysis: select 'Thread Analysis' (with Contention Analysis selected)
		- Filter: add 'org.apache* * INCLUDE' to the filter list (new or default filter)
10. Click Profile to start profiling. 
12. After server is shown as Profiling in state, open http://localhost:8080 in a broswer to load the Tomcat default page.

Server Java process crashes and JVM dialog is shown.
Comment 1 Eugene Chan CLA 2009-05-29 14:47:38 EDT
Note the problem is not reproducible with Java application of smaller scale.
Comment 2 Kathy Chan CLA 2009-05-29 15:05:57 EDT
Hi Yunan and Chengrui,

Could you please take a look at this recent regression in TPTP 4.6?  It's blocking Profile on server scenarios.  Thanks!
Comment 3 Chengrui Deng CLA 2009-05-30 09:37:59 EDT
Hi, Eugene,
  Is there some log file available to analyze?
  I will back to office tomorrow and will investigate about this bug more. Thanks.
Comment 4 Kathy Chan CLA 2009-06-01 09:24:42 EDT
Eugene,

Does this problem occur in TPTP 4.5.2.1 Milestone 2?
Comment 5 Eugene Chan CLA 2009-06-01 10:34:56 EDT
(In reply to comment #4)
> Eugene,
> 
> Does this problem occur in TPTP 4.5.2.1 Milestone 2?
> 

Problem does not occur with TPTP-4.5.2.1-200905201524 build.
Comment 6 Eugene Chan CLA 2009-06-01 11:15:06 EDT
Created attachment 137858 [details]
snap of Java crash report
Comment 7 Kathy Chan CLA 2009-06-02 11:12:24 EDT
Chengrui and Yunan,

Any update on this regression problem?  Are you able to reproduce the problem?
Comment 8 Chengrui Deng CLA 2009-06-08 04:16:29 EDT
  I encountered a problem when profiling with Tomcat 6.0 in step 8. 

  Tomcat server can be started normally or with debugged mode in Eclipse workbench, but failed with a hint ¡°Could not launch in profiling mode because no profilers are configured.¡± 

  I used the Eclipse TPTP all-in-one package downloaded from TPTP website:
  Eclipse Platform Version: 3.5.0 Build id: I20090528-2000.

  Eugene, please give me some help to reproduce the bug. Thanks. 
Comment 9 Kathy Chan CLA 2009-06-08 09:49:02 EDT
Chengrui,

I'm glad you asked.  As stated in the driver download page:

The all-in-one package contains all TPTP plugins with their dependencies, except the TPTP-WTP (required for Profile on Server) and TPTP-BIRT (required for BIRT Reporting) integration features. To install the integration features, please download the "All TPTP plugins" zip file below.  

So you should get the prereqs and then the "All TPTP plugins (runtime or SDK)".  Here are the prereqs you need to:

- Eclipse SDK
- EMF/XSD
- WTP 3.1
- GEF
- DTP

Just unzip Eclipse SDK.  Then unzip the rest of the prereq and the "all TPTP plugin" zip to the dropins directory of the Eclipse.

Please let us know if you still have problem getting profile of server to work.
Comment 10 Chengrui Deng CLA 2009-06-10 02:51:42 EDT
Hi, Kathy,
  Thanks a lot for your information. Now I can reproduce the problem and I will handle the problem as soon as possible.

  Thanks,
  Chengrui

(In reply to comment #9)
> Chengrui,
> 
> I'm glad you asked.  As stated in the driver download page:
> 
> The all-in-one package contains all TPTP plugins with their dependencies,
> except the TPTP-WTP (required for Profile on Server) and TPTP-BIRT (required
> for BIRT Reporting) integration features. To install the integration features,
> please download the "All TPTP plugins" zip file below.  
> 
> So you should get the prereqs and then the "All TPTP plugins (runtime or SDK)".
>  Here are the prereqs you need to:
> 
> - Eclipse SDK
> - EMF/XSD
> - WTP 3.1
> - GEF
> - DTP
> 
> Just unzip Eclipse SDK.  Then unzip the rest of the prereq and the "all TPTP
> plugin" zip to the dropins directory of the Eclipse.
> 
> Please let us know if you still have problem getting profile of server to work.
> 
Comment 11 Kathy Chan CLA 2009-06-10 22:25:12 EDT
Yunan and Chengrui,

We're running out of time for TPTP 4.6.  However, there's concern raised about deferring defect 278437 from TPTP 4.6 since this is a regression on performing thread anaysis with profile on server scenario.  Have you been able to isolate what is causing this regression or any outlook on fixing this?  Please update the defect with your findings.  Please note that we need to drop our final TPTP v4.6 driver to Galileo on 06/16 which means that we need to build our final driver this week. 
Comment 12 Chengrui Deng CLA 2009-06-11 02:56:58 EDT
The problem seems caused by some incorrect memory access in ThreadProf. If the cause is found, I think the fix for it is not hard. But it is not easy to position such kind of crash problem. I am trying to find the cause, and if any update I will post it on Bugzilla.

(In reply to comment #11)
> Yunan and Chengrui,
> 
> We're running out of time for TPTP 4.6.  However, there's concern raised about
> deferring defect 278437 from TPTP 4.6 since this is a regression on performing
> thread anaysis with profile on server scenario.  Have you been able to isolate
> what is causing this regression or any outlook on fixing this?  Please update
> the defect with your findings.  Please note that we need to drop our final TPTP
> v4.6 driver to Galileo on 06/16 which means that we need to build our final
> driver this week. 
> 

Comment 13 Chengrui Deng CLA 2009-06-11 04:54:47 EDT
Created attachment 138899 [details]
Patch to solve thread profiling crash on Apache Tomcat

Hi, Eugene & Kathy,
  I have found the problem of this crash. It is found this incorrect memory usage code is in ProfEnv.cpp and AttachEvent.cpp parts. When we fixed bug 277431, the test cases we used did not cover incorrect memory usage in these two files. These incorrect usages include: not initialized memory, not check pointer after malloc or new etc. mainly in CProfEnv function CProfEnv::ConvertStackTrace(SThreadInfo* threadInfo, SStackTrace_* stackTrace).

  This patch fixed the related problem and it also improves code quality by replacing repeated code in CProfEnv::GetStackTrace with CProfEnv::ConvertStackTrace(...) function call.

  Eugene, please help to review the patch code and I will submit profilers binary files on WinXP for testing usage. If the patch does not have problem, please help to check it into CVS.

  Thanks,
  Chengrui
Comment 14 Chengrui Deng CLA 2009-06-11 04:56:37 EDT
Created attachment 138901 [details]
Profilers binary files for testing usage on WindowsXP

This is profilers binary files for testing usage on WindowsXP.
Comment 15 Eugene Chan CLA 2009-06-11 11:38:36 EDT
Patch smoke test looks good. Tested with Execution and Memory Analysis also.

Jonathan, would you please also review the patch?
Comment 16 Jonathan West CLA 2009-06-11 11:40:31 EDT
I have reviewed the patch code and it looks good.
Comment 17 Eugene Chan CLA 2009-06-11 11:52:45 EDT
Yunan, Please also update the existing test case for this problem.
Comment 18 Eugene Chan CLA 2009-06-11 11:58:16 EDT
I would like to request that the following defect be considered for PMC
approval for 4.6.0.

   1. Explain why you believe this is a stop-ship defect. How does the defect manifest itself, and how will users of TPTP / consuming products be affected if the defect is not fixed?

	> Thread Analysis fails to work in JVMTI profiling. The problem shows in Server profiling and it blocks the profile on server use case.

   2. Is there a work-around? If so, why do you believe the work-around is insufficient?

	> No.

   3. Is this a regression or API breakage? Explain.

	> Regression of bug 277431, the function used to be working in TPTP 4.5.2.X

   4. Does this require new API?

	> No

   5. Who performed the code review?

	> Jonathan West, Eugene Chan

   6. Is there a test case attached to the bugzilla record?

	> Yes, It is found by existing test case.

   7. What is the nature of the fix? What is the scope of the fix? What is the risk associated with this fix?

	> Fixed the incorrect memory usage code is in ProfEnv.cpp and AttachEvent.cpp parts
	> Medium Risk, Test of patch also covered other Analysis types (Execution and Memory)

   8. Is this fix related to any standards that TPTP adheres to? If so, who has validated that the fix continues to adhere to the standard?

	> No.
Comment 19 Kathy Chan CLA 2009-06-11 12:02:00 EDT
I know it's late in the game for TPTP 4.6.  However, since this is a bad regression problem, I think we should get it in.  We would need to run some more testing once this fix is in a build.

+1

Comment 20 Kathy Chan CLA 2009-06-11 12:57:46 EDT
Jonathan, could you please check in the changes?  Thanks!
Comment 21 Jonathan West CLA 2009-06-11 13:01:32 EDT
Patch checked into HEAD w/ PMC approval.
Comment 22 Jonathan West CLA 2009-06-11 13:01:52 EDT
Marking as FIXED.
Comment 23 Eugene Chan CLA 2009-09-21 11:09:50 EDT
close bug.