Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 178916 - Can't profile the workbench using JVMTI
Summary: Can't profile the workbench using JVMTI
Status: CLOSED FIXED
Alias: None
Product: z_Archived
Classification: Eclipse Foundation
Component: TPTP (show other bugs)
Version: unspecified   Edit
Hardware: PC Windows XP
: P1 major (vote)
Target Milestone: ---   Edit
Assignee: Igor Alelekov CLA
QA Contact:
URL:
Whiteboard: closed460
Keywords:
: 179489 189477 (view as bug list)
Depends on: 166370
Blocks:
  Show dependency tree
 
Reported: 2007-03-22 18:36 EDT by amehrega CLA
Modified: 2016-05-05 10:47 EDT (History)
7 users (show)

See Also:


Attachments
AC patch (2.60 KB, patch)
2007-04-28 05:10 EDT, Igor Alelekov CLA
no flags Details | Diff
Execution patch (3.18 KB, patch)
2007-04-28 05:22 EDT, Igor Alelekov CLA
no flags Details | Diff
AC patch (2.60 KB, patch)
2007-05-02 14:25 EDT, Igor Alelekov CLA
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description amehrega CLA 2007-03-22 18:36:43 EDT
I tried to profile the workbench (using the Eclipse Application launch item) but I got the following exception in my console:

org.eclipse.tptp.platform.execution.exceptions.TimeoutException: Launching Process command timed out.
	at org.eclipse.tptp.platform.execution.client.core.internal.AgentController.queryAgentByProcessID(AgentController.java:471)
	at org.eclipse.tptp.platform.execution.client.core.internal.AgentController.getAgent(AgentController.java:838)
	at org.eclipse.tptp.platform.jvmti.client.internal.launcher.TIDelegateHelper.locateTIAgent(TIDelegateHelper.java:545)
	at org.eclipse.tptp.platform.jvmti.client.internal.launcher.TIDelegateHelper.attachToAgent(TIDelegateHelper.java:446)
	at org.eclipse.tptp.platform.jvmti.client.internal.launcher.TIDelegateHelper.attachToAgent(TIDelegateHelper.java:414)
	at org.eclipse.tptp.platform.jvmti.client.internal.launcher.TIDelegateHelper.access$4(TIDelegateHelper.java:412)
	at org.eclipse.tptp.platform.jvmti.client.internal.launcher.TIDelegateHelper$2.processLaunched(TIDelegateHelper.java:326)
	at org.eclipse.tptp.platform.execution.client.core.internal.ProcessImpl.launchAC(ProcessImpl.java:599)
	at org.eclipse.tptp.platform.execution.client.core.internal.ProcessImpl.launch(ProcessImpl.java:131)
	at org.eclipse.tptp.platform.jvmti.client.internal.launcher.TIDelegateHelper.launchProcess(TIDelegateHelper.java:362)
	at org.eclipse.tptp.platform.jvmti.client.internal.launcher.TIDelegateHelper.launch(TIDelegateHelper.java:255)
	at org.eclipse.tptp.platform.jvmti.client.internal.launcher.TIRuntimeWorkbenchDelegate.launch(TIRuntimeWorkbenchDelegate.java:32)
	at org.eclipse.tptp.trace.ui.internal.launcher.core.LauncherUtility.delegateInit(LauncherUtility.java:1174)
	at org.eclipse.tptp.trace.ui.provisional.launcher.PrimaryLaunchDelegate.run(PrimaryLaunchDelegate.java:188)
	at java.lang.Thread.run(Thread.java:797)
