eclipse-xtext / eclipse-xtext/xtext
XtextDocumentLocker.notifyModelListenersOnUiThread() blocks UI thread waiting for lock
Nobody has claimed this yet.
- Dominant language
- Java
- Stars
- 831
- Forks
- 330
- Avg merge
- 3d 7h
- Merged PRs (30d)
- 12
Description
When an XtextDocument is updated using modify(...), listeners on the UI thread are notified about the change. The same happens when readOnly(...) or one of its derivatives had to reconcile the state before the operation.
XtextDocumentLocker.notifyModelListenersOnUiThread() then blocks the UI thread waiting for a lock using tryReadOnly(...). This happens when it is not already running in the UI-thread, so it re-acquires the lock inside an asyncExec(...) call on the UI thread.
If there is a long-running operation holding the lock, this blocks the UI thread until the operation is completed, causing the UI to be unresponsive in the meantime. Since locks are actually always exclusive, this also happens for contending read operations.
This is also somewhat related to https://github.com/eclipse/xtext/issues/2470, where the current behavior of notifyModelListenersOnUiThread() has also been identified as a potential cause for deadlocks.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with XtextDocumentLocker.notifyModelListenersOnUiThread() and trace its tryReadOnly() and asyncExec() behavior. Reproduce the issue with a long-running operation holding the lock, then verify that model-listener notification no longer leaves the UI thread blocked; compare the related discussion in issue 2470.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- java
- Domain
- desktop
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 45/100