Bug 75946 - Clipboard commands take excessively long
Summary: Clipboard commands take excessively long
Status: RESOLVED DUPLICATE of bug 72258
Alias: None
Product: JDT
Classification: Eclipse Project
Component: Core (show other bugs)
Version: 3.1   Edit
Hardware: PC Linux
: P2 normal (vote)
Target Milestone: ---   Edit
Assignee: JDT-Core-Inbox CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2004-10-08 14:43 EDT by Matthew Conway CLA
Modified: 2004-11-16 09:30 EST (History)
2 users (show)

See Also:


Attachments
trace of frozen eclipse after ctrl-c op (15.01 KB, text/plain)
2004-10-13 11:41 EDT, Matthew Conway CLA
no flags Details
copy hang trace (15.27 KB, text/plain)
2004-10-18 11:30 EDT, Matthew Conway CLA
no flags Details
cut hang trace (19.87 KB, text/plain)
2004-10-18 11:30 EDT, Matthew Conway CLA
no flags Details
revert hang trace (17.10 KB, text/plain)
2004-10-18 11:31 EDT, Matthew Conway CLA
no flags Details
pre hang trace (10.56 KB, text/plain)
2004-10-18 11:32 EDT, Matthew Conway CLA
no flags Details
post hang trace (8.59 KB, text/plain)
2004-10-18 11:33 EDT, Matthew Conway CLA
no flags Details
trace of hang on I20041101 (16.34 KB, text/plain)
2004-11-02 11:53 EST, Matthew Conway CLA
no flags Details
hprof output (326.71 KB, application/octet-stream)
2004-11-09 16:13 EST, Matthew Conway CLA
no flags Details
Trace while doing a cut/copy (1.57 MB, application/octet-stream)
2004-11-12 11:59 EST, Matthew Conway CLA
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description Matthew Conway CLA 2004-10-08 14:43:52 EDT
If I cut/copy/paste within a java editor, I can end up waiting a few
seconds for eclipse to return control to me.  This on a hyperthreaded xeon
2.6Ghz machine with 2 GB of RAM, so I don't think the hardware is the
problem.
The CPU is pegged during this freeze, and funnily enough KDE is
completely unresponsize till I get back control (though I think this is a
KDE/java interop issue as I don't have the same problem with gnome)

This is very repeatable, and happens with almost every use of of the
clipboard commands - If I stay in the same editor, the pauses will
sometimes go away, but they come back if I switch to another editor and
back.

Needless to say, this makes eclipse 3.1M2 unusable, so I've switched back
to 3.0.1

I run eclipse with like "/opt/eclipse/eclipse -data
/home/conway/eclipse-config/workspace -vmargs
-Xmx512M", and this failue occurs even on a clean eclipse install (no plugins,
no workspace and no ~/.eclipse)
Comment 1 Dani Megert CLA 2004-10-11 06:58:09 EDT
see:
http://dev.eclipse.org/viewcvs/index.cgi/%7Echeckout%7E/platform-text-home/development/bug-incomplete.htm

In addition:
- how big is the file?
- how big is the selection that you copy?
Comment 2 Matthew Conway CLA 2004-10-12 15:59:36 EDT
build eclipse 3.1M2
Fedora linux core 2
jdk build 1.4.2_04-b05

The problem occurs regardless of the size of the file or the size of the selection.

It happens on a stock eclipse 3.1M2 install - that is I removed ~/.eclipse and
used a new workspace.  All I do is import an existing project into that
workspace. I don't change any of the default eclipse settings.


It does not happen when I use clipboard from a simple project, but does when I
use from the complex project I imported.  This complex project has about 200
source folders.  If I remove all but one, then the problem seems to go away, so
it looks like a scalability issue w.r.t. the number of source folders in a project

Elcipse 3.0.0/1 doesn't have this problem.


Comment 3 Dani Megert CLA 2004-10-13 03:26:17 EDT
The link in comment 1 explains how to create VM dumps. We need those to see
where the time is spent. How much memory do you give to eclipse (-vmargs ...)?
Anything in .log?
Comment 4 Matthew Conway CLA 2004-10-13 11:40:52 EDT
Nothing in log
-vmargs -Xmx512m
Attaching a dump taken while eclipse was frozen waiting for the ctrl-c to complete.
Comment 5 Matthew Conway CLA 2004-10-13 11:41:41 EDT
Created attachment 15140 [details]
trace of frozen eclipse after ctrl-c op
Comment 6 Dani Megert CLA 2004-10-18 04:45:10 EDT
Do you see this after startup or after working for a quite a while?
Comment 7 Dani Megert CLA 2004-10-18 05:55:11 EDT
The trace shows that the AST is created where it shouldn't.
Comment 8 Dani Megert CLA 2004-10-18 06:49:55 EDT
It is OK that the AST is created here: if cut is hit in a situation where
reconciling was in progress the reconciling gets cancelled and ast=null returned
instead. The AST provider needs to set the cache to null because otherwise a
wrong AST would be returned. The AST has to be created and returned.
Comment 9 Dani Megert CLA 2004-10-18 06:50:26 EDT
Did you use copy or cut for the attached VM dump? Could you provide an
additional dump?
Comment 10 Dani Megert CLA 2004-10-18 06:50:49 EDT
Most likely related to bug 76377.
Comment 11 Matthew Conway CLA 2004-10-18 10:53:11 EDT
This happens very soon after startup  Not always immediately, but within a few
operations.  That is, I duplicate it with a clean workspace, so I have nothing
to work on, so it has happen pretty quick to keep my interest =)

I used a copy (ctrl-c) for the dump.
Do you want a dump for cut?


Comment 12 Dani Megert CLA 2004-10-18 10:59:07 EDT
Yes please. add some more dumps (for cut and paste) to see whether it's always
the same location.
Comment 13 Matthew Conway CLA 2004-10-18 11:29:23 EDT
Ok, I did it for copy, cut.
Couldn't get it to happen for paste.
Also hangs on revert file, so did it there too.
Attaching below.


Comment 14 Matthew Conway CLA 2004-10-18 11:30:18 EDT
Created attachment 15250 [details]
copy hang trace
Comment 15 Matthew Conway CLA 2004-10-18 11:30:46 EDT
Created attachment 15251 [details]
cut hang trace
Comment 16 Matthew Conway CLA 2004-10-18 11:31:11 EDT
Created attachment 15252 [details]
revert hang trace
Comment 17 Matthew Conway CLA 2004-10-18 11:32:24 EDT
Created attachment 15253 [details]
pre hang trace

A trace right after startup before any hangs have occurred
Comment 18 Matthew Conway CLA 2004-10-18 11:33:53 EDT
Created attachment 15254 [details]
post hang trace

A trace while not hung, but after performing all the other clipboard hang
traces
Comment 19 Dani Megert CLA 2004-11-02 03:57:00 EST
Do you still see this using I200411010800 or newer?
Comment 20 Matthew Conway CLA 2004-11-02 11:52:55 EST
Yes - problem is still present on 200411010800
Attaching a new stack trace

Comment 21 Matthew Conway CLA 2004-11-02 11:53:44 EST
Created attachment 15565 [details]
trace of hang on I20041101
Comment 22 Dani Megert CLA 2004-11-08 09:48:36 EST
We cannot reproduce this. There are two more things we can try:

1) add an .options file to Eclipse install location (where startup.jar is) with
the following line:
org.eclipse.jdt.core/debug/resolution=true
and add -debug to your command line options. This will enable tracing. Attach
the trace which is written when cut and one when copy takes long.

2) provide a step-by-step test case which starts from scratch
Comment 23 Matthew Conway CLA 2004-11-09 16:11:56 EST
The trace doesn't seem to be taking effect - when .options was in my eclipse
install directory, it wasn't mentioned when I ran with -debug.  If I put it in
the CWD when starting with -debug, it was mentioned, but nothing was output to
standard out after the initial verbiage from startup.

I also created an hprof dump which I'll attach - hopefully you'll be able to see
where all the time was being spent.

Comment 24 Matthew Conway CLA 2004-11-09 16:13:46 EST
Created attachment 15763 [details]
hprof output

Ran with "/opt/eclipse-3.1M3/eclipse -vmargs -Xmx512M
-Xrunhprof:cpu=samples,file=hprof.txt,thread=y"  then forced a hang 5 or 6
times to saturate cpu usage with correct stats.
Comment 25 Dani Megert CLA 2004-11-10 06:04:56 EST
Looks like reading the jar/zip files takes long. Jerome, did you hear about such
a problem? Can you please take a quick look at the hprof output and see whether
you see something suspicious?

Please try to run with the .options file again. We really need that data.
You could also use the following syntax:
-debug <fullpath_to_options_file>

i.e.
1. Edit <install_dir>/eclipse/plugins/org.eclipse.jdt.core_3.1.0
   ==> set 
2. start with:
-debug <install_dir>/eclipse/plugins/org.eclipse.jdt.core_3.1.0/.options

The console should then show (after some other initial debug output):

Debug options:
    file:/<install_dir>/eclipse/plugins/org.eclipse.jdt.core_3.1.0/.options loaded
Comment 26 Jerome Lanneluc CLA 2004-11-10 08:00:55 EST
No I'm not seeing anything suspicious in the hprof file. 
Matthew, in addition to putting org.eclipse.jdt.core/debug/resolution=true,
please add the following line: org.eclipse.jdt.core/debug/javamodel=true
Comment 27 Matthew Conway CLA 2004-11-12 11:59:09 EST
Created attachment 15825 [details]
Trace while doing a cut/copy

Search for *** for point in the trace right before I executed a cut/copy which
took a long time.  Just to recap - this problem exhibits itself on a project
with > 200 source paths and many jars in the classpath, if I reduce either of
those two variables, the problem goes away.  However, the problem did not exist
in 3.0.1, so  hopefully it can be fixed.
Comment 28 Dani Megert CLA 2004-11-15 09:44:43 EST
Jerome, can you take a look at the latest trace. You better know how to read
your debug output. Thanks.
Comment 29 Jerome Lanneluc CLA 2004-11-16 09:07:44 EST
You're hitting the upper limit of the Java model cache. In an effort to reduce
the memory used by Eclipse, this limit was set to 200 package fragment roots.

Controlling this limit is reported as bug 72258.

In the meantime, I would suggest to separate your source folders in different
projects. This should improve things as only one project is looked at a time.
Comment 30 Dani Megert CLA 2004-11-16 09:28:15 EST
reopen to close as dup
Comment 31 Dani Megert CLA 2004-11-16 09:30:34 EST
As outlined in comment 30 this will be fixed once bug 72258 has been fixed.

In my opinion bug 72258 is not an enhancement but a bug as we can see from this
report.

*** This bug has been marked as a duplicate of 72258 ***