java.lang.NullPointerException
	at org.eclipse.tptp.platform.execution.client.core.internal.AgentController.queryAgentByProcessID(AgentController.java:485)
	at org.eclipse.tptp.platform.execution.client.core.internal.AgentController.getAgent(AgentController.java:838)
	at org.eclipse.tptp.platform.jvmti.client.internal.launcher.TIDelegateHelper.locateTIAgent(TIDelegateHelper.java:545)
	at org.eclipse.tptp.platform.jvmti.client.internal.launcher.TIDelegateHelper.attachToAgent(TIDelegateHelper.java:446)
	at org.eclipse.tptp.platform.jvmti.client.internal.launcher.TIDelegateHelper.attachToAgent(TIDelegateHelper.java:414)
	at org.eclipse.tptp.platform.jvmti.client.internal.launcher.TIDelegateHelper.access$4(TIDelegateHelper.java:412)
	at org.eclipse.tptp.platform.jvmti.client.internal.launcher.TIDelegateHelper$2.processLaunched(TIDelegateHelper.java:326)
	at org.eclipse.tptp.platform.execution.client.core.internal.ProcessImpl.launchAC(ProcessImpl.java:599)
	at org.eclipse.tptp.platform.execution.client.core.internal.ProcessImpl.launch(ProcessImpl.java:131)
	at org.eclipse.tptp.platform.jvmti.client.internal.launcher.TIDelegateHelper.launchProcess(TIDelegateHelper.java:362)
	at org.eclipse.tptp.platform.jvmti.client.internal.launcher.TIDelegateHelper.launch(TIDelegateHelper.java:255)
	at org.eclipse.tptp.platform.jvmti.client.internal.launcher.TIRuntimeWorkbenchDelegate.launch(TIRuntimeWorkbenchDelegate.java:32)
	at org.eclipse.tptp.trace.ui.internal.launcher.core.LauncherUtility.delegateInit(LauncherUtility.java:1174)
	at org.eclipse.tptp.trace.ui.provisional.launcher.PrimaryLaunchDelegate.run(PrimaryLaunchDelegate.java:188)
	at java.lang.Thread.run(Thread.java:797)


Subsequent launches of other launch item types caused the same problem
Comment 1 Guru Nagarajan CLA 2007-03-22 18:38:52 EDT
This is caused due to 166370 and is being looked at.
Comment 2 amehrega CLA 2007-03-23 18:33:09 EDT
I'm not sure if it's right to make this dependent on 166370.  I am able to profile external Java applications and Java applications local to my workbench.  It's just the Eclipse Application launch item that I'm having problems with.

