Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.

Bug 321923

Summary: EvaluationContextManager#debugContextChanged sends JVM request on UI thread
Product: [Eclipse Project] JDT Reporter: Natasha D'Silva <ndsilva>
Component: DebugAssignee: JDT-Debug-Inbox <jdt-debug-inbox>
Status: CLOSED WONTFIX QA Contact:
Severity: normal    
Priority: P3 CC: error-reports-inbox, heiko.boettger, Michael_Rennie, pawel.1.piech
Version: 3.6   
Target Milestone: ---   
Hardware: PC   
OS: All   
Whiteboard: stalebug
Attachments:
Description Flags
one idea none

Description Natasha D'Silva CLA 2010-08-05 16:56:53 EDT
Build Identifier: 

I noticed my eclipse UI hung a bit at this point:


java.lang.Object.wait(long, int)
java.lang.Object.wait(long)
org.eclipse.jdi.internal.connect.PacketReceiveManager.waitForPacketAvailable(long, Object)
org.eclipse.jdi.internal.connect.PacketReceiveManager.getReply(int, long)
org.eclipse.jdi.internal.connect.PacketReceiveManager.getReply(JdwpCommandPacket)
org.eclipse.jdi.internal.MirrorImpl.requestVM(int, byte[])
org.eclipse.jdi.internal.MirrorImpl.requestVM(int, ByteArrayOutputStream)
org.eclipse.jdi.internal.ThreadReferenceImpl.frames(int, int)
org.eclipse.jdi.internal.ThreadReferenceImpl.frames()
org.eclipse.jdt.internal.debug.core.model.JDIThread.getUnderlyingFrames()
org.eclipse.jdt.internal.debug.core.model.JDIThread.computeStackFrames(boolean)
org.eclipse.jdt.internal.debug.core.model.JDIThread.computeStackFrames()
org.eclipse.jdt.internal.debug.core.model.JDIThread.getTopStackFrame()
org.eclipse.jdt.internal.debug.core.model.JDIThread.getAdapter(Class)
org.eclipse.jdt.internal.debug.ui.EvaluationContextManager.debugContextChanged(DebugContextEvent)
org.eclipse.debug.internal.ui.contexts.DebugWindowContextService$1.run()
org.eclipse.core.runtime.SafeRunner.run(ISafeRunnable)
org.eclipse.debug.internal.ui.contexts.DebugWindowContextService.notify(DebugContextEvent, ListenerList)
org.eclipse.debug.internal.ui.contexts.DebugWindowContextService.notify(DebugContextEvent)
th
The EvaluationContextManager tries to get the stack frame from the thread, which in this case, triggers a request and a wait on the UI thread. Is this code path unavoidable, or would it be ok on a job?


Reproducible: Always
Comment 1 Natasha D'Silva CLA 2010-12-02 16:16:20 EST
Still a problem...Any plans to fix for 3.7?
Comment 2 Michael Rennie CLA 2011-03-23 10:11:44 EDT
Created attachment 191750 [details]
one idea

Here is one approach: perform the actual setting of the debug context in a SafeRunnable
Comment 3 Pawel Piech CLA 2011-03-24 12:55:56 EDT
I don't think using safe runnable would do anything to avoid the UI delay, it would only protect the UI thread from handling any exceptions from the jvm call.  

The right thing to do would be to spin off a job to handle debugContextChanged().  However, this means that there would be some skid between the selection change in Debug view and the java system properties being updated.  So if the user right-clicks on a new thread to bring up its context menu, the commands/actions in that menu may not be evaluating against the correct context.

Another option may be to get rid of the SUPPORTS_FORCE_RETURN variable.  Without this variable, the debugContextChanged() listener wouldn't need to retrieve stack frames from a thread.  Instead, whatever uses the SUPPORTS_FORCE_RETURN property should retrieve the stack frame and examine it itself.
Comment 4 Heiko Böttger CLA 2014-09-23 10:31:15 EDT
Still happens in Keppler (4.3):


