Bug 135515 - 2 ASTs created while typing
Summary: 2 ASTs created while typing
Status: VERIFIED FIXED
Alias: None
Product: JDT
Classification: Eclipse Project
Component: Text (show other bugs)
Version: 3.1   Edit
Hardware: PC Windows XP
: P1 major (vote)
Target Milestone: 3.2 RC1   Edit
Assignee: Dani Megert CLA
QA Contact:
URL:
Whiteboard:
Keywords: performance
Depends on:
Blocks:
 
Reported: 2006-04-07 06:35 EDT by Jerome Lanneluc CLA
Modified: 2006-04-26 11:11 EDT (History)
0 users

See Also:


Attachments
Profiling trace (4.37 KB, application/zip)
2006-04-07 06:37 EDT, Jerome Lanneluc CLA
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description Jerome Lanneluc CLA 2006-04-07 06:35:25 EDT
N20060407

1. Check out org.eclipse.jdt.tests.compiler
2. Open GenericTypeTest
3. Position cursor just before the last closing curly braket
4. Start CPU profiling
5. In GenericTypeTest.java, type 'a', wait 1s, type another 'a', wait 1s, etc. (do this for 15s)
6. Stop profiling
Observe: It appears that 2 threads are creating ASTs (the reconciler thread and a SelectionListenerWithASTManager thread)
Comment 1 Jerome Lanneluc CLA 2006-04-07 06:37:01 EDT
Created attachment 37983 [details]
Profiling trace
Comment 2 Jerome Lanneluc CLA 2006-04-07 11:04:28 EDT
To reproduce:
1. starting N20060307 on Sun's JRE 1.4.2 on new workspace
2. import org.eclipse.jdt.core and org.eclipse.jdt.ui plug-ins as source
3. Debug new Eclipse Application
4. In runtime workspace, create a new Java project (accept all defaults)
5. New class X in default package
6. add breakpoint in ASTProvider.createAST
7. add breapoint in CompilationUnit.reconcile
8. type 1 character in X.java
9. bp in reconcile is hit
10. type another character in X.java
11. resume reconcile threa
12. bp in ASTProvider is hit
Comment 3 Jerome Lanneluc CLA 2006-04-07 11:18:22 EDT
After activating the Debug/ASTProvider trace:
- I cleared the console after step 7.
- I got the following trace on step 9:
main - ASTProvider > returning cached AST:X for: X.java
main - ASTProvider > about to reconcile: X.java
main - ASTProvider > caching AST: null for: X.java
main - ASTProvider > disposing AST: X for: X.java
- I cleared the console again
- I got the following trace on step 12
main - ASTProvider > returning null (WAIT_NO) for: X.java
org.eclipse.jdt.internal.ui.text.JavaReconciler - ASTProvider > reconciled: X.java, AST: null
org.eclipse.jdt.internal.ui.text.JavaReconciler - ASTProvider > caching AST: null for: X.java
Worker-7 - ASTProvider > about to reconcile: X.java
Worker-7 - ASTProvider > caching AST: null for: X.java
Comment 4 Jerome Lanneluc CLA 2006-04-07 11:27:39 EDT
Further debugging shows that resuming the reconcile thread (step 11) causes it to notify a null AST since the reconcile operation is cancelled since a character is typed.
Comment 5 Dani Megert CLA 2006-04-08 05:23:51 EDT
Can reproduce.
Comment 6 Dani Megert CLA 2006-04-08 08:41:01 EDT
Fix is ready but needs further testing.
Comment 7 Dani Megert CLA 2006-04-09 11:21:10 EDT
I've released the fix to HEAD.
Available in builds > N20060409-0010.

Jerome can you also verify that it works? Thanks.
Comment 8 Jerome Lanneluc CLA 2006-04-10 04:45:39 EDT
Verified that no extra AST is created using N20060410.
Thanks Dani.
Comment 9 Tom Hofmann CLA 2006-04-26 11:06:16 EDT
Verifying...
Comment 10 Tom Hofmann CLA 2006-04-26 11:11:33 EDT
Verified that only the reconciler creates ASTs in the scenario given in comment 2.