Summary: | Deadlock in annotation/code mining processing | ||
---|---|---|---|
Product: | [Eclipse Project] Platform | Reporter: | Lars Vogel <Lars.Vogel> |
Component: | Text | Assignee: | Platform-Text-Inbox <platform-text-inbox> |
Status: | NEW --- | QA Contact: | |
Severity: | major | ||
Priority: | P3 | CC: | daniel_megert, eclipse, gautier.desaintmartinlacaze, karsten.thoms, Lars.Vogel, loskutov, ma.becker, mistria, philipa |
Version: | 4.14 | Keywords: | regression |
Target Milestone: | --- | ||
Hardware: | PC | ||
OS: | Linux | ||
See Also: |
https://bugs.eclipse.org/bugs/show_bug.cgi?id=540443 https://bugs.eclipse.org/bugs/show_bug.cgi?id=552760 https://bugs.eclipse.org/bugs/show_bug.cgi?id=553049 https://git.eclipse.org/r/152904 https://bugs.eclipse.org/bugs/show_bug.cgi?id=559816 |
||
Whiteboard: | |||
Bug Depends on: | |||
Bug Blocks: | 547665 |
Description
Lars Vogel
2019-11-14 06:01:43 EST
Deadlock happens frequently for me with Eclipse SDK Version: 2019-12 (4.14) Build id: I20191113-2315 OS: Linux, v.5.3.0-19-generic, x86_64 / gtk 3.24.12, WebKit 2.26.1 Java version: 12.0.1 The problem is indirectly in SWT. Looks like we don't check for UI thread as usually (and throw an error) and therefore some bad clients deadlock is via org.eclipse.jface.text.reconciler.MonoReconciler" #81 daemon prio=1 os_prio=0 cpu=175,41ms elapsed=1069,46s tid=0x00007f7023378800 nid=0x3d9c in Object.wait() [0x00007f6f21dd5000] java.lang.Thread.State: WAITING (on object monitor) at java.lang.Object.wait(java.base@12.0.1/Native Method) - waiting on <no object reference available> at java.lang.Object.wait(java.base@12.0.1/Object.java:326) at org.eclipse.swt.internal.Lock.lock(Lock.java:37) - locked <0x00000000c1477d98> (a org.eclipse.swt.internal.Lock) at org.eclipse.swt.internal.gtk.GDK.gdk_pixbuf_new_from_file(GDK.java:1715) at org.eclipse.swt.graphics.Image.initNative(Image.java:796) at org.eclipse.swt.graphics.Image.<init>(Image.java:659) at org.eclipse.jface.resource.URLImageDescriptor.createImage(URLImageDescriptor.java:263) at org.eclipse.jface.resource.ImageDescriptor.createResource(ImageDescriptor.java:181) at org.eclipse.jface.resource.DeviceResourceManager.allocate(DeviceResourceManager.java:55) at org.eclipse.jface.resource.AbstractResourceManager.create(AbstractResourceManager.java:88) at org.eclipse.jface.resource.ResourceManager.createImageWithDefault(ResourceManager.java:195) at org.eclipse.jface.resource.ImageRegistry.get(ImageRegistry.java:206) at org.eclipse.ui.texteditor.DefaultMarkerAnnotationAccess.getImage(DefaultMarkerAnnotationAccess.java:399) at org.eclipse.ui.texteditor.DefaultMarkerAnnotationAccess.isPaintable(DefaultMarkerAnnotationAccess.java:300) at org.eclipse.ui.internal.editors.text.codemining.annotation.AnnotationCodeMiningFilter.isPaintable(AnnotationCodeMiningFilter.java:107) at org.eclipse.ui.internal.editors.text.codemining.annotation.AnnotationCodeMiningFilter$$Lambda$888/0x0000000802069840.test(Unknown Source) at java.util.stream.ReferencePipeline$2$1.accept(java.base@12.0.1/ReferencePipeline.java:176) at java.util.stream.ReferencePipeline$2$1.accept(java.base@12.0.1/ReferencePipeline.java:177) at java.util.Spliterators$ArraySpliterator.tryAdvance(java.base@12.0.1/Spliterators.java:958) at java.util.stream.ReferencePipeline$7$1.accept(java.base@12.0.1/ReferencePipeline.java:278) at java.util.Spliterators$ArraySpliterator.tryAdvance(java.base@12.0.1/Spliterators.java:958) at java.util.stream.ReferencePipeline.forEachWithCancel(java.base@12.0.1/ReferencePipeline.java:127) at java.util.stream.AbstractPipeline.copyIntoWithCancel(java.base@12.0.1/AbstractPipeline.java:502) at java.util.stream.AbstractPipeline.copyInto(java.base@12.0.1/AbstractPipeline.java:488) at java.util.stream.AbstractPipeline.wrapAndCopyInto(java.base@12.0.1/AbstractPipeline.java:474) at java.util.stream.FindOps$FindOp.evaluateSequential(java.base@12.0.1/FindOps.java:150) at java.util.stream.AbstractPipeline.evaluate(java.base@12.0.1/AbstractPipeline.java:234) at java.util.stream.ReferencePipeline.findAny(java.base@12.0.1/ReferencePipeline.java:548) at org.eclipse.ui.internal.editors.text.codemining.annotation.AnnotationCodeMiningFilter.isEmpty(AnnotationCodeMiningFilter.java:77) at org.eclipse.ui.internal.editors.text.codemining.annotation.AnnotationCodeMiningProvider$AnnotationModelListener.modelChanged(AnnotationCodeMiningProvider.java:122) at org.eclipse.jface.text.source.AnnotationModel.fireModelChanged(AnnotationModel.java:590) at org.eclipse.jface.text.source.AnnotationModel$InternalModelListener.modelChanged(AnnotationModel.java:255) at org.eclipse.jface.text.source.AnnotationModel.fireModelChanged(AnnotationModel.java:590) at org.eclipse.jface.text.source.AnnotationModel.fireModelChanged(AnnotationModel.java:556) at org.eclipse.jface.text.source.AnnotationModel.replaceAnnotations(AnnotationModel.java:408) at org.eclipse.jface.text.source.AnnotationModel.replaceAnnotations(AnnotationModel.java:373) at org.eclipse.ui.texteditor.spelling.SpellingReconcileStrategy$SpellingProblemCollector.endCollecting(SpellingReconcileStrategy.java:105) - locked <0x00000000d31ad520> (a java.lang.Object) at org.eclipse.ui.texteditor.spelling.SpellingService.check(SpellingService.java:120) at org.eclipse.ui.texteditor.spelling.SpellingReconcileStrategy.reconcile(SpellingReconcileStrategy.java:190) at org.eclipse.ui.texteditor.spelling.SpellingReconcileStrategy.initialReconcile(SpellingReconcileStrategy.java:165) at org.eclipse.jface.text.reconciler.MonoReconciler.initialProcess(MonoReconciler.java:98) at org.eclipse.jface.text.reconciler.AbstractReconciler$BackgroundThread.run(AbstractReconciler.java:177) Thanks, Andrey. Adding Mickael, as stack involves code mining. This is not a generic code-mining error, it's specific to how the error annotation code minings are implemented. Adding Niko so he may have ideas of what can be done differently. The actual deadlock is not in GTK / SWT but due annotation model lock that is hold in "org.eclipse.jface.text.reconciler.MonoReconciler" thread, which tries to create an Image and hangs on SWT lock, that is held by UI thread that tries to acquire annotation lock. Kaboom. I've quickly checked SWT code, it looks like it is OK that we allow Image to be created not on the UI thread (still surprises me), I assume this is to allow off-screen rendering. So the bug must be fixed on the client side (annotation model & users of it, namely AnnotationCodeMiningProvider / AnnotationCodeMiningFilter). I assume the regression is coming from bug 547665. Below related deadlocked thread stacks (partial). org.eclipse.ui.texteditor.spelling.SpellingReconcileStrategy$SpellingProblemCollector.endCollecting(SpellingReconcileStrategy.java:105) - locked <0x00000000d31ad520> (a java.lang.Object) at org.eclipse.ui.texteditor.spelling.SpellingService.check(SpellingService.java:120) at org.eclipse.ui.texteditor.spelling.SpellingReconcileStrategy.reconcile(SpellingReconcileStrategy.java:190) at org.eclipse.ui.texteditor.spelling.SpellingReconcileStrategy.initialReconcile(SpellingReconcileStrategy.java:165) at org.eclipse.jface.text.reconciler.MonoReconciler.initialProcess(MonoReconciler.java:98) at org.eclipse.jface.text.reconciler.AbstractReconciler$BackgroundThread.run(AbstractReconciler.java:177) but in main we are locking UI thread and try to acquire this annotation lock. "main" #1 prio=6 os_prio=0 cpu=67858,25ms elapsed=2012,31s tid=0x00007f7020012000 nid=0x37ca waiting for monitor entry [0x00007f702612b000] java.lang.Thread.State: BLOCKED (on object monitor) at org.eclipse.core.internal.filebuffers.SynchronizableDocument.getLineInformation(SynchronizableDocument.java:289) - waiting to lock <0x00000000d31ad520> (a java.lang.Object) at org.eclipse.jface.text.DefaultDocumentAdapter.doGetLine(DefaultDocumentAdapter.java:145) at org.eclipse.jface.text.DefaultDocumentAdapter.getLine(DefaultDocumentAdapter.java:158) at org.eclipse.swt.custom.StyledTextRenderer.drawLine(StyledTextRenderer.java:451) at org.eclipse.swt.custom.StyledText.handlePaint(StyledText.java:6259) at org.eclipse.swt.custom.StyledText.lambda$1(StyledText.java:5800) at org.eclipse.swt.custom.StyledText$$Lambda$656/0x0000000801e01440.handleEvent(Unknown Source) Also bug 552760 is a hint that it is probably a bad idea to allocate images from non UI thread (even if SWT allows it). We might be able to move the isPaintable() check to a later point, when we're actually running in UI thread. The annotation model contains a LOT of entries, so filtering later can have serious performance issues (in my early tryouts with more generous filters, I had to kill the runtime regularly because it was so laggy). I won't have time to look into it this week; I'll try next week. New Gerrit change created: https://git.eclipse.org/r/152904 If someone can review for 4.14, please adjust the target milestone. *** Bug 558342 has been marked as a duplicate of this bug. *** (In reply to Dani Megert from comment #9) > If someone can review for 4.14, please adjust the target milestone. Hey guys, any progress here? (In reply to Matthias Becker from comment #11) > (In reply to Dani Megert from comment #9) > > If someone can review for 4.14, please adjust the target milestone. > > Hey guys, > any progress here? Ping! |