Bug 252357 - [performance] Context menu takes a while to pop up when Saving Profile job is going
Summary: [performance] Context menu takes a while to pop up when Saving Profile job is...
Status: RESOLVED FIXED
Alias: None
Product: Target Management
Classification: Tools
Component: RSE (show other bugs)
Version: 3.0.1   Edit
Hardware: PC Windows XP
: P2 major (vote)
Target Milestone: 3.1 M3   Edit
Assignee: David Dykstal CLA
QA Contact: Martin Oberhuber CLA
URL:
Whiteboard:
Keywords: performance
Depends on:
Blocks: 254842
  Show dependency tree
 
Reported: 2008-10-28 09:49 EDT by Kevin Doyle CLA
Modified: 2008-12-02 17:26 EST (History)
4 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Kevin Doyle CLA 2008-10-28 09:49:09 EDT
When the saving profile job is going on, sometimes the context menu takes a while to appear.

Steps to Reproduce:
0. Create a new connection.
1. Right click on Local and select Properties.
2. Click Okay.  A Saving Profile job will start shortly.
3. Right click on any subsystem of the new connection you created while the saving profile job is going.
--> Context menu will take a few seconds to pop up.  On one of our slow machines it takes 30 seconds.  After it pops up a few seconds later the saving job is happening again.

Another way to reproduce:
1. Create a new connection.
2. When the saving profile job is running right click on the Files subsystem of that new connection.
Comment 1 Kevin Doyle CLA 2008-10-28 10:13:03 EDT
I tried reproducing with just RSE and couldn't, but if I installed user actions and loaded them up first the saving profile job took long enough to see the problem.
Comment 2 Martin Oberhuber CLA 2008-10-28 11:44:20 EDT
Do you see any entries in the error log? If the delay is caused by a deadlock due to bundle activation for bringing up the context menu (causing a 5 second wait), it should show up in the error log.

As I have repeatedly said, I think that the "saving profile" job itself may be part of the problem. We don't have such vast amounts of data to save that it would justify to take even a second to save. Yet I observe the "saving profile" running much longer at times. I think that a separate bug is open for that.

30 seconds wait time for a context menu to pop up is clearly unacceptable from a product perspective. A thread dump during that 30 second wait time should be helpful. Given that you likely cannot switch UI focus while the context menu waits for popping up, you'll likely have to create that thread dump from a different machine.