Also at first glance it doesn't seem that I'm getting the same errors as that described in 166370 (although I have to admit that I didn't read everything in the bug report)

Comment 3 Guru Nagarajan CLA 2007-03-23 18:46:47 EDT
Ali,
  The defect as described in 166370 is intermittent. It does not always occur. The Eclipse launch succeeds intermittently - the issue is two fold when the "Start Process" command the process launching fails intermittently, secondly, the second point is that the process controller or an util in the AC "parses" the start process command and puts it back again and in this process there are certain bytes dropped. Hence the dependency on 166370
Comment 4 Guru Nagarajan CLA 2007-03-26 13:42:00 EDT
The defect is resolved - validated using the 3/26 driver
Comment 5 amehrega CLA 2007-03-26 14:17:03 EDT
Guru, using TPTP-4.4.0-200703260100 I'm getting the following output on the console:

!SESSION 2007-03-26 13:59:53.062 -----------------------------------------------
eclipse.buildId=I20070323-1616
java.fullversion=J2RE 1.5.0 IBM J9 2.3 Windows XP x86-32 j9vmwi3223-20060504 (JIT enabled)
J9VM - 20060501_06428_lHdSMR
JIT  - 20060428_1800_r8
GC   - 20060501_AA
BootLoader constants: OS=win32, ARCH=x86, WS=win32, NL=en_CA
Framework arguments:  -product org.eclipse.sdk.ide and Settings\Administrator\workspaces\default/../runtime-New_configuration2' and Settings/Administrator/workspaces/default/.metadata/.plugins/org.eclipse.pde.core/Eclipse Application/' and Settings/Administrator/workspaces/default/.metadata/.plugins/org.eclipse.pde.core/Eclipse Application/dev.properties' -pdelaunch
Command-line arguments:  -product org.eclipse.sdk.ide -data 'C:\Documents and Settings\Administrator\workspaces\default/../runtime-New_configuration2' and Settings/Administrator/workspaces/default/.metadata/.plugins/org.eclipse.pde.core/Eclipse Application/' -dev 'file:C:/Documents and Settings/Administrator/workspaces/default/.metadata/.plugins/org.eclipse.pde.core/Eclipse Application/dev.properties' -pdelaunch -os win32 -ws win32 -arch x86

!ENTRY org.eclipse.osgi 4 0 2007-03-26 13:59:58.656
!MESSAGE Error reading configuration: D:\TPTP4.4\TPTP-4.4.0-200703260100\eclipse\'file:C:\Documents\org.eclipse.osgi\.manager\.fileTableLock (The filename, directory name, or volume label syntax is incorrect.)
!STACK 0
java.io.FileNotFoundException: D:\TPTP4.4\TPTP-4.4.0-200703260100\eclipse\'file:C:\Documents\org.eclipse.osgi\.manager\.fileTableLock (The filename, directory name, or volume label syntax is incorrect.)
	at java.io.RandomAccessFile.open(Native Method)
	at java.io.RandomAccessFile.<init>(RandomAccessFile.java:243)
	at org.eclipse.core.runtime.internal.adaptor.Locker_JavaNio.lock(Locker_JavaNio.java:30)
	at org.eclipse.osgi.storagemanager.StorageManager.lock(StorageManager.java:388)
	at org.eclipse.osgi.storagemanager.StorageManager.open(StorageManager.java:695)
	at org.eclipse.osgi.internal.baseadaptor.BaseStorage.initFileManager(BaseStorage.java:162)
	at org.eclipse.osgi.internal.baseadaptor.BaseStorage.initialize(BaseStorage.java:139)
	at org.eclipse.osgi.baseadaptor.BaseAdaptor.initializeStorage(BaseAdaptor.java:124)
	at org.eclipse.osgi.framework.internal.core.Framework.initialize(Framework.java:174)
	at org.eclipse.osgi.framework.internal.core.Framework.<init>(Framework.java:147)
	at org.eclipse.osgi.framework.internal.core.OSGi.createFramework(OSGi.java:90)
	at org.eclipse.osgi.framework.internal.core.OSGi.<init>(OSGi.java:31)
	at org.eclipse.core.runtime.adaptor.EclipseStarter.startup(EclipseStarter.java:279)
	at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:167)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:64)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.lang.reflect.Method.invoke(Method.java:615)
	at org.eclipse.equinox.launcher.Main.invokeFramework(Main.java:476)
	at org.eclipse.equinox.launcher.Main.basicRun(Main.java:416)
	at org.eclipse.equinox.launcher.Main.run(Main.java:1141)
	at org.eclipse.equinox.launcher.Main.main(Main.java:1116)
	at org.eclipse.core.launcher.Main.main(Main.java:24)
java.io.FileNotFoundException: D:\TPTP4.4\TPTP-4.4.0-200703260100\eclipse\'file:C:\Documents\config.ini (The filename, directory name, or volume label syntax is incorrect.)



I also get the following message in an error dialog:
"Could not launch the product because the specified workspace cannot be created.  The specified workspace directory is either invalid or read-only"

I'm sure that the workspace directory exists and is not just read-only.  I believe this has something to do with my workspace path containing a space.  My workspace is:  C:\Documents and Settings\Administrator\workspaces\default.  Trying this with the workspace: C:\temp\tmp\ws2 worked.

I'm re-opening this defect but reducing its severity to major.

Comment 6 Guru Nagarajan CLA 2007-03-26 15:09:22 EDT
Good catch ALi, the space issue is to be fixed. I will be attempt this in i2 but target the defect itself to i3.
Comment 7 Vitaly Provodin CLA 2007-04-20 08:43:03 EDT
When profiling is started the startProcess command is sent to AC. This command contains the "Parameter value" parameter which is generated in double quotes. But this parameter itself contains internal parameters which also may be in quotation marks. To avoid nested quotations LaunchProcessCommand replaces internal double quotes by single quotes. Those internal parameters are needed to start Eclipse, they are -data, -configuration, -dev.