main [WAITING]
java.lang.Object.wait(long)
org.eclipse.jdi.internal.connect.PacketReceiveManager.waitForPacketAvailable(long, Object)
org.eclipse.jdi.internal.connect.PacketReceiveManager.getReply(int, long)
org.eclipse.jdi.internal.connect.PacketReceiveManager.getReply(JdwpCommandPacket)
org.eclipse.jdi.internal.MirrorImpl.requestVM(int, byte[])
org.eclipse.jdi.internal.MirrorImpl.requestVM(int, ByteArrayOutputStream)
org.eclipse.jdi.internal.ThreadReferenceImpl.frames(int, int)
org.eclipse.jdi.internal.ThreadReferenceImpl.frames()
org.eclipse.jdt.internal.debug.core.model.JDIThread.getUnderlyingFrames()
org.eclipse.jdt.internal.debug.core.model.JDIThread.computeStackFrames(boolean)
org.eclipse.jdt.internal.debug.core.model.JDIThread.computeStackFrames()
org.eclipse.jdt.internal.debug.core.model.JDIThread.getTopStackFrame()
org.eclipse.jdt.internal.debug.core.model.JDIStackFrame.isTopStackFrame()
org.eclipse.jdt.internal.debug.core.model.JDIStackFrame.canForceReturn()
org.eclipse.jdt.internal.debug.ui.EvaluationContextManager.setContext(IWorkbenchPage, IJavaStackFrame, boolean)
org.eclipse.jdt.internal.debug.ui.EvaluationContextManager.debugContextChanged(DebugContextEvent)
org.eclipse.debug.internal.ui.contexts.DebugWindowContextService$1.run()
org.eclipse.core.runtime.SafeRunner.run(ISafeRunnable)
org.eclipse.debug.internal.ui.contexts.DebugWindowContextService.notify(DebugContextEvent, Object[])
org.eclipse.debug.internal.ui.contexts.DebugWindowContextService.notify(DebugContextEvent)
org.eclipse.debug.internal.ui.contexts.DebugWindowContextService.debugContextChanged(DebugContextEvent)
org.eclipse.debug.ui.contexts.AbstractDebugContextProvider$1.run()
org.eclipse.core.runtime.SafeRunner.run(ISafeRunnable)
org.eclipse.debug.ui.contexts.AbstractDebugContextProvider.fire(DebugContextEvent)
org.eclipse.debug.internal.ui.views.launch.LaunchView$ContextProviderProxy.debugContextChanged(DebugContextEvent)
org.eclipse.debug.ui.contexts.AbstractDebugContextProvider$1.run()
org.eclipse.core.runtime.SafeRunner.run(ISafeRunnable)
org.eclipse.debug.ui.contexts.AbstractDebugContextProvider.fire(DebugContextEvent)
org.eclipse.debug.internal.ui.views.launch.LaunchView$TreeViewerContextProvider.activate(ISelection)
org.eclipse.debug.internal.ui.views.launch.LaunchView$1.selectionChanged(SelectionChangedEvent)
org.eclipse.jface.viewers.Viewer$2.run()
org.eclipse.core.runtime.SafeRunner.run(ISafeRunnable)
org.eclipse.ui.internal.JFaceUtil$1.run(ISafeRunnable)
org.eclipse.jface.util.SafeRunnable.run(ISafeRunnable)
org.eclipse.jface.viewers.Viewer.fireSelectionChanged(SelectionChangedEvent)
org.eclipse.jface.viewers.StructuredViewer.updateSelection(ISelection)
org.eclipse.jface.viewers.StructuredViewer.setSelection(ISelection, boolean)
org.eclipse.jface.viewers.TreeViewer.setSelection(ISelection, boolean)
org.eclipse.debug.internal.ui.viewers.model.InternalTreeModelViewer.trySelection(ISelection, boolean, boolean)
org.eclipse.debug.internal.ui.viewers.model.TreeModelContentProvider.handleSelect(IModelDelta)
org.eclipse.debug.internal.ui.viewers.model.TreeModelContentProvider.updateNodes(IModelDelta[], int)<5 recursive calls>
org.eclipse.debug.internal.ui.viewers.model.TreeModelContentProvider.updateModel(IModelDelta, int)
org.eclipse.debug.internal.ui.viewers.model.TreeModelContentProvider.doModelChanged(IModelDelta, IModelProxy)
org.eclipse.debug.internal.ui.viewers.model.TreeModelContentProvider.access$0(TreeModelContentProvider, IModelDelta, IModelProxy)
org.eclipse.debug.internal.ui.viewers.model.TreeModelContentProvider$2.run()
org.eclipse.swt.widgets.RunnableLock.run()
org.eclipse.swt.widgets.Synchronizer.runAsyncMessages(boolean)
org.eclipse.swt.widgets.Display.runAsyncMessages(boolean)
org.eclipse.swt.widgets.Display.readAndDispatch()
org.eclipse.jface.window.Window.runEventLoop(Shell)
org.eclipse.jface.window.Window.open()
org.eclipse.jface.dialogs.MessageDialog.open()
org.eclipse.jface.dialogs.MessageDialog.open(int, Shell, String, String, int)
org.eclipse.jface.dialogs.MessageDialog.openError(Shell, String, String)
org.eclipse.debug.internal.ui.commands.actions.ExecuteActionRequest$1.run()
org.eclipse.swt.widgets.RunnableLock.run()
org.eclipse.swt.widgets.Synchronizer.runAsyncMessages(boolean)
org.eclipse.swt.widgets.Display.runAsyncMessages(boolean)
org.eclipse.swt.widgets.Display.readAndDispatch()
org.eclipse.e4.ui.internal.workbench.swt.PartRenderingEngine$9.run()
org.eclipse.core.databinding.observable.Realm.runWithDefault(Realm, Runnable)
org.eclipse.e4.ui.internal.workbench.swt.PartRenderingEngine.run(MApplicationElement, IEclipseContext)
org.eclipse.e4.ui.internal.workbench.E4Workbench.createAndRunUI(MApplicationElement)
org.eclipse.ui.internal.Workbench$5.run()
org.eclipse.core.databinding.observable.Realm.runWithDefault(Realm, Runnable)
org.eclipse.ui.internal.Workbench.createAndRunWorkbench(Display, WorkbenchAdvisor)
org.eclipse.ui.PlatformUI.createAndRunWorkbench(Display, WorkbenchAdvisor)
org.eclipse.ui.internal.ide.application.IDEApplication.start(IApplicationContext)
org.eclipse.equinox.internal.app.EclipseAppHandle.run(Object)
org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.runApplication(Object)
org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.start(Object)
org.eclipse.core.runtime.adaptor.EclipseStarter.run(Object)
org.eclipse.core.runtime.adaptor.EclipseStarter.run(String[], Runnable)
sun.reflect.NativeMethodAccessorImpl.invoke0(Method, Object, Object[])
sun.reflect.NativeMethodAccessorImpl.invoke(Object, Object[])
sun.reflect.DelegatingMethodAccessorImpl.invoke(Object, Object[])
java.lang.reflect.Method.invoke(Object, Object[])
org.eclipse.equinox.launcher.Main.invokeFramework(String[], URL[])
org.eclipse.equinox.launcher.Main.basicRun(String[])
org.eclipse.equinox.launcher.Main.run(String[])
org.eclipse.equinox.launcher.Main.main(String[])

Any updates on this issue. In my case the only solution was to kill the debugged application.
Comment 5 Sarika Sinha CLA 2015-02-03 02:14:57 EST
*** Bug 453738 has been marked as a duplicate of this bug. ***
Comment 6 Sarika Sinha CLA 2015-02-03 02:17:04 EST
*** Bug 451877 has been marked as a duplicate of this bug. ***
Comment 7 Sarika Sinha CLA 2015-02-03 02:17:31 EST
*** Bug 451873 has been marked as a duplicate of this bug. ***
Comment 8 Eclipse Genie CLA 2019-09-27 16:38:02 EDT
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.