Home » Modeling » TMF (Xtext) » deadlock problem
deadlock problem [message #544214] |
Thu, 01 July 2010 23:38  |
Eclipse User |
|
|
|
Hi,
I am running into a deadlock situation. I seems like Highlighting and
Outline are deadlocking.
I have let the IDE run for a bit and then paused, when repeating it is
stuck in the same two places... (See stack tracess below)
The problem can be replicated - I always get the problem when in a
particular position in the source text.
If I remove my semantic highlighting, it does not hang, and I get an
error marker instead (because of a syntax error - which is expected).
Do I need to protect the highlighting in a UnitOfWork some way, or
should it work without this? I read this: "Please refer to
DefaultContentOutlineNodeFactory.getEObjectHandle(EObject,
IStateAccess<XtextResource>) to learn more about IEObjectHandles. ", and
I have seen that I may not work directly with the model.
And I looked at the mentioned code, but I just don't get it...
What I am doing now is like this...
public void provideHighlightingFor2(XtextResource resource,
IHighlightedPositionAcceptor acceptor) {
if(resource == null)
return;
EList<EObject> contents = resource.getContents();
if(contents == null || contents.size() == 0)
return; // nothing there at all - probably an empty file
BeeModel model = (BeeModel) contents.get(0);
// BuildUnit bu = model.getBody();
TreeIterator<EObject> all = model.eAllContents();
while(all.hasNext()) {
EObject o = all.next();
// TODO: OPTIMIZE the if-then-else below using an EMF switch
if(o instanceof BuildUnit)
highlightBuildUnit((BuildUnit) o, acceptor);
// handle literals
else if(o instanceof BLiteralExpression) {
Object val = ((BLiteralExpression) o).getValue();
// handle real numbers (INT and HEX are handled by terminal rules)
if(val instanceof Float || val instanceof Double)
highlightObject(o, BeeLangHighlightConfiguration.REAL_ID, acceptor);
}
else if(o instanceof PathVector)
highlightPaths((PathVector) o, acceptor);
// etc. etc...
Where the the various highlightObject, highlightPaths, use a variant of
finding "firstFeature" as I seen used by others...
Am I doing something wrong?
If I should use "readOnly" and "IUnitOfWork", how to I get to the model
from the XtextResource passed in in the call to provideHighlightingFor ?
(The version on b3's HEAD has the semantic highlighting disabled since I
am working on a proposal provider for the position where this issue
occurs...)
// provideHighlightingFor2(resource, acceptor);
Regards
- henrik
Daemon Thread [Thread-0] (Suspended)
Unsafe.park(boolean, long) line: not available [native method]
LockSupport.park(Object) line: 158
ReentrantReadWriteLock$NonfairSync(AbstractQueuedSynchronize r).parkAndCheckInterrupt() line: 747
ReentrantReadWriteLock$NonfairSync(AbstractQueuedSynchronize r).doAcquireShared(int) line: 877
ReentrantReadWriteLock$NonfairSync(AbstractQueuedSynchronize r).acquireShared(int) line: 1197
ReentrantReadWriteLock$ReadLock.lock() line: 594
XtextDocument$XtextDocumentLocker(IStateAccess$AbstractImpl<P >).readOnly(IUnitOfWork<T,P>) line: 36
XtextDocument.readOnly(IUnitOfWork<T,XtextResource>) line: 58
XtextContentOutlinePage.synchronizeOutlinePage() line: 312
EditorSelectionChangedListener.selectionChanged(SelectionCha ngedEvent)
line: 31
XtextSourceViewer(TextViewer).firePostSelectionChanged(Selec tionChangedEvent) line: 2745
XtextSourceViewer(TextViewer).firePostSelectionChanged(int, int)
line: 2693
TextViewer$5.run() line: 2672
Display.runTimers() line: 3742
Display.readAndDispatch() line: 3256
Workbench.runEventLoop(Window$IExceptionHandler, Display) line: 2624
Workbench.runUI() line: 2588
Workbench.access$4(Workbench) line: 2422
Workbench$7.run() line: 670
Realm.runWithDefault(Realm, Runnable) line: 332
Workbench.createAndRunWorkbench(Display, WorkbenchAdvisor) line: 663
PlatformUI.createAndRunWorkbench(Display, WorkbenchAdvisor) line: 149
IDEApplication.start(IApplicationContext) line: 115
EclipseAppHandle.run(Object) line: 196
EclipseAppLauncher.runApplication(Object) line: 110
EclipseAppLauncher.start(Object) line: 79
EclipseStarter.run(Object) line: 369
EclipseStarter.run(String[], Runnable) line: 179
NativeMethodAccessorImpl.invoke0(Method, Object, Object[]) line: not
available [native method]
NativeMethodAccessorImpl.invoke(Object, Object[]) line: 39
DelegatingMethodAccessorImpl.invoke(Object, Object[]) line: 25
Method.invoke(Object, Object...) line: 597
Main.invokeFramework(String[], URL[]) line: 619
Main.basicRun(String[]) line: 574
Main.run(String[]) line: 1407
Main.main(String[]) line: 1383
AND
Thread [Worker-3] (Suspended)
MergingHighlightedPositionAcceptor.mergePositions(int, int, int,
LightweightPosition$IntToStringArray[]) line: 88
MergingHighlightedPositionAcceptor.mergePositions() line: 71
MergingHighlightedPositionAcceptor.provideHighlightingFor(Xt extResource, IHighlightedPositionAcceptor) line: 47
HighlightingReconciler.reconcilePositions(XtextResource) line: 87
HighlightingReconciler.modelChanged(XtextResource) line: 275
XtextDocument.notifyModelListeners(XtextResource) line: 90
XtextDocument$XtextDocumentLocker.afterModify(XtextResource, Object,
IUnitOfWork<?,XtextResource>) line: 142
XtextDocument$XtextDocumentLocker.afterModify(Object, Object,
IUnitOfWork) line: 1
XtextDocument$XtextDocumentLocker(IStateAccess$AbstractImpl<P >).modify(IUnitOfWork<T,P>) line: 58
XtextDocument$XtextDocumentLocker.modify(IUnitOfWork<T,XtextResource >)
line: 149
XtextDocument.modify(IUnitOfWork<T,XtextResource>) line: 62
XtextDocumentReconcileStrategy.reconcile(IRegion) line: 27
XtextReconciler.run(IProgressMonitor) line: 179
Worker.run() line: 54
|
|
|
Re: deadlock problem [message #544349 is a reply to message #544214] |
Fri, 02 July 2010 08:36   |
Eclipse User |
|
|
|
I've filed a bugzilla: https://bugs.eclipse.org/bugs/show_bug.cgi?id=318704
Sven
Henrik Lindberg schrieb:
> Hi,
> I am running into a deadlock situation. I seems like Highlighting and
> Outline are deadlocking.
>
> I have let the IDE run for a bit and then paused, when repeating it is
> stuck in the same two places... (See stack tracess below)
>
> The problem can be replicated - I always get the problem when in a
> particular position in the source text.
>
> If I remove my semantic highlighting, it does not hang, and I get an
> error marker instead (because of a syntax error - which is expected).
>
> Do I need to protect the highlighting in a UnitOfWork some way, or
> should it work without this? I read this: "Please refer to
> DefaultContentOutlineNodeFactory.getEObjectHandle(EObject,
> IStateAccess<XtextResource>) to learn more about IEObjectHandles. ", and
> I have seen that I may not work directly with the model.
>
> And I looked at the mentioned code, but I just don't get it...
> What I am doing now is like this...
>
> public void provideHighlightingFor2(XtextResource resource,
> IHighlightedPositionAcceptor acceptor) {
> if(resource == null)
> return;
> EList<EObject> contents = resource.getContents();
> if(contents == null || contents.size() == 0)
> return; // nothing there at all - probably an empty file
> BeeModel model = (BeeModel) contents.get(0);
> // BuildUnit bu = model.getBody();
> TreeIterator<EObject> all = model.eAllContents();
> while(all.hasNext()) {
> EObject o = all.next();
> // TODO: OPTIMIZE the if-then-else below using an EMF switch
> if(o instanceof BuildUnit)
> highlightBuildUnit((BuildUnit) o, acceptor);
>
> // handle literals
> else if(o instanceof BLiteralExpression) {
> Object val = ((BLiteralExpression) o).getValue();
> // handle real numbers (INT and HEX are handled by
> terminal rules)
> if(val instanceof Float || val instanceof Double)
> highlightObject(o,
> BeeLangHighlightConfiguration.REAL_ID, acceptor);
> }
> else if(o instanceof PathVector)
> highlightPaths((PathVector) o, acceptor);
> // etc. etc...
>
> Where the the various highlightObject, highlightPaths, use a variant of
> finding "firstFeature" as I seen used by others...
>
> Am I doing something wrong?
> If I should use "readOnly" and "IUnitOfWork", how to I get to the model
> from the XtextResource passed in in the call to provideHighlightingFor ?
>
> (The version on b3's HEAD has the semantic highlighting disabled since I
> am working on a proposal provider for the position where this issue
> occurs...)
> // provideHighlightingFor2(resource, acceptor);
>
> Regards
> - henrik
>
>
> Daemon Thread [Thread-0] (Suspended)
> Unsafe.park(boolean, long) line: not available [native method]
> LockSupport.park(Object) line: 158
> ReentrantReadWriteLock$NonfairSync(AbstractQueuedSynchronize r).parkAndCheckInterrupt()
> line: 747
> ReentrantReadWriteLock$NonfairSync(AbstractQueuedSynchronize r).doAcquireShared(int)
> line: 877
> ReentrantReadWriteLock$NonfairSync(AbstractQueuedSynchronize r).acquireShared(int)
> line: 1197
> ReentrantReadWriteLock$ReadLock.lock() line: 594
> XtextDocument$XtextDocumentLocker(IStateAccess$AbstractImpl<P >).readOnly(IUnitOfWork<T,P>)
> line: 36
> XtextDocument.readOnly(IUnitOfWork<T,XtextResource>) line: 58
> XtextContentOutlinePage.synchronizeOutlinePage() line: 312
> EditorSelectionChangedListener.selectionChanged(SelectionCha ngedEvent)
> line: 31
> XtextSourceViewer(TextViewer).firePostSelectionChanged(Selec tionChangedEvent)
> line: 2745
> XtextSourceViewer(TextViewer).firePostSelectionChanged(int, int)
> line: 2693
> TextViewer$5.run() line: 2672
> Display.runTimers() line: 3742
> Display.readAndDispatch() line: 3256
> Workbench.runEventLoop(Window$IExceptionHandler, Display) line: 2624
> Workbench.runUI() line: 2588
> Workbench.access$4(Workbench) line: 2422
> Workbench$7.run() line: 670
> Realm.runWithDefault(Realm, Runnable) line: 332
> Workbench.createAndRunWorkbench(Display, WorkbenchAdvisor) line: 663
> PlatformUI.createAndRunWorkbench(Display, WorkbenchAdvisor) line:
> 149
> IDEApplication.start(IApplicationContext) line: 115
> EclipseAppHandle.run(Object) line: 196
> EclipseAppLauncher.runApplication(Object) line: 110
> EclipseAppLauncher.start(Object) line: 79
> EclipseStarter.run(Object) line: 369
> EclipseStarter.run(String[], Runnable) line: 179
> NativeMethodAccessorImpl.invoke0(Method, Object, Object[]) line: not
> available [native method]
> NativeMethodAccessorImpl.invoke(Object, Object[]) line: 39
> DelegatingMethodAccessorImpl.invoke(Object, Object[]) line: 25
> Method.invoke(Object, Object...) line: 597
> Main.invokeFramework(String[], URL[]) line: 619
> Main.basicRun(String[]) line: 574
> Main.run(String[]) line: 1407
> Main.main(String[]) line: 1383
>
>
> AND
> Thread [Worker-3] (Suspended)
> MergingHighlightedPositionAcceptor.mergePositions(int, int, int,
> LightweightPosition$IntToStringArray[]) line: 88
> MergingHighlightedPositionAcceptor.mergePositions() line: 71
> MergingHighlightedPositionAcceptor.provideHighlightingFor(Xt extResource,
> IHighlightedPositionAcceptor) line: 47
> HighlightingReconciler.reconcilePositions(XtextResource) line: 87
> HighlightingReconciler.modelChanged(XtextResource) line: 275
> XtextDocument.notifyModelListeners(XtextResource) line: 90
> XtextDocument$XtextDocumentLocker.afterModify(XtextResource, Object,
> IUnitOfWork<?,XtextResource>) line: 142
> XtextDocument$XtextDocumentLocker.afterModify(Object, Object,
> IUnitOfWork) line: 1
> XtextDocument$XtextDocumentLocker(IStateAccess$AbstractImpl<P >).modify(IUnitOfWork<T,P>)
> line: 58
> XtextDocument$XtextDocumentLocker.modify(IUnitOfWork<T,XtextResource >)
> line: 149
> XtextDocument.modify(IUnitOfWork<T,XtextResource>) line: 62
> XtextDocumentReconcileStrategy.reconcile(IRegion) line: 27
> XtextReconciler.run(IProgressMonitor) line: 179
> Worker.run() line: 54
--
Need professional support for Xtext and EMF?
Go to: http://xtext.itemis.com
Twitter : @svenefftinge
Blog : blog.efftinge.de
|
|
|
Re: deadlock problem [message #544537 is a reply to message #544349] |
Sat, 03 July 2010 09:27   |
Eclipse User |
|
|
|
Hi Henrik,
can you confirm that it's an endless loop in
MergedHighlightingPositionAcceptor.mergePositions?
Regards,
Sebastian
--
Need professional support for Eclipse Modeling?
Go visit: http://xtext.itemis.com
Am 02.07.10 14:36, schrieb Sven Efftinge:
> I've filed a bugzilla: https://bugs.eclipse.org/bugs/show_bug.cgi?id=318704
>
> Sven
>
> Henrik Lindberg schrieb:
>> Hi,
>> I am running into a deadlock situation. I seems like Highlighting and
>> Outline are deadlocking.
>>
>> I have let the IDE run for a bit and then paused, when repeating it is
>> stuck in the same two places... (See stack tracess below)
>>
>> The problem can be replicated - I always get the problem when in a
>> particular position in the source text.
>>
>> If I remove my semantic highlighting, it does not hang, and I get an
>> error marker instead (because of a syntax error - which is expected).
>>
>> Do I need to protect the highlighting in a UnitOfWork some way, or
>> should it work without this? I read this: "Please refer to
>> DefaultContentOutlineNodeFactory.getEObjectHandle(EObject,
>> IStateAccess<XtextResource>) to learn more about IEObjectHandles. ",
>> and I have seen that I may not work directly with the model.
>>
>> And I looked at the mentioned code, but I just don't get it...
>> What I am doing now is like this...
>>
>> public void provideHighlightingFor2(XtextResource resource,
>> IHighlightedPositionAcceptor acceptor) {
>> if(resource == null)
>> return;
>> EList<EObject> contents = resource.getContents();
>> if(contents == null || contents.size() == 0)
>> return; // nothing there at all - probably an empty file
>> BeeModel model = (BeeModel) contents.get(0);
>> // BuildUnit bu = model.getBody();
>> TreeIterator<EObject> all = model.eAllContents();
>> while(all.hasNext()) {
>> EObject o = all.next();
>> // TODO: OPTIMIZE the if-then-else below using an EMF switch
>> if(o instanceof BuildUnit)
>> highlightBuildUnit((BuildUnit) o, acceptor);
>>
>> // handle literals
>> else if(o instanceof BLiteralExpression) {
>> Object val = ((BLiteralExpression) o).getValue();
>> // handle real numbers (INT and HEX are handled by terminal rules)
>> if(val instanceof Float || val instanceof Double)
>> highlightObject(o, BeeLangHighlightConfiguration.REAL_ID, acceptor);
>> }
>> else if(o instanceof PathVector)
>> highlightPaths((PathVector) o, acceptor);
>> // etc. etc...
>>
>> Where the the various highlightObject, highlightPaths, use a variant
>> of finding "firstFeature" as I seen used by others...
>>
>> Am I doing something wrong?
>> If I should use "readOnly" and "IUnitOfWork", how to I get to the
>> model from the XtextResource passed in in the call to
>> provideHighlightingFor ?
>>
>> (The version on b3's HEAD has the semantic highlighting disabled since
>> I am working on a proposal provider for the position where this issue
>> occurs...)
>> // provideHighlightingFor2(resource, acceptor);
>>
>> Regards
>> - henrik
>>
>>
>> Daemon Thread [Thread-0] (Suspended) Unsafe.park(boolean, long) line:
>> not available [native method] LockSupport.park(Object) line: 158
>> ReentrantReadWriteLock$NonfairSync(AbstractQueuedSynchronize r).parkAndCheckInterrupt()
>> line: 747
>> ReentrantReadWriteLock$NonfairSync(AbstractQueuedSynchronize r).doAcquireShared(int)
>> line: 877
>> ReentrantReadWriteLock$NonfairSync(AbstractQueuedSynchronize r).acquireShared(int)
>> line: 1197 ReentrantReadWriteLock$ReadLock.lock() line: 594
>> XtextDocument$XtextDocumentLocker(IStateAccess$AbstractImpl<P >).readOnly(IUnitOfWork<T,P>)
>> line: 36 XtextDocument.readOnly(IUnitOfWork<T,XtextResource>) line: 58
>> XtextContentOutlinePage.synchronizeOutlinePage() line: 312
>> EditorSelectionChangedListener.selectionChanged(SelectionCha ngedEvent)
>> line: 31
>> XtextSourceViewer(TextViewer).firePostSelectionChanged(Selec tionChangedEvent)
>> line: 2745 XtextSourceViewer(TextViewer).firePostSelectionChanged(int,
>> int) line: 2693 TextViewer$5.run() line: 2672 Display.runTimers()
>> line: 3742 Display.readAndDispatch() line: 3256
>> Workbench.runEventLoop(Window$IExceptionHandler, Display) line: 2624
>> Workbench.runUI() line: 2588 Workbench.access$4(Workbench) line: 2422
>> Workbench$7.run() line: 670 Realm.runWithDefault(Realm, Runnable)
>> line: 332 Workbench.createAndRunWorkbench(Display, WorkbenchAdvisor)
>> line: 663 PlatformUI.createAndRunWorkbench(Display, WorkbenchAdvisor)
>> line: 149 IDEApplication.start(IApplicationContext) line: 115
>> EclipseAppHandle.run(Object) line: 196
>> EclipseAppLauncher.runApplication(Object) line: 110
>> EclipseAppLauncher.start(Object) line: 79 EclipseStarter.run(Object)
>> line: 369 EclipseStarter.run(String[], Runnable) line: 179
>> NativeMethodAccessorImpl.invoke0(Method, Object, Object[]) line: not
>> available [native method] NativeMethodAccessorImpl.invoke(Object,
>> Object[]) line: 39 DelegatingMethodAccessorImpl.invoke(Object,
>> Object[]) line: 25 Method.invoke(Object, Object...) line: 597
>> Main.invokeFramework(String[], URL[]) line: 619
>> Main.basicRun(String[]) line: 574 Main.run(String[]) line: 1407
>> Main.main(String[]) line: 1383
>>
>> AND
>> Thread [Worker-3] (Suspended)
>> MergingHighlightedPositionAcceptor.mergePositions(int, int, int,
>> LightweightPosition$IntToStringArray[]) line: 88
>> MergingHighlightedPositionAcceptor.mergePositions() line: 71
>> MergingHighlightedPositionAcceptor.provideHighlightingFor(Xt extResource,
>> IHighlightedPositionAcceptor) line: 47
>> HighlightingReconciler.reconcilePositions(XtextResource) line: 87
>> HighlightingReconciler.modelChanged(XtextResource) line: 275
>> XtextDocument.notifyModelListeners(XtextResource) line: 90
>> XtextDocument$XtextDocumentLocker.afterModify(XtextResource, Object,
>> IUnitOfWork<?,XtextResource>) line: 142
>> XtextDocument$XtextDocumentLocker.afterModify(Object, Object,
>> IUnitOfWork) line: 1
>> XtextDocument$XtextDocumentLocker(IStateAccess$AbstractImpl<P >).modify(IUnitOfWork<T,P>)
>> line: 58
>> XtextDocument$XtextDocumentLocker.modify(IUnitOfWork<T,XtextResource >)
>> line: 149 XtextDocument.modify(IUnitOfWork<T,XtextResource>) line: 62
>> XtextDocumentReconcileStrategy.reconcile(IRegion) line: 27
>> XtextReconciler.run(IProgressMonitor) line: 179 Worker.run() line: 54
>
>
|
|
|
Re: deadlock problem [message #544545 is a reply to message #544537] |
Sat, 03 July 2010 10:23   |
Eclipse User |
|
|
|
So far, I have only paused the execution and looked at where the
different threads were executing - did not look at exact positions, but
"mergePositions" was always on the call stack (afaict).
How can I provide more info?
To replicate:
If you update your b3 workspace remove the o.e.b3.backend.[edit, editor
and test] projects (obsolete generated stuff).
Then uncomment line 145 in
/org.eclipse.b3.beelang.ui/src/org/eclipse/b3/coloring/BeeLa ngSemanticHighlightingCalculator.java
which says:
// provideHighlightingFor2(resource, acceptor);
And with a b3 file like this:
unit HelloDeadlock version | {
}
Place the marker at | (if you get that far after typing 'version'), try
typing a version '1.0.0', or invoke proposals.
(I posted this in the bug as well...)
- henrik
On 7/3/10 3:27 PM, Sebastian Zarnekow wrote:
> Hi Henrik,
>
> can you confirm that it's an endless loop in
> MergedHighlightingPositionAcceptor.mergePositions?
>
> Regards,
> Sebastian
|
|
|
Re: deadlock problem [message #544567 is a reply to message #544545] |
Sat, 03 July 2010 20:32  |
Eclipse User |
|
|
|
For those that do not follow the bug - the cause of this was asking the
highlighter to highlight something of 0 length.
Regards
- henrik
On 7/3/10 4:23 PM, Henrik Lindberg wrote:
> So far, I have only paused the execution and looked at where the
> different threads were executing - did not look at exact positions, but
> "mergePositions" was always on the call stack (afaict).
>
> How can I provide more info?
>
> To replicate:
> If you update your b3 workspace remove the o.e.b3.backend.[edit, editor
> and test] projects (obsolete generated stuff).
>
> Then uncomment line 145 in
> /org.eclipse.b3.beelang.ui/src/org/eclipse/b3/coloring/BeeLa ngSemanticHighlightingCalculator.java
>
> which says:
> // provideHighlightingFor2(resource, acceptor);
>
> And with a b3 file like this:
> unit HelloDeadlock version | {
> }
>
> Place the marker at | (if you get that far after typing 'version'), try
> typing a version '1.0.0', or invoke proposals.
>
> (I posted this in the bug as well...)
>
> - henrik
>
> On 7/3/10 3:27 PM, Sebastian Zarnekow wrote:
>> Hi Henrik,
>>
>> can you confirm that it's an endless loop in
>> MergedHighlightingPositionAcceptor.mergePositions?
>>
>> Regards,
>> Sebastian
>
|
|
|
Goto Forum:
Current Time: Mon Sep 15 11:54:40 EDT 2025
Powered by FUDForum. Page generated in 0.03983 seconds
|