I tried to reproduce this bug from command line. It is reproduced if values for these parameters are in single quotes. It successfully starts Eclipse if values for these parameters are in double quotes.
It looks like the backend should correctly handle these quotations.
Comment 8 Vitaly Provodin CLA 2007-04-20 08:45:02 EDT
*** Bug 179489 has been marked as a duplicate of this bug. ***
Comment 9 Guru Nagarajan CLA 2007-04-23 15:49:54 EDT
Vitaly - I agree that the runtime must make accomodations for this.
Can you please work with Igor on this.
Comment 10 amehrega CLA 2007-04-27 17:25:37 EDT
Even though a workaround is available for this (i.e. using a workspace path without any spaces), it is still a common whole that I suspect many users will fall in.  Even the default workspace on windows in Eclipse contains spaces <drive>\Documents and Settings\...

Guru, I think this needs to seriously be considered for i3.
Comment 11 Igor Alelekov CLA 2007-04-28 05:10:48 EDT
Created attachment 65315 [details]
AC patch
Comment 12 Igor Alelekov CLA 2007-04-28 05:22:31 EDT
Created attachment 65316 [details]
Execution patch

The patch is devided on two pats - patch for the AC and patch for the Execution framework. The patch encodes command line parameters as XML TextNode. It allows using quotas in parameters without restrictions.

To get defect fixed it is needed to add double quotas in Profiler Client's code to initialization of LaunchProcessCommand parameters.

The patch itself checks for some parameter names (-data, -launcher, -configuration, -dev) and adds doble quotas if they absent.
Comment 13 Guru Nagarajan CLA 2007-05-02 12:10:22 EDT
Samson,
  I have checked in the "Execution Patch" for this defect that Igor has attached.
Please apply the AC patch needed to resolve this issue.

Thanks
Comment 14 Igor Alelekov CLA 2007-05-02 12:18:49 EDT
Please note that the AC patch could conflict with the Linux patch #182404 since both change the same component - Process Controller.
Comment 15 Guru Nagarajan CLA 2007-05-02 12:21:22 EDT
Igor - Can you work with Samson on getting the AC patch in. 
The Linux patch from what I know is checked in
Comment 16 Igor Alelekov CLA 2007-05-02 12:54:49 EDT
Guru, 
the linux patch #182404 has been updated. 
When it will be committed I'll submit an updated AC patch for the current deffect.
Comment 17 Igor Alelekov CLA 2007-05-02 14:25:40 EDT
Created attachment 65664 [details]
AC patch

Samson, please review and commit the updated AC patch
Comment 18 Samson Wai CLA 2007-05-02 14:45:19 EDT
AC patch checked in. Igor please close if you have finished. Thanks.
Comment 19 Igor Alelekov CLA 2007-05-02 14:49:22 EDT
Resolved
Comment 20 Asaf Yaffe CLA 2007-05-08 05:48:01 EDT
This bug still appears in the TPTP-4.4.0-200705071739 Agent Controller driver.

When you launch a Eclipse Plugin under the profiler, the following Java command is invoked:

java. -agentlib:JPIBootLoader=JPIAgent:server=controlled;HeapProf org.eclipse.core.launcher.Main -launcher C:\temp\Eclipse33\eclipse\eclipse -name Eclipse -showsplash 600 -product org.eclipse.sdk.ide -data C:\temp\Eclipse33WS/../runtime-EclipseApplication -configuration 'file:C:/temp/Eclipse33WS/.metadata/.plugins/org.eclipse.pde.core/Eclipse Application/' -dev 'file:C:/temp/Eclipse33WS/.metadata/.plugins/org.eclipse.pde.core/Eclipse Application/dev.properties' -pdelaunch -os win32 -ws win32 -arch x86 

