Bug 343837 - Java IDE hangs after attempt to paste some lines from one Java file to another
Summary: Java IDE hangs after attempt to paste some lines from one Java file to another
Status: CLOSED WONTFIX
Alias: None
Product: JDT
Classification: Eclipse Project
Component: Core (show other bugs)
Version: 3.7   Edit
Hardware: PC Windows XP
: P3 normal (vote)
Target Milestone: ---   Edit
Assignee: Ayushman Jain CLA
QA Contact:
URL:
Whiteboard: stalebug
Keywords:
Depends on:
Blocks:
 
Reported: 2011-04-26 09:00 EDT by Mark Hagan CLA
Modified: 2020-03-03 18:48 EST (History)
5 users (show)

See Also:


Attachments
Debug console incl. thread dumps (138.79 KB, text/plain)
2011-04-26 09:02 EDT, Mark Hagan CLA
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description Mark Hagan CLA 2011-04-26 09:00:56 EDT
Build Identifier: 20100917-0705

I'll attach the dump of the debug console with a set of thread dumps I took. The initial ones are some seconds apart. The last is a few minutes after that.

This has happened before but we were not able to resolve it. It looks like it only started again after I had to change between projects. I have a different project for each dev version of our app and have just had to close one, open another one and work with it. The clearcase view (where the project source lives) had also only just been updated (maybe a hint at indexing?). We do not use any of the Builders in Eclipse (i.e. Java, Ant)


Reproducible: Sometimes

Steps to Reproduce:
Not possible to say exactly as I don't know 100% what causes it to start. Once it starts it happens all the time:-
1. Select block of Java code in file 1
2. Paste block into Java file 2
3. IDE will hang immediately.
Comment 1 Mark Hagan CLA 2011-04-26 09:02:20 EDT
Created attachment 194049 [details]
Debug console incl. thread dumps
Comment 2 Mark Hagan CLA 2011-04-26 09:16:07 EDT
FYI..Even after shutting down and restarting eclipse the hang occurs on EVERY copy paste. If there is any information I can gather while it is in this state please let me know although I won't be able to put up with it as it is for too long.
Comment 3 Olivier Thomann CLA 2011-04-26 09:22:30 EDT
Does this also occur in a normal text editor ?
Comment 4 Mark Hagan CLA 2011-04-26 09:24:56 EDT
No. I just tried a copy and paste between two XML files and they are fine.
Comment 5 Mark Hagan CLA 2011-04-26 09:38:32 EDT
I also just tried Java to txt file and then txt file to Java and this behaved ok. But Java to Java direct hangs.
Comment 6 Ayushman Jain CLA 2011-04-26 09:40:13 EDT
The problem seems to come from 
"main" prio=6 tid=0x00907400 nid=0x14b0 waiting on condition [0x0012e000..0x0012fd64]
   java.lang.Thread.State: TIMED_WAITING (sleeping)
        at java.lang.Thread.sleep(Native Method)
        at org.eclipse.jdt.internal.core.search.processing.JobManager.performConcurrentJob(JobManager.java:258)
        at org.eclipse.jdt.internal.core.search.BasicSearchEngine.searchAllTypeNames(BasicSearchEngine.java:1383)
        at org.eclipse.jdt.core.search.SearchEngine.searchAllTypeNames(SearchEngine.java:892)
        at org.eclipse.jdt.internal.core.dom.rewrite.ImportRewriteAnalyzer.evaluateStarImportConflicts(ImportRewriteAnalyzer.java:785)
        at org.eclipse.jdt.internal.core.dom.rewrite.ImportRewriteAnalyzer.getResultingEdits(ImportRewriteAnalyzer.java:583)
        at org.eclipse.jdt.core.dom.rewrite.ImportRewrite.rewriteImports(ImportRewrite.java:1065)
        at org.eclipse.jdt.internal.ui.javaeditor.ClipboardOperationAction.addImports(ClipboardOperationAction.java:526)
        at org.eclipse.jdt.internal.ui.javaeditor.ClipboardOperationAction.doPasteWithImportsOperation(ClipboardOperationAction.java:492)


Not sure why this hangs though, and why is the rewriteImports(..) being invoked at all.

Mark, does this still happen if you copy the source, skipping the imports?
Comment 7 Mark Hagan CLA 2011-04-26 09:44:13 EDT
It seems to paste OK if I disable 'update imports'
Comment 8 Ayushman Jain CLA 2011-04-26 09:48:27 EDT
(In reply to comment #7)
> It seems to paste OK if I disable 'update imports'

Thats good. You atleast have a workaround till we investigate! :)
Comment 9 Mark Hagan CLA 2011-04-26 09:51:24 EDT
Yup. I can cope with that as a workaround. Thanks.
Comment 10 Ayushman Jain CLA 2011-04-26 10:09:35 EDT
It would help if you could provide a testcase/your workspace projects (if possible) so that we can investigate why this happens. Thanks!
Comment 11 Mark Hagan CLA 2011-04-26 10:23:36 EDT
I don't think I can do that. It's about 60K java source files and obviously proprietary source. Is there any other way?
Comment 12 Ayushman Jain CLA 2011-04-26 11:26:04 EDT
(In reply to comment #11)
> I don't think I can do that. It's about 60K java source files and obviously
> proprietary source. Is there any other way?

If its possible to extract a dummy compilable snippet that can mirror this problem, it would be great.
Comment 13 Mark Hagan CLA 2011-04-26 11:47:05 EDT
(In reply to comment #12)
> (In reply to comment #11)
> > I don't think I can do that. It's about 60K java source files and obviously
> > proprietary source. Is there any other way?
> 
> If its possible to extract a dummy compilable snippet that can mirror this
> problem, it would be great.

Sorry. What I mean is that there are approx 60,000 java source files in the project and not that the java source file is 60KB in size.
Comment 14 Dani Megert CLA 2011-04-26 12:14:14 EDT
It looks like the Java indexer is not yet done when the operation is performed.
Comment 15 Dani Megert CLA 2011-04-26 12:15:48 EDT
Mark, does it hang forever or will it complete at some point?
Comment 16 Mark Hagan CLA 2011-04-26 12:24:25 EDT
I've left it for as long as I can (a few minutes) so I really can't say unequivocally that it will never come back. I captured the thread dumps hoping they would show if it was doing something or whether it was truly hung.

If the problem is that it is rebuilding its indexes and these need to be in place for a paste to include imports then perhaps 'paste' logic should first check to see if the indexes are being rebuilt and, if so, paste the content but reply with a message to say something like "you need to manually do imports"
Comment 17 Dani Megert CLA 2011-05-02 07:20:45 EDT
The reason why the search is done on paste is because we try to resolve on-demand import conflicts. We should allow to cancel the updating of imports in case it takes too long (filed bug 344436 to track that).
Comment 18 Eclipse Genie CLA 2020-03-03 18:48:38 EST
This bug hasn't had any activity in quite some time. Maybe the problem got resolved, was a duplicate of something else, or became less pressing for some reason - or maybe it's still relevant but just hasn't been looked at yet. As such, we're closing this bug.

If you have further information on the current state of the bug, please add it and reopen this bug. The information can be, for example, that the problem still occurs, that you still want the feature, that more information is needed, or that the bug is (for whatever reason) no longer relevant.

--
The automated Eclipse Genie.