Skip to main content
aboutsummaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorAlexandr Miloslavskiy2019-05-08 14:02:53 +0000
committerEric Williams2019-05-17 19:48:40 +0000
commit929b63844fbc2a382b7bd182abadf81b45dc04d3 (patch)
treef50a16f6126fecb3ec9ba0403e2ed53319f9ae83 /tests
parentd119e6e20762735d3205896d791bf71952dc31ec (diff)
downloadeclipse.platform.swt-929b63844fbc2a382b7bd182abadf81b45dc04d3.tar.gz
eclipse.platform.swt-929b63844fbc2a382b7bd182abadf81b45dc04d3.tar.xz
eclipse.platform.swt-929b63844fbc2a382b7bd182abadf81b45dc04d3.zip
Bug 547093 - [GTK] GNOME logoff hangs for 90 seconds after System.exit() on SWT.Dispose for Display
Change 1 -------- Fixed the session manager hang. It started to happen after Bug 531634, on GNOME only. The problem is caused by a combination of System.exit() during 'SWT.Dispose' for 'Display' in SWT application and an oversight in GNOME session-manager [1]. Due to System.exit() SWT's 'SessionManagerDBus' doesn't have a chance to respond with 'EndSessionResponse' and GNOME's session manager gets stuck waiting for the reply. Change 2 -------- Removed lock from APIs needed in shutdown hook to avoid the deadlock. Lock is a problem because java's shutdown hooks are implemented as separate threads, and the main thread will hold lock, because session manager signals are dispatched in 'g_main_context_iteration'. The lock shouldn't be used so often anyway, see Bug 546743. Change 3 -------- Fixed incorrect behavior when QueryEndSession shows a message box and when user closes it, QueryEndSession timeout elapsed and session manager expects answer to EndSession instead. [1] https://gitlab.gnome.org/GNOME/gnome-session/merge_requests/15 Change-Id: I891f2b15830caafc73ccfa6491a8f21c2bbc0160 Signed-off-by: Alexandr Miloslavskiy <alexandr.miloslavskiy@syntevo.com>
Diffstat (limited to 'tests')
-rw-r--r--tests/org.eclipse.swt.tests.gtk/ManualTests/org/eclipse/swt/tests/gtk/snippets/Bug547093_LogoffStuck.java56
1 files changed, 56 insertions, 0 deletions
diff --git a/tests/org.eclipse.swt.tests.gtk/ManualTests/org/eclipse/swt/tests/gtk/snippets/Bug547093_LogoffStuck.java b/tests/org.eclipse.swt.tests.gtk/ManualTests/org/eclipse/swt/tests/gtk/snippets/Bug547093_LogoffStuck.java
new file mode 100644
index 0000000000..9effebffa8
--- /dev/null
+++ b/tests/org.eclipse.swt.tests.gtk/ManualTests/org/eclipse/swt/tests/gtk/snippets/Bug547093_LogoffStuck.java
@@ -0,0 +1,56 @@
+/*******************************************************************************
+ * Copyright (c) 2019 Syntevo and others. All rights reserved.
+ * The contents of this file are made available under the terms
+ * of the GNU Lesser General Public License (LGPL) Version 2.1 that
+ * accompanies this distribution (lgpl-v21.txt). The LGPL is also
+ * available at http://www.gnu.org/licenses/lgpl.html. If the version
+ * of the LGPL at http://www.gnu.org is different to the version of
+ * the LGPL accompanying this distribution and there is any conflict
+ * between the two license versions, the terms of the LGPL accompanying
+ * this distribution shall govern.
+ *
+ * Contributors:
+ * Syntevo - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.swt.tests.gtk.snippets;
+
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.layout.FillLayout;
+import org.eclipse.swt.widgets.Display;
+import org.eclipse.swt.widgets.Label;
+import org.eclipse.swt.widgets.Shell;
+
+public class Bug547093_LogoffStuck {
+ public static void main (String [] args) {
+ Display display = new Display ();
+
+ Shell shell = new Shell (display);
+ shell.setLayout(new FillLayout());
+ shell.setSize(300, 200);
+
+ display.addListener(SWT.Dispose, event -> {
+ /*
+ * System.exit() prevents org.eclipse.swt.internal.SessionManagerDBus
+ * from sending reply to session manager and it gets stuck waiting for
+ * that reply.
+ */
+ System.exit(0);
+ });
+
+ final Label label = new Label(shell, SWT.WRAP | SWT.CENTER);
+ label.setText("\n\n\nWhen you logoff, GNOME session manager will get stuck for 90 seconds");
+
+ // Test for deadlock with shutdown hook on regular closing
+ shell.addListener(SWT.Close, event -> {
+ System.exit(0);
+ });
+
+ shell.open ();
+
+ while (!shell.isDisposed()) {
+ if (!display.readAndDispatch ()) display.sleep ();
+ }
+
+ display.dispose ();
+ }
+}

Back to the top