As mentioned in comment #7, the failure is caused by the single quotes used in the -configuration and -dev arguments. When the process is launched, the single quotes must be replace with double quotes (") for Eclipse to start properly.

Based on comments #8 and #9, it seems that there is an agreement that the Agent Controller must replace the single quotes in these arguments with double quotes before launching the Java process. However, I am not sure that this was implemented and I don't see any such logic in the attached AC patches.

Re-opening this bug.
Comment 21 Igor Alelekov CLA 2007-05-14 09:42:18 EDT
Asaf, 
patch (Execution patch) fixing the defect is steel uncommitted (AC patch was committed). 
The idea is to provide a transparent channel for single and double quotas.

Guru,
Could you please review and commit the Execution patch?
Comment 22 Guru Nagarajan CLA 2007-05-14 11:30:33 EDT
*** Bug 186650 has been marked as a duplicate of this bug. ***
Comment 23 jkubasta CLA 2007-05-24 09:22:17 EDT
What patch needs to be committed in order to resolve this defect as fixed please?
Comment 24 Igor Alelekov CLA 2007-05-24 09:24:00 EDT
Execution patch only since AC patch was already committed.
Comment 25 Vitaly Provodin CLA 2007-05-24 09:30:12 EDT
With the Execution patch there was a problem :
  1) start Eclipse
  2) run debugging Eclipse Application
  3) in the started workbench, run profiling any Java application 

In result in console of this application (which is available in the debugging workbench) was the following:

Usage: java [-options] class [args...]
...

that means the command line for profiled app was incorrectly composed.
Could you please revise this?
Comment 26 Guru Nagarajan CLA 2007-05-24 09:32:26 EDT
Igor - please see Vitaly's comments.
Comment 27 Igor Alelekov CLA 2007-05-24 09:37:24 EDT
(In reply to comment #25)
> With the Execution patch there was a problem :
>   1) start Eclipse
>   2) run debugging Eclipse Application
>   3) in the started workbench, run profiling any Java application 
> In result in console of this application (which is available in the debugging
> workbench) was the following:
> Usage: java [-options] class [args...]
> ...
> that means the command line for profiled app was incorrectly composed.
> Could you please revise this?

Vitaly,
The patch consists of two parts - AC patch and client patch.
It seems that AC build you tested had client patch checked in only, since Samson checked AC patch in later. And when AC patch was committed, Guru rolled back the client patch.

Could you please test the Execution patch again?
Comment 28 Vitaly Provodin CLA 2007-05-24 09:47:38 EDT
(In reply to comment #27)
> Vitaly,
> The patch consists of two parts - AC patch and client patch.
> It seems that AC build you tested had client patch checked in only, since
> Samson checked AC patch in later.

Ok.

BTW I tested it at 2007-05-04 believing that both patches were applied. I see in CVS history the AC patch was applied at 2007-05-03. Unfortunately I have no chance to see build report for this period. 
Comment 29 Guru Nagarajan CLA 2007-05-29 00:35:39 EDT
*** Bug 189477 has been marked as a duplicate of this bug. ***
Comment 30 Guru Nagarajan CLA 2007-05-29 12:42:23 EDT
Checked in the reverted fix.
Comment 31 Paul Slauenwhite CLA 2009-06-30 13:25:35 EDT
As of TPTP 4.6.0, TPTP is in maintenance mode and focusing on improving quality by resolving relevant enhancements/defects and increasing test coverage through test creation, automation, Build Verification Tests (BVTs), and expanded run-time execution. As part of the TPTP Bugzilla housecleaning process (see http://wiki.eclipse.org/Bugzilla_Housecleaning_Processes), this enhancement/defect is verified/closed by the Project Lead since this enhancement/defect has been resolved and unverified for more than 1 year and considered to be fixed. If this enhancement/defect is still unresolved and reproducible in the latest TPTP release (http://www.eclipse.org/tptp/home/downloads/), please re-open.