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

Bug 476608

Summary: Sluggishness reported in gdk_flush
Product: [Eclipse Project] Platform Reporter: Stefan Xenos <sxenos>
Component: SWTAssignee: Platform-SWT-Inbox <platform-swt-inbox>
Status: CLOSED WORKSFORME QA Contact:
Severity: normal    
Priority: P3 CC: alexandre.koptelov, ericwill
Version: 4.6Keywords: triaged
Target Milestone: ---   
Hardware: PC   
OS: Linux   
See Also: https://git.eclipse.org/r/127063
https://git.eclipse.org/c/platform/eclipse.platform.swt.git/commit/?id=aca62e3e174505e5d310af1ac7479886e5882aed
Whiteboard:

Description Stefan Xenos CLA 2015-09-03 16:27:06 EDT
We've received a number of UI freeze reports with gdk_flush on the stack trace. The freezes tend to be on the order of 200-300ms, but since they can happen on every keystroke it impacts the user experience.

The doc on gdk_flush says that the operation is rarely needed by applications:

https://developer.gnome.org/gdk3/stable/gdk3-General.html#gdk-flush

Could someone on the SWT team offer some insight into whether this call is actually necessary and why it might be so slow?


!ENTRY org.eclipse.ui.monitoring 2 0 2015-09-01 12:29:07.385
!MESSAGE UI freeze of 0.26s at 12:29:07.111
!SUBENTRY 1 org.eclipse.ui.monitoring 1 0 2015-09-01 12:29:07.385
!MESSAGE Sample at 12:29:07.245 (+0.134s)
Thread 'main' tid=1 (RUNNABLE)
!STACK 0
java.lang.Exception: Stack Trace
	at org.eclipse.swt.internal.gtk.OS._gdk_flush(Native Method)
	at org.eclipse.swt.internal.gtk.OS.gdk_flush(OS.java:4633)
	at org.eclipse.swt.widgets.Control.update(Control.java:5536)
	at org.eclipse.swt.widgets.Control.update(Control.java:5520)
	at org.eclipse.swt.custom.StyledText.handleKey(StyledText.java:5965)
	at org.eclipse.swt.custom.StyledText.handleKeyDown(StyledText.java:5995)
	at org.eclipse.swt.custom.StyledText$7.handleEvent(StyledText.java:5682)
	at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java:84)
	at org.eclipse.swt.widgets.Display.sendEvent(Display.java:4481)
	at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1327)
	at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1351)
	at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1336)
	at org.eclipse.swt.widgets.Widget.sendIMKeyEvent(Widget.java:1413)
	at org.eclipse.swt.widgets.Control.gtk_commit(Control.java:3092)
	at org.eclipse.swt.widgets.Canvas.gtk_commit(Canvas.java:163)
	at org.eclipse.swt.widgets.Widget.windowProc(Widget.java:1946)
	at org.eclipse.swt.widgets.Control.windowProc(Control.java:5590)
	at org.eclipse.swt.widgets.Display.windowProc(Display.java:4717)
	at org.eclipse.swt.internal.gtk.OS._gtk_im_context_filter_keypress(Native Method)
	at org.eclipse.swt.internal.gtk.OS.gtk_im_context_filter_keypress(OS.java:8665)
	at org.eclipse.swt.widgets.Control.filterKey(Control.java:2436)
	at org.eclipse.swt.widgets.Control.gtk_key_press_event(Control.java:3310)
	at org.eclipse.swt.widgets.Composite.gtk_key_press_event(Composite.java:785)
	at org.eclipse.swt.widgets.Widget.windowProc(Widget.java:1965)
	at org.eclipse.swt.widgets.Control.windowProc(Control.java:5590)
	at org.eclipse.swt.widgets.Display.windowProc(Display.java:4717)
	at org.eclipse.swt.internal.gtk.OS._gtk_main_do_event(Native Method)
	at org.eclipse.swt.internal.gtk.OS.gtk_main_do_event(OS.java:9272)
	at org.eclipse.swt.widgets.Display.eventProc(Display.java:1225)
	at org.eclipse.swt.internal.gtk.OS._g_main_context_iteration(Native Method)
	at org.eclipse.swt.internal.gtk.OS.g_main_context_iteration(OS.java:2422)
	at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:3428)
	at org.eclipse.e4.ui.internal.workbench.swt.PartRenderingEngine$4.run(PartRenderingEngine.java:1127)
	at org.eclipse.core.databinding.observable.Realm.runWithDefault(Realm.java:336)
	at org.eclipse.e4.ui.internal.workbench.swt.PartRenderingEngine.run(PartRenderingEngine.java:1018)
	at org.eclipse.e4.ui.internal.workbench.E4Workbench.createAndRunUI(E4Workbench.java:156)
	at org.eclipse.ui.internal.Workbench$5.run(Workbench.java:654)
	at org.eclipse.core.databinding.observable.Realm.runWithDefault(Realm.java:336)
	at org.eclipse.ui.internal.Workbench.createAndRunWorkbench(Workbench.java:598)
	at org.eclipse.ui.PlatformUI.createAndRunWorkbench(PlatformUI.java:150)
	at org.eclipse.ui.internal.ide.application.IDEApplication.start(IDEApplication.java:139)
	at org.eclipse.equinox.internal.app.EclipseAppHandle.run(EclipseAppHandle.java:196)
	at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.runApplication(EclipseAppLauncher.java:134)
	at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.start(EclipseAppLauncher.java:104)
	at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:380)
	at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:235)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.lang.reflect.Method.invoke(Method.java:483)
	at org.eclipse.equinox.launcher.Main.invokeFramework(Main.java:669)
	at org.eclipse.equinox.launcher.Main.basicRun(Main.java:608)
	at org.eclipse.equinox.launcher.Main.run(Main.java:1515)
	at org.eclipse.equinox.launcher.Main.main(Main.java:1488)
Comment 1 Alexander Kurtakov CLA 2015-09-04 09:55:44 EDT
TBH I always wondered why all the flushing but never investigated it. Help is more than welcome.
Comment 2 Alexander Kurtakov CLA 2016-04-15 13:11:12 EDT
Stefan, do you still get such reports? I would say let's remove gdk_flush for Oxygen M1 where it looks useless so we have more time to revert if/where needed.
Comment 3 Alexander Koptelov CLA 2016-06-20 07:50:02 EDT
(In reply to Alexander Kurtakov from comment #2)
> Stefan, do you still get such reports? I would say let's remove gdk_flush
> for Oxygen M1 where it looks useless so we have more time to revert if/where
> needed.

Hi Alexander!

We also get the report like that from our Eclipse-based application. It would be very nice to get rid of them. Please ping me if any additional info is needed.
Comment 4 Stefan Xenos CLA 2016-06-20 10:35:11 EDT
> Stefan, do you still get such reports?

Yes, I still get these reports. We enable the freeze reporting tool for most Eclipse users within Google.

Unfortunately, we currently only report this sort of data when the user indicates they had a problem... and since these reports are infrequent, it's hard to know for certain that a freeze of this form is fixed.

However, with that qualification, I will happily pass along any further reports I get on this topic.
Comment 5 Eclipse Genie CLA 2018-08-04 13:11:08 EDT
New Gerrit change created: https://git.eclipse.org/r/127063
Comment 7 Eric Williams CLA 2018-12-14 13:37:33 EST
gdk_flush() is gone in GTK4, not sure if it makes much sense to remove it in SWT-GTK3.
Comment 8 Eric Williams CLA 2019-02-20 14:06:25 EST
(In reply to Eric Williams from comment #7)
> gdk_flush() is gone in GTK4, not sure if it makes much sense to remove it in
> SWT-GTK3.

Aaaaand we've removed it from the GTK3 side of things too. Closing this ticket now.