Bug 126174 - UI freezes because of hyperlink detector
Summary: UI freezes because of hyperlink detector
Status: RESOLVED FIXED
Alias: None
Product: JDT
Classification: Eclipse Project
Component: Text (show other bugs)
Version: 3.1   Edit
Hardware: PC Windows XP
: P3 normal (vote)
Target Milestone: 3.2 M6   Edit
Assignee: Dani Megert CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2006-02-02 07:41 EST by Jerome Lanneluc CLA
Modified: 2006-02-21 05:14 EST (History)
2 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Jerome Lanneluc CLA 2006-02-02 07:41:40 EST
I20051215

According to the stack traces posted in bug 121652, it looks like the UI is freezing while waiting for ClassFile#codeSelect(...) to return (codeSelect is done inside the main thread).

Indenpendantly of the problem reported in bug 121652, codeSelect can take an arbitrary amount of time and should not run in the UI thread.
Comment 1 Dani Megert CLA 2006-02-02 08:05:13 EST
What makes you think that this call in the main thread got triggered by hovering?

In some places, like pressing F3 or Ctrl+Click we have to do codeSelect(...) in the UI thread.
Comment 2 Jerome Lanneluc CLA 2006-02-02 08:41:15 EST
Sorry you're right. It is the hyperlink detector that causes the UI to freeze. Updated title accordingly.
Comment 3 Dani Megert CLA 2006-02-02 08:57:06 EST
There are no plans to change this. We don't call codeResolve() when moving with the mouse but only when the user wants to navigate i.e. already pressed the Ctrl key.
Comment 4 David Williams CLA 2006-02-02 09:49:06 EST
(In reply to comment #3)
> We don't call codeResolve() when moving with
> the mouse but only when the user wants to navigate i.e. already pressed the
> Ctrl key.
> 

For my education (and othes) why does this make it "ok" to freeze the UI thread? 
Comment 5 Dani Megert CLA 2006-02-02 10:10:26 EST
>For my education (and othes) why does this make it "ok" to freeze the UI
>thread? 
Sorry, but that isn't meant as a free ticket to freeze the UI ;-)

For 90% of the code actions (e.g. refactoring, format, etc, navigation like F3) we use codeSelect(...) since we must get the Java element at the cursor position. Almost all JDT actions which are initiated by the user are using this pattern. Other stuff, like hovering or feeding a view which shows additional info is done in a separate background thread. I would expect to codeResolve to perform in a reasonable amount of time - taking one minute is simply not acceptable.

Jerome, do you indeed suggest that JDT UI rewrites all its actions and first performs a codeSelect(...) in a background thread and then forks back to start the action?
Comment 6 Jerome Lanneluc CLA 2006-02-02 10:24:17 EST
I agree that taking one minute for codeSelect is not acceptable and I'm working on it in bug 121652.

However you'll always find a user that wants to put its huge jar on a slow network drive and in this case, we can do all the optimization that we can, it is still going to take some time (several seconds) before codeSelect returns.

So yes, I think that codeSelect should not be called in the UI thread.
Comment 7 Dani Megert CLA 2006-02-16 11:34:22 EST
I've removed the 'synchronize' around the codeSelect(...) which will not help if codeSelect(...) itself takes long but it will at least not wait while the CU is blocked by another thread. This will be committed right after M5.
Comment 8 Dani Megert CLA 2006-02-21 05:14:15 EST
Fixed in HEAD.
Available in builds > N20060221-0010.