Bug 304693 - [Edit] Investigate ways of improving how Compare Editor works in multi-threading environment
Summary: [Edit] Investigate ways of improving how Compare Editor works in multi-thread...
Status: RESOLVED WORKSFORME
Alias: None
Product: Platform
Classification: Eclipse Project
Component: Compare (show other bugs)
Version: 3.6   Edit
Hardware: PC Windows XP
: P3 major (vote)
Target Milestone: ---   Edit
Assignee: Platform-Compare-Inbox CLA
QA Contact:
URL:
Whiteboard: stalebug
Keywords: investigate
Depends on: 324993
Blocks: 313017
  Show dependency tree
 
Reported: 2010-03-04 11:24 EST by Tomasz Zarna CLA
Modified: 2019-09-02 15:11 EDT (History)
5 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Tomasz Zarna CLA 2010-03-04 11:24:03 EST
I20100302-0800

Current implementation of the Compare Editor doesn't seem to be multi-threading-proof. There are already bugs reproducible only on dual-core boxes[1], and I guess that their number will increase in the future. This bugzilla is about gathering possible approaches of changing this situation by redesigning the editor.

First suggestions came from Szymon on bug 273951, comment 33:

> 1) #openCompare[Editor] should compute differences and show Compare [Editor]
> sequentially in the same thread. This method would have to be run in the UI
> thread. A disadvantage of this solution is that the [editor] would appear when
> computing is done, not immediately as it is done now.
> 
> 2) Compare [Editor] should listen for events/properties coming while differences
> are being computed. Then the [editor] should decide how to refresh itself when
> computing is done.

[1] bug 273951, bug 277375, ...
Comment 1 Tomasz Zarna CLA 2010-08-12 12:29:56 EDT
I guess Bug 322329 may be considered as related. It is about fixing the Cancel button, which doesn't work when computing diffs.
Comment 2 Stephan Herrmann CLA 2011-01-13 12:10:51 EST
Is this the master bug for all concurrency issues in the compare UI?

Could the priority please be raised?

Using the compare editor is a real pain currently (using 3.7 milestone builds)
just by trying to resolve one file conflict in the CVS synchronize view I get
the following sequence of exceptions / logs, and this happens more or less
during any relevant work with the compare editor (and yes, this is a dual core
machine). Normally, I would file 5 or so individual bugs but here I just
want to illustrate *how* broken it is:

org.eclipse.core.runtime.AssertionFailedException: unknown saveable: org.eclipse.team.ui.synchronize.SaveableCompareEditorInput$InternalResourceSaveableComparison@c98b8c from part: org.eclipse.compare.internal.CompareEditor@a8171e
at org.eclipse.ui.internal.SaveablesList.logWarning(SaveablesList.java:187)
at org.eclipse.ui.internal.SaveablesList.addModel(SaveablesList.java:117)
at org.eclipse.ui.internal.SaveablesList.addModels(SaveablesList.java:289)
at org.eclipse.ui.internal.SaveablesList.handleLifecycleEvent(SaveablesList.java:221)
at org.eclipse.compare.internal.CompareEditor.registerSaveable(CompareEditor.java:323)


java.lang.NullPointerException
at org.eclipse.jdt.internal.ui.text.JavaReconciler.uninstall(JavaReconciler.java:341)
at org.eclipse.jface.text.source.SourceViewer.unconfigure(SourceViewer.java:706)
at org.eclipse.jdt.internal.ui.javaeditor.JavaSourceViewer.unconfigure(JavaSourceViewer.java:388)
at org.eclipse.jface.text.source.SourceViewer.handleDispose(SourceViewer.java:759)
at org.eclipse.jface.text.source.projection.ProjectionViewer.handleDispose(ProjectionViewer.java:1363)
at org.eclipse.jdt.internal.ui.javaeditor.JavaSourceViewer.handleDispose(JavaSourceViewer.java:493)


org.eclipse.swt.SWTException: Graphic is disposed
at org.eclipse.swt.SWT.error(SWT.java:4091)
at org.eclipse.swt.SWT.error(SWT.java:4006)
at org.eclipse.swt.SWT.error(SWT.java:3977)
at org.eclipse.swt.graphics.Image.getBounds(Image.java:840)
at org.eclipse.swt.custom.CLabel.getTotalSize(CLabel.java:262)
at org.eclipse.swt.custom.CLabel.computeSize(CLabel.java:161)
at org.eclipse.compare.contentmergeviewer.ContentMergeViewer.getHeaderHeight(ContentMergeViewer.java:1083)
at org.eclipse.compare.contentmergeviewer.TextMergeViewer.getViewportHeight(TextMergeViewer.java:4722)
at org.eclipse.compare.contentmergeviewer.TextMergeViewer.syncViewport(TextMergeViewer.java:4810)
at org.eclipse.compare.contentmergeviewer.TextMergeViewer.access$60(TextMergeViewer.java:4797)
at org.eclipse.compare.contentmergeviewer.TextMergeViewer$28.viewportChanged(TextMergeViewer.java:2482)


java.lang.NullPointerException
at org.eclipse.compare.internal.merge.DocumentMerger.doDiff(DocumentMerger.java:494)
at org.eclipse.compare.contentmergeviewer.TextMergeViewer.doDiff(TextMergeViewer.java:3275)
at org.eclipse.compare.contentmergeviewer.TextMergeViewer.update(TextMergeViewer.java:4999)
at org.eclipse.compare.contentmergeviewer.TextMergeViewer$2.runInUIThread(TextMergeViewer.java:1046)


This is accompanied with broken diffs after applying one diff: 
diff highlighting has wrong ranges, applying further diffs garbles the file.


The most spooky symptom is if after closing all compare editors every save
triggers recomputing diffs (and thus uselessly eats all CPU power).


The only non-standard configuration that I have is an attempt to bind some
keys which is honored with warnings like:

Conflict for 'org.eclipse.compare.copyRightToLeft':HandlerActivation(commandId=org.eclipse.compare.copyRightToLeft,
handler=ActionHandler(org.eclipse.compare.contentmergeviewer.TextMergeViewer$38@11c92f8),
expression=AndExpression(ActivePartExpression(org.eclipse.compare.internal.CompareEditor@1f51c26),WorkbenchWindowExpression(org.eclipse.ui.internal.WorkbenchWindow@17b60b6)),sourcePriority=1064960)
HandlerActivation(commandId=org.eclipse.compare.copyRightToLeft,
handler=ActionHandler(org.eclipse.compare.contentmergeviewer.TextMergeViewer$38@f4fc41),
expression=AndExpression(ActivePartExpression(org.eclipse.compare.internal.CompareEditor@1f51c26),WorkbenchWindowExpression(org.eclipse.ui.internal.WorkbenchWindow@17b60b6)),sourcePriority=1064960)

Is that command conflicting with itself??

Note that the preference dialog did not mention any conflicts.
Comment 3 Tomasz Zarna CLA 2011-01-14 10:17:53 EST
(In reply to comment #2)
> Is this the master bug for all concurrency issues in the compare UI?

Yes it is.
 
> Could the priority please be raised?

Raised to major.

> org.eclipse.core.runtime.AssertionFailedException: unknown saveable:
> org.eclipse.team.ui.synchronize.SaveableCompareEditorInput$InternalResourceSaveableComparison@c98b8c

This one looks like either bug 304160 or bug 271074.

> java.lang.NullPointerException
> at
> org.eclipse.jdt.internal.ui.text.JavaReconciler.uninstall(JavaReconciler.java:341)
> at
> org.eclipse.jface.text.source.SourceViewer.unconfigure(SourceViewer.java:706)

Again, bug 304160?

> org.eclipse.swt.SWTException: Graphic is disposed
> at org.eclipse.swt.SWT.error(SWT.java:4091)
> at org.eclipse.swt.SWT.error(SWT.java:4006)
> at org.eclipse.swt.SWT.error(SWT.java:3977)
> at org.eclipse.swt.graphics.Image.getBounds(Image.java:840)
> at org.eclipse.swt.custom.CLabel.getTotalSize(CLabel.java:262)
> at org.eclipse.swt.custom.CLabel.computeSize(CLabel.java:161)
> at
> org.eclipse.compare.contentmergeviewer.ContentMergeViewer.getHeaderHeight(ContentMergeViewer.java:1083)

Looks like bug 313017.
Comment 4 Stephan Herrmann CLA 2011-01-14 10:41:44 EST
(In reply to comment #3)
> > Could the priority please be raised?
> 
> Raised to major.

Thanks
Comment 5 Stephan Herrmann CLA 2011-03-03 16:02:27 EST
To me personally this looks like the most broken area in the platform,
currently. Sorry to say. It would be quite disappointing if Indigo brought 
no improvement.

It doesn't look like more reports and more stacktraces would help, right?

Has anyone checked for a connection to bug 288596? From the bug description
that one could likely be the cause for several issues I keep running into.
Comment 6 Stephan Herrmann CLA 2011-03-03 16:06:26 EST
Forgot to mention another concurrency related bug: bug 300001.
(that one would have been more visible had I submitted it a minute earlier,
 it would have won the bug-300000-award ;-) )
Comment 7 Stephan Herrmann CLA 2011-04-26 08:21:41 EDT
(In reply to comment #3)
> > java.lang.NullPointerException
> > at
> > org.eclipse.jdt.internal.ui.text.JavaReconciler.uninstall(JavaReconciler.java:341)
> > at
> > org.eclipse.jface.text.source.SourceViewer.unconfigure(SourceViewer.java:706)
> 
> Again, bug 304160?

Please also see bug 284156, which is currently assigned to e4 ui, but is very
alive cross versions 3.6 -> e4.
Comment 8 Eclipse Genie CLA 2018-11-04 15:19:18 EST
This bug hasn't had any activity in quite some time. Maybe the problem got resolved, was a duplicate of something else, or became less pressing for some reason - or maybe it's still relevant but just hasn't been looked at yet.

If you have further information on the current state of the bug, please add it. The information can be, for example, that the problem still occurs, that you still want the feature, that more information is needed, or that the bug is (for whatever reason) no longer relevant.

--
The automated Eclipse Genie.
Comment 9 Stephan Herrmann CLA 2018-11-04 15:25:28 EST
Much looks better today then 7 years back.

One issue I've still been observing recently, which I also mentioned in bug 540753: disturbing redraws of an invisible compare editor. Kind-of related to concurrency since triggered by some change event.
Comment 10 Lars Vogel CLA 2019-09-02 15:06:14 EDT
This bug was marked as stalebug a while ago. Marking as worksforme.

If this report is still relevant for the current release, please reopen and remove the stalebug whiteboard tag.
Comment 11 Lars Vogel CLA 2019-09-02 15:11:31 EDT
This bug has been marked as stalebug a while ago without any further interaction.

If this report is still relevant for the current release, please reopen and remove the stalebug whiteboard flag.