Bug 133348 - Content Assist blocks the UI thread when working behind a firewall
Summary: Content Assist blocks the UI thread when working behind a firewall
Status: RESOLVED DUPLICATE of bug 129168
Alias: None
Product: JDT
Classification: Eclipse Project
Component: Core (show other bugs)
Version: 3.2   Edit
Hardware: PC Windows XP
: P3 normal (vote)
Target Milestone: 3.2 RC2   Edit
Assignee: Olivier Thomann CLA
QA Contact:
URL:
Whiteboard:
Keywords:
: 133817 134061 135225 140642 (view as bug list)
Depends on:
Blocks:
 
Reported: 2006-03-27 08:50 EST by Peter Voss CLA
Modified: 2007-03-19 06:03 EDT (History)
7 users (show)

See Also:


Attachments
Error log (34.08 KB, text/plain)
2006-03-29 03:16 EST, Damien Lecan CLA
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description Peter Voss CLA 2006-03-27 08:50:27 EST
Hi,

when upgrading from 3.2-M3 to 3.2M5 I discovered the following problem with content assist in java editors:

When typing sun.awt. and hitting ctrl-space the content assist window opens and shows its contents. But the UI thread is blocked for the next 10-30 seconds. When navigating through the list the UI gets blocked again on each item, that has no source code attachment.

This problem only occur when working behind a firewall. When I disconnect from the network the problem disappears. I assume that some network lookup is done when no source code is available in order to display the api doc tooltip.

The problem probably was introduced with 3.2M4 since a colleague of mine told me that he has the same problem with 3.2M4 (he is working for a different company but they have a firewall as well).
Comment 1 Dani Megert CLA 2006-03-27 08:59:30 EST
What firewall are you using?

Blocking the UI thread is covered in bug 129168.

Moving to JDT Core to check if they can improve getting remote Javadoc in case of firewalls.
Comment 2 Olivier Thomann CLA 2006-03-27 10:19:27 EST
We use the java.net classes to retrieve the javadoc.
I don't see what we could do.
A workaround would be to use a local javadoc.
Comment 3 Dani Megert CLA 2006-03-27 10:25:39 EST
You could retrieve the Javadoc in a separate thread to make sure that the timeout set in JDT Core preference is respected.
Comment 4 Olivier Thomann CLA 2006-03-27 11:37:25 EST
The timeout is only used when retrieving the method parameters' names.
Adding another timeout might be confusing.
Comment 5 Olivier Thomann CLA 2006-03-27 13:02:33 EST
I think behind a firewall the best solution is to use a local url.
Comment 6 Peter Voss CLA 2006-03-28 02:02:18 EST
Sure, I was doing that. I am using local javadoc wherever possible, otherwise 3.2M5 would be unusable for me. I am using content assist every third key-stroke and I am usually doing that to safe time and not to waste it. ;)

In my opinion the only option is to separate the lookups from the UI thread. Any operation that has no guarantee how long it will run or how long it will block the current thread should not be put in the UI thread anyway. And retrieving data from a remote network using the java.net package are of such nature.

Please keep in mind that this really needs to be fixed. I am the only one in my company that figured out what the problem is and what workaround could be used. Other reports from colleagues where much less specific like: "M4/M5 gets stuck every couple of times." Even disabling the javadoc lookup feature from a preference page is of no great help if the user does not know that the UI freeze has something to do with network lookups and is caused by this feature.
Comment 7 Damien Lecan CLA 2006-03-29 03:16:18 EST
Created attachment 37181 [details]
Error log

Yes, I am behind a firewall too. I have to configure a http proxy to connect on internet.
The problem still occurs with Eclipse 3.2 I20060328-0010.

Another test : I remove javadoc attachement in JRE configuration. So neither src.zip nor http://java.sun.com/j2se/1.5.0/docs/api/ are configured in my jre. For each runtime jars.
Source attachement : (none)
Javadoc location : (none)

And the problem still occurs ! How to disable remote javadoc check-out when we are behind a firewall ?

My error log with new full stack trace is in attachement.
Comment 8 Dani Megert CLA 2006-03-29 03:24:51 EST
Indeed strange that it happens without any attachements.
Comment 9 Dani Megert CLA 2006-03-29 09:17:19 EST
*** Bug 133817 has been marked as a duplicate of this bug. ***
Comment 10 Dani Megert CLA 2006-03-29 09:21:26 EST
>I think behind a firewall the best solution is to use a local url.
The API should detect this case and be smart otherwise every client of that API will be affected when used behind a firewall and the user might not immediately know why something is taking so long. If this case can't be detected I see two solutions:
1) allow clients to specify a timeout via API
2) add a preference for this
3) apply your own internal timeout but this might be problematic
Comment 11 Olivier Thomann CLA 2006-03-30 10:33:29 EST
*** Bug 134061 has been marked as a duplicate of this bug. ***
Comment 12 Olivier Thomann CLA 2006-03-30 11:18:56 EST
The problem seems to be that the javadoc property is still set for the package fragment root even if the javadoc attachment has been removed.
Comment 13 Olivier Thomann CLA 2006-03-30 11:34:33 EST
I see three issues there.
1) If the source attachment is removed, looking for it should return null.
2) If a connection failed, I wonder if we do the right thing to log the error. If a user has no connection (because the internet is temporary down), he will end up with the .log file swamped with connection failures.
3) Once a connection failed for a type, we should remember it and not try to retrieve the doc again next time.

I'll investigate why the javadoc attachment is still found even if it was removed.
I don't plan to fix this for M6 as this might be a pretty risky fix, but I'll try to fix it asap post M6.
Comment 14 Olivier Thomann CLA 2006-03-30 12:30:21 EST
I could not reproduce the caching problem with current build.
Damien,

Could you please try to reproduce your issue in comment 7 with the upcoming 20060330-1200 build ?

Thanks.
Comment 15 Damien Lecan CLA 2006-03-30 15:22:05 EST
I will try asap, but I'm pretty busy this week. Next monday will be better for me to make new tests.
Comment 16 Damien Lecan CLA 2006-04-03 05:24:12 EDT
I tried with Eclipse 3.2m6, the ui thread is still blocked when Eclipse tries to checkout remote javadoc.

Same result if javadoc attachement is "none" in jre configuration.
Comment 17 Olivier Thomann CLA 2006-04-05 22:03:43 EDT
What did you do to remove the javadoc attachment?
It looks like somehow the javadoc attachment is not completely removed.
Comment 18 Damien Lecan CLA 2006-04-06 09:51:51 EDT
I edited the javadoc location, then removed manually the link and finally clicked ok, for each jvm jars.
Comment 19 Olivier Thomann CLA 2006-04-06 09:56:52 EDT
Can you try to put the link back and then remove it using Apply + OK?
If it works, there is a bug in the way the preference is removed if using only OK.
Thanks.

I can also add some tracing in debug mode to display the javadoc location. Then it would be trivial to find out whether the value is removed or not.
Comment 20 Olivier Thomann CLA 2006-04-07 13:01:17 EDT
I think we have two problems here:
- code assist is too slow and blocks the UI thread.
- even if the javadoc attachment is gone, retrieving the javadoc still tries to open a connection.
I open bug 135604 for the second problem.

Markus or Daniel,
The only way to fix this would be to add a time out and retrieve the javadoc in a different thread. In what situation is the javadoc retrieved in the UI right now.
Comment 21 Dani Megert CLA 2006-04-09 10:49:46 EDT
> In what situation is the javadoc retrieved in the UI right
> now.
See bug 129168.
Comment 22 Dani Megert CLA 2006-04-09 12:54:01 EDT
*** Bug 135225 has been marked as a duplicate of this bug. ***
Comment 23 Olivier Thomann CLA 2006-05-09 10:10:01 EDT
*** Bug 140642 has been marked as a duplicate of this bug. ***
Comment 24 Peter Voss CLA 2006-05-10 03:29:54 EDT
I tested the current solution with 3.2RC3 and things are much better now. The UI doesn't block anymore. I only see a progress bar "Computing additional info" in the status bar (which remains busy for quite some time). But content assist opens straight away. Thank you.
Comment 25 Dani Megert CLA 2006-05-10 04:35:17 EDT
You should thank JDT Text, see bug 129168 ;-)
Comment 26 Olivier Thomann CLA 2007-02-19 09:29:49 EST

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