You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I found there might be a potential synchronization issue in CoreASTProvider. Take the following picture as an example:
In this picture:
the left side represents a thread which requires an AST of current active compilation unit.
the right side represents the editor thread.
the middle is CoreASTProvider, both above two threads interact with CoreASTProvider.
What happens:
Thread A calls getAST(...). At that time, the cached AST is null, so createAST() is called and the created AST is returned. After that, CoreASTProvider will call cache(...) to cache the AST.
At the moment when AST is being created, document change happens. Editor invokes disposeAST().
Given that getAST() is not synchronized with disposeAST(), though editor invokes disposeAST(), an out-of-date AST is still cached. Which means, other threads which call getAST(...) after that moment, they will get an out-of-date AST.
The text was updated successfully, but these errors were encountered:
jdneo
added a commit
to jdneo/eclipse.jdt.ls
that referenced
this issue
Jun 19, 2023
- There are chances that the AST used for semantic highlighting is
out-of-date, which leads to wrong highlighting. This fix simply compare
the length of the document with the length of the AST to check if the
AST is out-of-date. In most of the case, checking the length is enough.
- For root cause analysis, see: eclipse-jdt/eclipse.jdt.core#1151
Signed-off-by: Sheng Chen <[email protected]>
…2709)
- There are chances that the AST used for semantic highlighting is
out-of-date, which leads to wrong highlighting. This fix simply compare
the length of the document with the length of the AST to check if the
AST is out-of-date. In most of the case, checking the length is enough.
- For root cause analysis, see: eclipse-jdt/eclipse.jdt.core#1151
Signed-off-by: Sheng Chen <[email protected]>
I found there might be a potential synchronization issue in CoreASTProvider. Take the following picture as an example:
In this picture:
CoreASTProvider
, both above two threads interact withCoreASTProvider
.What happens:
getAST(...)
. At that time, the cached AST is null, socreateAST()
is called and the created AST is returned. After that,CoreASTProvider
will callcache(...)
to cache the AST.disposeAST()
.disposeAST()
, though editor invokesdisposeAST()
, an out-of-date AST is still cached. Which means, other threads which callgetAST(...)
after that moment, they will get an out-of-date AST.The text was updated successfully, but these errors were encountered: