Skip to content

Conversation

mehmet-karaman
Copy link
Contributor

@mehmet-karaman mehmet-karaman commented Oct 13, 2025

  • This PR will fix multithreading issues described in Sporadically thrown NPE and NSEE during issue processing after validation. eclipse-xtext/xtext#3524
  • added synchronize block to methods in AnnotationModel, wherever reads / writes could happen in multiple threads.
  • changed execution order, to be able to synchronize only necessary code blocks.
  • Removed dead code in AnnotationModel.cleanup because mapLock can't be null.
  • Added new javadoc to IAnnotationMap.getLockObject().
  • added assert.isLegal check to AnnotationMAp.setLockObject()

/ writes could happen in multiple threads.
- changed execution order, to be able to synchronize only necessary code
blocks.
- Removed dead code in AnnotationModel.cleanup because mapLock can't be
null.
- Added new javadoc to IAnnotationMap.getLockObject().
- added assert.isLegal check to AnnotationMAp.setLockObject()
@laeubi
Copy link
Contributor

laeubi commented Oct 13, 2025

@mehmet-karaman can you please more explain the rationale behind the changes? I think we can assume code is there for a reason so if we change fundamental things we should carefully describe the reasons and causes and why it is not a bug of the caller for example as otherwise we might run into deadlocks if code that previously run outside locks now run under lock conditions.

@iloveeclipse
Copy link
Member

The change here is coming from eclipse-xtext/xtext#3524 investigation.

@iloveeclipse
Copy link
Member

@szarnekow : if you have time, would be good if you could check this PR.

@laeubi
Copy link
Contributor

laeubi commented Oct 13, 2025

It still would be good to more explain the individual changes and why they are required / needed. Also I think some changes are better a separate PR (as they are easier to review then e.g. "Removed dead code" or API documentation enhancements)

@iloveeclipse
Copy link
Member

Also I think some changes are better a separate PR

Could you please point which exactly?

@laeubi
Copy link
Contributor

laeubi commented Oct 13, 2025

Each of those can be an own PR

  • Removed dead code in AnnotationModel.cleanup because mapLock can't be null.
  • Added new javadoc to IAnnotationMap.getLockObject()
  • added assert.isLegal check to AnnotationMAp.setLockObject()

All of these seem independent and local enough to be quickly reviewed and merged and likely will improve things without risk for regression. And even if they are easier to revert in isolation.

Then might be the next thing

  • changed execution order, to be able to synchronize only necessary code blocks.

and finally

  • added synchronize block to methods in AnnotationModel, wherever reads / writes could happen in multiple threads.

This will make each PR small, focused and likely better to understand the implications and its easier to write a concise commit message.

*/
protected void removeAllAnnotations(boolean fireModelChanged) {
if (fDocument == null) {
return;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I believe we should remove this check completely to make sure model is "cleaned up".
removePosition(fDocument, position); already checks for the document not being null, so it should be fine.

@iloveeclipse
Copy link
Member

Each of those can be an own PR

  • Removed dead code in AnnotationModel.cleanup because mapLock can't be null.
  • Added new javadoc to IAnnotationMap.getLockObject()
  • added assert.isLegal check to AnnotationMAp.setLockObject()

I believe these could be seperated from the main PR, but should go in one PR, because they all require each other.

@laeubi
Copy link
Contributor

laeubi commented Oct 13, 2025

I believe these could be seperated from the main PR, but should go in one PR, because they all require each other.

Sure at laest I think these are more "cleanup" and currently make the PR harder to review than it should.

Copy link
Contributor

Test Results

 3 018 files  ±0   3 018 suites  ±0   2h 39m 17s ⏱️ + 25m 48s
 8 226 tests ±0   7 977 ✅ ±0  249 💤 ±0  0 ❌ ±0 
23 598 runs  ±0  22 804 ✅ ±0  794 💤 ±0  0 ❌ ±0 

Results for commit 6ee99d8. ± Comparison against base commit 875996f.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants