Eclipse hangs (and never recovers) or uses lots of CPU after editing of Stratego programs. This is a bug and a regression.

Submitted by Vlad Vergu on 24 February 2014 at 18:53
dumped_threads.txt24 February 2014 at 19:14

On 24 February 2014 at 18:57 Vlad Vergu commented:

No way yet to reliably recreate this. The best bet is to open a few Stratego files and start trying to resolve things (Ctrl- click) while watching the CPU usage or the responsiveness of Eclipse.

There are reports that it appeared between builds http://hydra.nixos.org/build/9135882 and http://hydra.nixos.org/build/9171395. The latter is broken and the current http://hydra.nixos.org/build/9184781 is confirmed to have the issue.


On 24 February 2014 at 19:19 Vlad Vergu commented:

Analysis hints that the high CPU usage is caused by a looping editor-resolve for Stratego. I have not been able to identify particular Stratego constructs that trigger this but it will eventually happen while trying to resolve to definitions in Stratego. This will also happen during hover sometimes because the editor-hover strategy probably invokes the resolution strategy.

The freeze/hang occurs when the editor-resolve is invoked from the main thread; it then loops and never gets to handling OS events (UI, mouse, keyboard). Introducing stdout debugging to the lock/unlock of Environment.lock gives the following pattern of locks-unlocks:

LOCKING by Thread[main,6,main]
LOCKED by Thread[main,6,main]
LOCKING by Thread[main,6,main]
LOCKED by Thread[main,6,main]
UNLOCKING by Thread[main,6,main]
UNLOCKING by Thread[main,6,main]
LOCKING by Thread[Worker-20,5,main]
LOCKING by Thread[Worker-21,5,main]
LOCKING by Thread[Worker-16,5,main]
LOCKING by Thread[Worker-18,5,main]
LOCKING by Thread[Worker-22,5,main]
LOCKING by Thread[main,6,main]
LOCKED by Thread[main,6,main]
LOCKING by Thread[main,6,main]
LOCKED by Thread[main,6,main]
UNLOCKING by Thread[main,6,main]
UNLOCKING by Thread[main,6,main]
LOCKING by Thread[Worker-24,5,main]
LOCKING by Thread[main,6,main]
LOCKED by Thread[main,6,main]
LOCKING by Thread[main,6,main]
LOCKED by Thread[main,6,main]
UNLOCKING by Thread[main,6,main]
UNLOCKING by Thread[main,6,main]

Up to here everything is fine, but then later:

LOCKING by Thread[Worker-19,5,main]
LOCKING by Thread[Worker-27,5,main]
LOCKING by Thread[Worker-25,5,main]
LOCKING by Thread[Worker-29,5,main]
LOCKING by Thread[Worker-28,5,main]
LOCKING by Thread[Worker-23,5,main]
LOCKING by Thread[Worker-30,5,main]
LOCKING by Thread[Worker-32,5,main]
LOCKING by Thread[main,6,main]
LOCKED by Thread[main,6,main]
LOCKING by Thread[main,6,main]
LOCKED by Thread[main,6,main]
UNLOCKING by Thread[main,6,main]
UNLOCKING by Thread[main,6,main]
LOCKING by Thread[main,6,main]
LOCKED by Thread[main,6,main]
LOCKING by Thread[main,6,main]
LOCKED by Thread[main,6,main]

See that the main thread obtains the lock and never releases it anymore (the main thread is in fact looping). This locks the UI and keeps the worker threads waiting for it. The Eclipse instance never recovers. Note that the order of the LOCKING, LOCKED and UNLOCKING from the above are probably not in order across threads (due to System.out.println).

A thread dump (long time after first crash) reveals the following of interest:

"main" prio=5 tid=0x00007fe2f4806800 nid=0x507 runnable [0x00007fff55ece000]
   java.lang.Thread.State: RUNNABLE
  at org.spoofax.interpreter.library.ssl.SSL_addi.call(SSL_addi.java:34)
  at org.strategoxt.lang.Context.invokePrimitive(Context.java:227)
  at org.strategoxt.lang.Context.invokePrimitive(Context.java:216)
  at org.strategoxt.stratego_lib.inc_0_0.invoke(inc_0_0.java:35)
  at trans.position_of_term_1_1.invoke(position_of_term_1_1.java:111)
  at trans.position_of_term_1_0.invoke(position_of_term_1_0.java:72)
  at trans.position_of_term_1_1.invoke(position_of_term_1_1.java:48)
  at trans.position_of_term_1_0.invoke(position_of_term_1_0.java:49)
  at trans.position_of_term_1_1.invoke(position_of_term_1_1.java:93)
  at trans.position_of_term_1_1.invoke(position_of_term_1_1.java:114)
  at trans.position_of_term_1_0.invoke(position_of_term_1_0.java:49)
  at trans.position_of_term_1_1.invoke(position_of_term_1_1.java:48)
  at trans.position_of_term_1_1.invoke(position_of_term_1_1.java:114)
  at trans.position_of_term_1_0.invoke(position_of_term_1_0.java:49)
  at trans.position_of_term_1_1.invoke(position_of_term_1_1.java:48)
  at trans.position_of_term_1_0.invoke(position_of_term_1_0.java:49)
  at trans.position_of_term_1_1.invoke(position_of_term_1_1.java:93)
  at trans.position_of_term_1_0.invoke(position_of_term_1_0.java:72)
  at trans.position_of_term_1_1.invoke(position_of_term_1_1.java:48)
  at trans.position_of_term_1_0.invoke(position_of_term_1_0.java:72)
  at trans.position_of_term_1_1.invoke(position_of_term_1_1.java:48)
  at trans.position_of_term_1_0.invoke(position_of_term_1_0.java:49)
  at trans.position_of_term_1_1.invoke(position_of_term_1_1.java:93)
  at trans.position_of_term_1_0.invoke(position_of_term_1_0.java:72)
  at trans.position_of_term_1_1.invoke(position_of_term_1_1.java:48)
  at trans.position_of_term_1_1.invoke(position_of_term_1_1.java:69)
  at trans.position_of_term_1_0.invoke(position_of_term_1_0.java:49)
  at trans.position_of_term_1_1.invoke(position_of_term_1_1.java:48)
  at trans.position_of_term_1_0.invoke(position_of_term_1_0.java:49)
  at trans.position_of_term_1_1.invoke(position_of_term_1_1.java:93)
  at trans.position_of_term_1_0.invoke(position_of_term_1_0.java:49)
  at trans.position_of_term_1_1.invoke(position_of_term_1_1.java:93)
  at trans.position_of_term_1_0.invoke(position_of_term_1_0.java:72)
  at trans.position_of_term_1_1.invoke(position_of_term_1_1.java:93)
  at trans.position_of_term_1_0.invoke(position_of_term_1_0.java:72)
  at trans.position_of_term_1_1.invoke(position_of_term_1_1.java:93)
  at trans.position_of_term_1_1.invoke(position_of_term_1_1.java:69)
  at trans.position_of_term_1_0.invoke(position_of_term_1_0.java:49)
  at trans.position_of_term_1_1.invoke(position_of_term_1_1.java:48)
  at trans.position_of_term_1_0.invoke(position_of_term_1_0.java:49)
  at trans.position_of_term_1_1.invoke(position_of_term_1_1.java:48)
  at trans.position_of_term_1_1.invoke(position_of_term_1_1.java:69)
  at trans.position_of_term_1_1.invoke(position_of_term_1_1.java:69)
  at trans.position_of_term_1_1.invoke(position_of_term_1_1.java:69)
  at trans.position_of_term_1_0.invoke(position_of_term_1_0.java:49)
  at trans.position_of_term_1_1.invoke(position_of_term_1_1.java:48)
  at trans.position_of_term_1_0.invoke(position_of_term_1_0.java:49)
  at trans.position_of_term_1_1.invoke(position_of_term_1_1.java:48)
  at trans.position_of_term_1_0.invoke(position_of_term_1_0.java:49)
  at trans.position_of_term_1_1.invoke(position_of_term_1_1.java:48)
  at trans.position_of_term_1_0.invoke(position_of_term_1_0.java:49)
  at trans.position_of_term_1_1.invoke(position_of_term_1_1.java:48)
  at trans.position_of_term_1_1.invoke(position_of_term_1_1.java:69)
  at trans.position_of_term_1_0.invoke(position_of_term_1_0.java:49)
  at trans.desugar_position_1_1.invoke(desugar_position_1_1.java:43)
  at trans.editor_resolve_0_0.invoke(editor_resolve_0_0.java:43)
  at org.strategoxt.lang.Strategy.invokeDynamic(Strategy.java:30)
  at org.strategoxt.lang.InteropSDefT.evaluate(InteropSDefT.java:192)
  at org.strategoxt.lang.InteropSDefT.evaluate(InteropSDefT.java:183)
  at org.strategoxt.lang.InteropSDefT$StrategyBody.evaluate(InteropSDefT.java:245)
  at org.spoofax.interpreter.core.Interpreter.evaluate(Interpreter.java:109)
  at org.spoofax.interpreter.core.Interpreter.invoke(Interpreter.java:82)
  at org.strategoxt.HybridInterpreter.invoke(HybridInterpreter.java:424)
  at org.strategoxt.imp.debug.core.str.launching.DebuggableHybridInterpreter.invoke(DebuggableHybridInterpreter.java:150)
  at org.strategoxt.imp.runtime.services.StrategoObserver.invoke(StrategoObserver.java:637)
  at org.strategoxt.imp.runtime.services.StrategoObserver.invokeSilent(StrategoObserver.java:695)
  at org.strategoxt.imp.runtime.services.StrategoObserver.invokeSilent(StrategoObserver.java:686)
  at org.strategoxt.imp.runtime.services.StrategoObserver.invokeSilent(StrategoObserver.java:664)
  at org.strategoxt.imp.runtime.services.StrategoReferenceResolver.getLinkTarget(StrategoReferenceResolver.java:58)
  at org.strategoxt.imp.runtime.services.StrategoReferenceResolver.getLinkTarget(StrategoReferenceResolver.java:1)
  at org.strategoxt.imp.runtime.dynamicloading.DynamicReferenceResolver.getLinkTarget(DynamicReferenceResolver.java:21)
  at org.eclipse.imp.editor.HyperlinkDetector.detectHyperlinks(HyperlinkDetector.java:69)
  at org.eclipse.imp.editor.internal.SourceHyperlinkController.detectHyperlinks(SourceHyperlinkController.java:42)
  at org.eclipse.jface.text.hyperlink.HyperlinkManager.findHyperlinks(HyperlinkManager.java:289)
  - locked <0x00000007cb344e78> (a [Lorg.eclipse.jface.text.hyperlink.IHyperlinkDetector;)
  at org.eclipse.jface.text.hyperlink.HyperlinkManager.findHyperlinks(HyperlinkManager.java:261)
  at org.eclipse.jface.text.hyperlink.HyperlinkManager.mouseMove(HyperlinkManager.java:469)
  at org.eclipse.swt.widgets.TypedListener.handleEvent(TypedListener.java:212)
  at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java:84)
  at org.eclipse.swt.widgets.Display.sendEvent(Display.java:4166)
  at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1466)
  at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1489)
  at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1474)
  at org.eclipse.swt.widgets.Widget.notifyListeners(Widget.java:1279)
  at org.eclipse.swt.widgets.Display.runDeferredEvents(Display.java:4012)
  at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:3651)
  at org.eclipse.e4.ui.internal.workbench.swt.PartRenderingEngine$9.run(PartRenderingEngine.java:1113)
  at org.eclipse.core.databinding.observable.Realm.runWithDefault(Realm.java:332)
  at org.eclipse.e4.ui.internal.workbench.swt.PartRenderingEngine.run(PartRenderingEngine.java:997)
  at org.eclipse.e4.ui.internal.workbench.E4Workbench.createAndRunUI(E4Workbench.java:138)
  at org.eclipse.ui.internal.Workbench$5.run(Workbench.java:610)
  at org.eclipse.core.databinding.observable.Realm.runWithDefault(Realm.java:332)
  at org.eclipse.ui.internal.Workbench.createAndRunWorkbench(Workbench.java:567)
  at org.eclipse.ui.PlatformUI.createAndRunWorkbench(PlatformUI.java:150)
  at org.eclipse.ui.internal.ide.application.IDEApplication.start(IDEApplication.java:124)
  at org.eclipse.equinox.internal.app.EclipseAppHandle.run(EclipseAppHandle.java:196)
  at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.runApplication(EclipseAppLauncher.java:110)
  at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.start(EclipseAppLauncher.java:79)
  at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:354)
  at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:181)
  at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
  at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
  at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
  at java.lang.reflect.Method.invoke(Method.java:606)
  at org.eclipse.equinox.launcher.Main.invokeFramework(Main.java:636)
  at org.eclipse.equinox.launcher.Main.basicRun(Main.java:591)
  at org.eclipse.equinox.launcher.Main.run(Main.java:1450)
  at org.eclipse.equinox.launcher.Main.main(Main.java:1426)

And a whole bunch of the blocked threads like this:

"Worker-0" prio=5 tid=0x00007fe2f3aff000 nid=0xb203 waiting on condition [0x0000000123b0c000]
   java.lang.Thread.State: WAITING (parking)
  at sun.misc.Unsafe.park(Native Method)
  - parking to wait for  <0x00000007c8d63968> (a java.util.concurrent.locks.ReentrantLock$NonfairSync)
  at java.util.concurrent.locks.LockSupport.park(LockSupport.java:186)
  at java.util.concurrent.locks.AbstractQueuedSynchronizer.parkAndCheckInterrupt(AbstractQueuedSynchronizer.java:834)
  at java.util.concurrent.locks.AbstractQueuedSynchronizer.acquireQueued(AbstractQueuedSynchronizer.java:867)
  at java.util.concurrent.locks.AbstractQueuedSynchronizer.acquire(AbstractQueuedSynchronizer.java:1197)
  at java.util.concurrent.locks.ReentrantLock$NonfairSync.lock(ReentrantLock.java:214)
  at java.util.concurrent.locks.ReentrantLock.lock(ReentrantLock.java:290)
  at org.strategoxt.imp.runtime.SWTSafeLock.lock(SWTSafeLock.java:49)
  at org.strategoxt.imp.runtime.Environment$1.lock(Environment.java:73)
  at org.strategoxt.imp.runtime.services.views.outline.OutlineService.getOutline(OutlineService.java:45)
  at org.strategoxt.imp.runtime.services.views.outline.SpoofaxOutlinePage.update(SpoofaxOutlinePage.java:94)
  at org.strategoxt.imp.runtime.services.views.outline.SpoofaxOutlinePage.update(SpoofaxOutlinePage.java:73)
  at org.eclipse.imp.editor.ParserScheduler.notifyModelListeners(ParserScheduler.java:136)
  at org.eclipse.imp.editor.ParserScheduler.run(ParserScheduler.java:88)
  at org.eclipse.core.internal.jobs.Worker.run(Worker.java:53)

The “main” thread is not crashed or hung, it is really looping. A full dump of blocked threads is attached to this issue.

There are multiple issues here:

  1. the editor-resolve loops. This is new
  2. some processing is done in the main thread. In this case the editor-resolve and the editor-hover. After inspection of the code it seems that this has always been the case.

On 24 February 2014 at 19:20 Gabriël Konat commented:

If you get constant CPU usage, open up the profiler and have a look.


On 24 February 2014 at 19:25 Gabriël Konat commented:

We saw long strack traces with position_of_term_1_x in there as well on Augusto’s laptop.


On 24 February 2014 at 19:36 Vlad Vergu commented:

There we go. This is the happy case:

org.spoofax.interpreter.core.InterpreterException: Exception during evaluation
  at org.spoofax.interpreter.core.Interpreter.evaluate(Interpreter.java:120)
  at org.spoofax.interpreter.core.Interpreter.invoke(Interpreter.java:82)
  at org.strategoxt.HybridInterpreter.invoke(HybridInterpreter.java:424)
  at org.strategoxt.imp.debug.core.str.launching.DebuggableHybridInterpreter.invoke(DebuggableHybridInterpreter.java:150)
  at org.strategoxt.imp.runtime.services.StrategoObserver.invoke(StrategoObserver.java:638)
  at org.strategoxt.imp.runtime.services.StrategoObserver.invokeSilent(StrategoObserver.java:696)
  at org.strategoxt.imp.runtime.services.StrategoObserver.invokeSilent(StrategoObserver.java:687)
  at org.strategoxt.imp.runtime.services.StrategoObserver.invokeSilent(StrategoObserver.java:665)
  at org.strategoxt.imp.runtime.services.StrategoReferenceResolver.getLinkTarget(StrategoReferenceResolver.java:59)
  at org.strategoxt.imp.runtime.services.StrategoReferenceResolver.getLinkTarget(StrategoReferenceResolver.java:1)
  at org.strategoxt.imp.runtime.dynamicloading.DynamicReferenceResolver.getLinkTarget(DynamicReferenceResolver.java:21)
  at org.eclipse.imp.editor.HyperlinkDetector.detectHyperlinks(HyperlinkDetector.java:69)
  at org.eclipse.imp.editor.internal.SourceHyperlinkController.detectHyperlinks(SourceHyperlinkController.java:42)
  at org.eclipse.jface.text.hyperlink.HyperlinkManager.findHyperlinks(HyperlinkManager.java:289)
  at org.eclipse.jface.text.hyperlink.HyperlinkManager.findHyperlinks(HyperlinkManager.java:261)
  at org.eclipse.jface.text.hyperlink.HyperlinkManager.mouseMove(HyperlinkManager.java:469)
  at org.eclipse.swt.widgets.TypedListener.handleEvent(TypedListener.java:212)
  at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java:84)
  at org.eclipse.swt.widgets.Display.sendEvent(Display.java:4166)
  at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1466)
  at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1489)
  at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1474)
  at org.eclipse.swt.widgets.Widget.notifyListeners(Widget.java:1279)
  at org.eclipse.swt.widgets.Display.runDeferredEvents(Display.java:4012)
  at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:3651)
  at org.eclipse.e4.ui.internal.workbench.swt.PartRenderingEngine$9.run(PartRenderingEngine.java:1113)
  at org.eclipse.core.databinding.observable.Realm.runWithDefault(Realm.java:332)
  at org.eclipse.e4.ui.internal.workbench.swt.PartRenderingEngine.run(PartRenderingEngine.java:997)
  at org.eclipse.e4.ui.internal.workbench.E4Workbench.createAndRunUI(E4Workbench.java:138)
  at org.eclipse.ui.internal.Workbench$5.run(Workbench.java:610)
  at org.eclipse.core.databinding.observable.Realm.runWithDefault(Realm.java:332)
  at org.eclipse.ui.internal.Workbench.createAndRunWorkbench(Workbench.java:567)
  at org.eclipse.ui.PlatformUI.createAndRunWorkbench(PlatformUI.java:150)
  at org.eclipse.ui.internal.ide.application.IDEApplication.start(IDEApplication.java:124)
  at org.eclipse.equinox.internal.app.EclipseAppHandle.run(EclipseAppHandle.java:196)
  at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.runApplication(EclipseAppLauncher.java:110)
  at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.start(EclipseAppLauncher.java:79)
  at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:354)
  at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:181)
  at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
  at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
  at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
  at java.lang.reflect.Method.invoke(Method.java:606)
  at org.eclipse.equinox.launcher.Main.invokeFramework(Main.java:636)
  at org.eclipse.equinox.launcher.Main.basicRun(Main.java:591)
  at org.eclipse.equinox.launcher.Main.run(Main.java:1450)
  at org.eclipse.equinox.launcher.Main.main(Main.java:1426)
Caused by: org.strategoxt.lang.StrategoException: Infinite loop detected in repeat strategy
  at org.strategoxt.lang.SRTS_EXT_repeat_1_0.invokeSuspiciously(SRTS_EXT_repeat_1_0.java:41)
  at org.strategoxt.lang.SRTS_EXT_repeat_1_0.invoke(SRTS_EXT_repeat_1_0.java:26)
  at org.strategoxt.lang.compat.override.performance_tweaks.repeat_1_0_override.invoke(repeat_1_0_override.java:21)
  at trans.lifted976.invoke(lifted976.java:29)
  at org.strategoxt.lang.compat.override.performance_tweaks.g_3385.invoke(g_3385.java:20)
  at org.strategoxt.lang.SRTS_all.map(SRTS_all.java:60)
  at org.strategoxt.lang.SRTS_all.invoke(SRTS_all.java:21)
  at org.strategoxt.lang.compat.override.performance_tweaks.g_3385.invoke(g_3385.java:23)
  at org.strategoxt.lang.SRTS_all.invoke(SRTS_all.java:28)
  at org.strategoxt.lang.compat.override.performance_tweaks.g_3385.invoke(g_3385.java:23)
  at org.strategoxt.lang.SRTS_all.invoke(SRTS_all.java:28)
  at org.strategoxt.lang.compat.override.performance_tweaks.g_3385.invoke(g_3385.java:23)
  at org.strategoxt.lang.SRTS_all.invoke(SRTS_all.java:28)
  at org.strategoxt.lang.compat.override.performance_tweaks.g_3385.invoke(g_3385.java:23)
  at org.strategoxt.lang.SRTS_all.invoke(SRTS_all.java:28)
  at org.strategoxt.lang.compat.override.performance_tweaks.g_3385.invoke(g_3385.java:23)
  at org.strategoxt.lang.SRTS_all.invoke(SRTS_all.java:28)
  at org.strategoxt.lang.compat.override.performance_tweaks.g_3385.invoke(g_3385.java:23)
  at org.strategoxt.lang.SRTS_all.mapIgnoreAnnos(SRTS_all.java:109)
  at org.strategoxt.lang.SRTS_all.map(SRTS_all.java:77)
  at org.strategoxt.lang.SRTS_all.invoke(SRTS_all.java:21)
  at org.strategoxt.lang.compat.override.performance_tweaks.g_3385.invoke(g_3385.java:23)
  at org.strategoxt.lang.SRTS_all.invoke(SRTS_all.java:28)
  at org.strategoxt.lang.compat.override.performance_tweaks.g_3385.invoke(g_3385.java:23)
  at org.strategoxt.lang.SRTS_all.mapMaintainAnnos(SRTS_all.java:124)
  at org.strategoxt.lang.SRTS_all.map(SRTS_all.java:68)
  at org.strategoxt.lang.SRTS_all.invoke(SRTS_all.java:21)
  at org.strategoxt.lang.compat.override.performance_tweaks.g_3385.invoke(g_3385.java:23)
  at org.strategoxt.lang.SRTS_all.invoke(SRTS_all.java:28)
  at org.strategoxt.lang.compat.override.performance_tweaks.g_3385.invoke(g_3385.java:23)
  at org.strategoxt.lang.compat.override.performance_tweaks.topdown_1_0_override.invoke(topdown_1_0_override.java:23)
  at trans.desugar_position_1_1.invoke(desugar_position_1_1.java:40)
  at trans.editor_resolve_0_0.invoke(editor_resolve_0_0.java:48)
  at org.strategoxt.lang.Strategy.invokeDynamic(Strategy.java:30)
  at org.strategoxt.lang.InteropSDefT.evaluate(InteropSDefT.java:192)
  at org.strategoxt.lang.InteropSDefT.evaluate(InteropSDefT.java:183)
  at org.strategoxt.lang.InteropSDefT$StrategyBody.evaluate(InteropSDefT.java:245)
  at org.spoofax.interpreter.core.Interpreter.evaluate(Interpreter.java:109)
  ... 46 more

And this is unhappy case when eclipse just hangs (for clarification this stack trace is not a crash, it is intentionally emitted):

UNLOCKING by Thread[main,6,main]
LOCKING by Thread[main,6,main]
LOCKED by Thread[main,6,main]
LOCKING by Thread[main,6,main]
LOCKED by Thread[main,6,main]

!ENTRY org.strategoxt.imp.runtime 2 0 2014-02-24 19:33:49.396
!MESSAGE invoking: editor-resolve
!STACK 0
java.lang.RuntimeException: invoking: editor-resolve
  at org.strategoxt.imp.runtime.Environment.logWarning(Environment.java:281)
  at org.strategoxt.imp.runtime.services.StrategoObserver.invoke(StrategoObserver.java:637)
  at org.strategoxt.imp.runtime.services.StrategoObserver.invokeSilent(StrategoObserver.java:696)
  at org.strategoxt.imp.runtime.services.StrategoObserver.invokeSilent(StrategoObserver.java:687)
  at org.strategoxt.imp.runtime.services.StrategoObserver.invokeSilent(StrategoObserver.java:665)
  at org.strategoxt.imp.runtime.services.StrategoReferenceResolver.getLinkTarget(StrategoReferenceResolver.java:58)
  at org.strategoxt.imp.runtime.services.StrategoReferenceResolver.getLinkTarget(StrategoReferenceResolver.java:1)
  at org.strategoxt.imp.runtime.dynamicloading.DynamicReferenceResolver.getLinkTarget(DynamicReferenceResolver.java:21)
  at org.eclipse.imp.editor.HyperlinkDetector.detectHyperlinks(HyperlinkDetector.java:69)
  at org.eclipse.imp.editor.internal.SourceHyperlinkController.detectHyperlinks(SourceHyperlinkController.java:42)
  at org.eclipse.jface.text.hyperlink.HyperlinkManager.findHyperlinks(HyperlinkManager.java:289)
  at org.eclipse.jface.text.hyperlink.HyperlinkManager.findHyperlinks(HyperlinkManager.java:261)
  at org.eclipse.jface.text.hyperlink.HyperlinkManager.mouseMove(HyperlinkManager.java:469)
  at org.eclipse.swt.widgets.TypedListener.handleEvent(TypedListener.java:212)
  at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java:84)
  at org.eclipse.swt.widgets.Display.sendEvent(Display.java:4166)
  at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1466)
  at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1489)
  at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1474)
  at org.eclipse.swt.widgets.Widget.notifyListeners(Widget.java:1279)
  at org.eclipse.swt.widgets.Display.runDeferredEvents(Display.java:4012)
  at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:3651)
  at org.eclipse.e4.ui.internal.workbench.swt.PartRenderingEngine$9.run(PartRenderingEngine.java:1113)
  at org.eclipse.core.databinding.observable.Realm.runWithDefault(Realm.java:332)
  at org.eclipse.e4.ui.internal.workbench.swt.PartRenderingEngine.run(PartRenderingEngine.java:997)
  at org.eclipse.e4.ui.internal.workbench.E4Workbench.createAndRunUI(E4Workbench.java:138)
  at org.eclipse.ui.internal.Workbench$5.run(Workbench.java:610)
  at org.eclipse.core.databinding.observable.Realm.runWithDefault(Realm.java:332)
  at org.eclipse.ui.internal.Workbench.createAndRunWorkbench(Workbench.java:567)
  at org.eclipse.ui.PlatformUI.createAndRunWorkbench(PlatformUI.java:150)
  at org.eclipse.ui.internal.ide.application.IDEApplication.start(IDEApplication.java:124)
  at org.eclipse.equinox.internal.app.EclipseAppHandle.run(EclipseAppHandle.java:196)
  at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.runApplication(EclipseAppLauncher.java:110)
  at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.start(EclipseAppLauncher.java:79)
  at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:354)
  at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:181)
  at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
  at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
  at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
  at java.lang.reflect.Method.invoke(Method.java:606)
  at org.eclipse.equinox.launcher.Main.invokeFramework(Main.java:636)
  at org.eclipse.equinox.launcher.Main.basicRun(Main.java:591)
  at org.eclipse.equinox.launcher.Main.run(Main.java:1450)
  at org.eclipse.equinox.launcher.Main.main(Main.java:1426)

But there have been no changes to the Stratego editor.


On 24 February 2014 at 21:25 Lennart Kats commented:

Eclipse has the habit of calling these things form the UI thread, but that causes all kinds of issues with locking. Tobi at some point fixed it for the completion service (see https://github.com/metaborg/spoofax/blob/master/org.strategoxt.imp.runtime/src/org/strategoxt/imp/runtime/services/ContentProposer.java#L202), but we never got around to fixing it for reference resolving.


On 25 February 2014 at 00:45 Vlad Vergu commented:

Thank you for the tip Lennart. I was actually looking for an example of moving execution away from the UI thread and making it cancellable.


On 25 February 2014 at 09:48 Guido Wachsmuth commented:

For now, nightly users should uninstall Spoofax nightly and re-install with this update site: http://hydra.nixos.org/build/9135882/download/1/site


On 25 February 2014 at 11:14 Augusto tagged !passalaqua

On 25 February 2014 at 11:18 Vlad Vergu commented:

This may be caused by a commit to the Spoofax repo. See comment on GitHub.


On 25 February 2014 at 15:00 Gabriël Konat commented:

Commit https://github.com/metaborg/runtime-libraries/commit/272d8ec23ab597883b1771c3e7ed4b2443419fa0 seems to have fixed the issue with reference resolution and hovering Stratego files hanging eclipse. It was apparently caused by importing the definitions for position-of-term twice, once from lib/editor-common.generated and once from lib/runtime/editor/positions. I’m not sure why importing them twice caused this strategy to loop, but it may indicate that position-of-term relies on the order in which strategies are defined, which is evil!


On 25 February 2014 at 15:29 Vlad Vergu closed this issue.

Log in to post comments