On Linux, this is quite easy (log in from a different machine and send a 
    kill -QUIT
signal to the Eclipse process that you want the thread dump from. On Windows, you'll either need 
(a) some way to log in remotely (with a separate Windows dstore daemon and RSE
    for instance; then if you use JDK 1.6 you can use jps / jstack to get the 
    Thread dump, or
(b) Start Eclipse with -vmargs -Xdebug and perform remote debugging [1]

[1] For more information on getting a Thread Dump from a remote machine, see
http://wiki.eclipse.org/How_to_report_a_deadlock#Remote_Diagnosis
Comment 3 Kevin Doyle CLA 2008-10-28 12:00:51 EDT
(In reply to comment #2)
> Do you see any entries in the error log? If the delay is caused by a deadlock
> due to bundle activation for bringing up the context menu (causing a 5 second
> wait), it should show up in the error log.

Nothing shows up in the Error Log.

> As I have repeatedly said, I think that the "saving profile" job itself may be
> part of the problem. We don't have such vast amounts of data to save that it
> would justify to take even a second to save. Yet I observe the "saving profile"
> running much longer at times. I think that a separate bug is open for that.

I agree. Bugs Open: Bug 197043, Bug 243919, Bug 244172

> 30 seconds wait time for a context menu to pop up is clearly unacceptable from
> a product perspective. A thread dump during that 30 second wait time should be
> helpful. Given that you likely cannot switch UI focus while the context menu
> waits for popping up, you'll likely have to create that thread dump from a
> different machine.
> 
> On Linux, this is quite easy (log in from a different machine and send a 
>     kill -QUIT
> signal to the Eclipse process that you want the thread dump from. On Windows,
> you'll either need 
> (a) some way to log in remotely (with a separate Windows dstore daemon and RSE
>     for instance; then if you use JDK 1.6 you can use jps / jstack to get the 
>     Thread dump, or
> (b) Start Eclipse with -vmargs -Xdebug and perform remote debugging [1]
> 
> [1] For more information on getting a Thread Dump from a remote machine, see
> http://wiki.eclipse.org/How_to_report_a_deadlock#Remote_Diagnosis
> 

Don't have access to a Linux machine.  Will see if I can figure out a way to do this for windows when I get some time.
Comment 4 Martin Oberhuber CLA 2008-10-28 12:18:29 EDT
On Windows, I recommend the "Remote Debug" approach, it's really easy to do:
http://wiki.eclipse.org/How_to_report_a_deadlock#Remote_Debug_Connection

#  On target machine, launch
   eclipse -vmargs -Xdebug -Xnoagent -Djava.compiler=NONE \
           -Xrunjdwp:transport=dt_socket,server=y,suspend=n,address=5005

# On debug machine, launch Eclipse, create a new Debug Launch of type
  "Remote Java Application" and enter the hostname / port number (5005) 
Comment 5 David Dykstal CLA 2008-10-28 14:33:07 EDT
I believe the problem is due to the number of files being written for profiles that contain compile commands. There are a large number of definitions, each one written as a separate property set. Furthermore the tree is fairly deep due to the use of nesting in the property sets.

The best way to handle this is to merge the profile into its persistent form rather than rewriting it in its entirety. In addition we should be recognizing exactly which files need to be rewritten. The beginnings of such merge support are in the DOM handling classes, but merging is difficult and should be done with care.

There could also be hints added to property sets that can indicate where the file boundaries should be. The DOM reader and writer are capable of nesting nodes either in a single file or as separate files in a directory structure. We make assumptions about this in the non-property-set nodes of the profile and thus make a trade-off between the number of files written and the volatility of each file.
Comment 6 Martin Oberhuber CLA 2008-10-28 14:44:15 EDT
Dave did you run a profiler to verify your assumption? I've been told that YourKit is good and simple to use: http://www.yourkit.com/
Comment 7 David McKnight CLA 2008-10-28 14:47:00 EDT
Since this seems to be a profile writing issue, I'm reassigning to Dave D.
Comment 8 David Dykstal CLA 2008-10-28 15:36:04 EDT
(In reply to comment #6)
> Dave did you run a profiler to verify your assumption? I've been told that
> YourKit is good and simple to use: http://www.yourkit.com/
> 

No, but I've seen the problem. The is a *lot* of disk activity when using compile command definitions. The property sets in one of my profiles takes 600 files and 600 folders to write. It's clearly a data-to-file allocation problem.
Comment 9 Martin Oberhuber CLA 2008-10-28 16:14:34 EDT
Gosh. 600 files and folders is evil.
I daresay there is a flaw in the way the data is partitioned...
Comment 10 David Dykstal CLA 2008-10-29 13:20:33 EDT
Fixed by making nested property sets and properties embedded nodes in the persistent form. This change is completely backward and forward compatible since the persistent form can be written and read by the current support in either scheme.

This fix drastically reduces the number of files written for a profile that uses property sets such as those defining compile commands and user defined actions.
Comment 11 Kevin Doyle CLA 2008-11-04 11:20:22 EST
Can we backport this fix?  The difference with and without this is huge.  Thanks Dave!!
Comment 12 David Dykstal CLA 2008-11-04 16:17:04 EST
(In reply to comment #11)
> Can we backport this fix?  The difference with and without this is huge. 
> Thanks Dave!!
> 

I certainly plan on this. The fix is very self-contained and repairs existing profiles as well.
Comment 13 Martin Oberhuber CLA 2008-11-11 04:33:15 EST
Bug 254842 now tracks this important backport.
Comment 14 Martin Oberhuber CLA 2008-12-02 17:18:16 EST
CQ:WIND00146302