bcb4e51a409d94ae670de96afb8483a4f7855294Stephan Bosch###############################################################################
83942ac160cdfb922c3a2f29ddfae2a13ebf8b5dTimo Sirainen# Copyright (c) 2008, 2013, Oracle and/or its affiliates. All rights reserved.
83942ac160cdfb922c3a2f29ddfae2a13ebf8b5dTimo Sirainen#
83942ac160cdfb922c3a2f29ddfae2a13ebf8b5dTimo Sirainen# Permission is hereby granted, free of charge, to any person obtaining a
83942ac160cdfb922c3a2f29ddfae2a13ebf8b5dTimo Sirainen# copy of this software and associated documentation files (the "Software"),
83942ac160cdfb922c3a2f29ddfae2a13ebf8b5dTimo Sirainen# to deal in the Software without restriction, including without limitation
83942ac160cdfb922c3a2f29ddfae2a13ebf8b5dTimo Sirainen# the rights to use, copy, modify, merge, publish, distribute, sublicense,
83942ac160cdfb922c3a2f29ddfae2a13ebf8b5dTimo Sirainen# and/or sell copies of the Software, and to permit persons to whom the
83942ac160cdfb922c3a2f29ddfae2a13ebf8b5dTimo Sirainen# Software is furnished to do so, subject to the following conditions:
83942ac160cdfb922c3a2f29ddfae2a13ebf8b5dTimo Sirainen#
83942ac160cdfb922c3a2f29ddfae2a13ebf8b5dTimo Sirainen# The above copyright notice and this permission notice (including the next
83942ac160cdfb922c3a2f29ddfae2a13ebf8b5dTimo Sirainen# paragraph) shall be included in all copies or substantial portions of the
83942ac160cdfb922c3a2f29ddfae2a13ebf8b5dTimo Sirainen# Software.
83942ac160cdfb922c3a2f29ddfae2a13ebf8b5dTimo Sirainen#
83942ac160cdfb922c3a2f29ddfae2a13ebf8b5dTimo Sirainen# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
83942ac160cdfb922c3a2f29ddfae2a13ebf8b5dTimo Sirainen# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
83942ac160cdfb922c3a2f29ddfae2a13ebf8b5dTimo Sirainen# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
83942ac160cdfb922c3a2f29ddfae2a13ebf8b5dTimo Sirainen# THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
83942ac160cdfb922c3a2f29ddfae2a13ebf8b5dTimo Sirainen# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
83942ac160cdfb922c3a2f29ddfae2a13ebf8b5dTimo Sirainen# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
83942ac160cdfb922c3a2f29ddfae2a13ebf8b5dTimo Sirainen# DEALINGS IN THE SOFTWARE.
83942ac160cdfb922c3a2f29ddfae2a13ebf8b5dTimo Sirainen#
83942ac160cdfb922c3a2f29ddfae2a13ebf8b5dTimo Sirainen
83942ac160cdfb922c3a2f29ddfae2a13ebf8b5dTimo Sirainen5039226 Whitebox animation causes Solaris desktop hang
83942ac160cdfb922c3a2f29ddfae2a13ebf8b5dTimo Sirainen
83942ac160cdfb922c3a2f29ddfae2a13ebf8b5dTimo SirainenThis problem is caused by a dead lock between java_vm and Xserver:
83942ac160cdfb922c3a2f29ddfae2a13ebf8b5dTimo SirainenXserver is grabbed by java_vm and waiting for XUngrabServer, java_vm
83942ac160cdfb922c3a2f29ddfae2a13ebf8b5dTimo Sirainenthought XUngrabServer was already sent and sends another dga lock
83942ac160cdfb922c3a2f29ddfae2a13ebf8b5dTimo Sirainenrequest to Xserver and blocked on that request. Here is what happened:
83942ac160cdfb922c3a2f29ddfae2a13ebf8b5dTimo Sirainenjava_vm threads calls XGrabServer and XUngrabServer and then
83942ac160cdfb922c3a2f29ddfae2a13ebf8b5dTimo SirainenSolaris_DGA_GetLock, it seems no problem, but the current
83942ac160cdfb922c3a2f29ddfae2a13ebf8b5dTimo SirainenXUngrabServer requires a XSync call after XUngrabServer in MT
83942ac160cdfb922c3a2f29ddfae2a13ebf8b5dTimo Sirainenenvironment to make sure Xserver is ungrabbed *before* new lock
83942ac160cdfb922c3a2f29ddfae2a13ebf8b5dTimo Sirainenrequests come in. Without this XSync, a dead lock may formed just like
83942ac160cdfb922c3a2f29ddfae2a13ebf8b5dTimo Sirainenthis case.
83942ac160cdfb922c3a2f29ddfae2a13ebf8b5dTimo Sirainen
83942ac160cdfb922c3a2f29ddfae2a13ebf8b5dTimo Sirainendiff --git a/src/UngrabSvr.c b/src/UngrabSvr.c
83942ac160cdfb922c3a2f29ddfae2a13ebf8b5dTimo Sirainenindex ea00848..cea7f99 100644
83942ac160cdfb922c3a2f29ddfae2a13ebf8b5dTimo Sirainen--- a/src/UngrabSvr.c
83942ac160cdfb922c3a2f29ddfae2a13ebf8b5dTimo Sirainen+++ b/src/UngrabSvr.c
83942ac160cdfb922c3a2f29ddfae2a13ebf8b5dTimo Sirainen@@ -39,6 +39,9 @@ XUngrabServer (
83942ac160cdfb922c3a2f29ddfae2a13ebf8b5dTimo Sirainen GetEmptyReq(UngrabServer, req);
83942ac160cdfb922c3a2f29ddfae2a13ebf8b5dTimo Sirainen UnlockDisplay(dpy);
83942ac160cdfb922c3a2f29ddfae2a13ebf8b5dTimo Sirainen SyncHandle();
83942ac160cdfb922c3a2f29ddfae2a13ebf8b5dTimo Sirainen+ /* fix for bug 5039226: desktop hangs */
83942ac160cdfb922c3a2f29ddfae2a13ebf8b5dTimo Sirainen+ if (!dpy->synchandler)
e2a88d59c0d47d63ce1ad5b1fd95e487124a3fd4Timo Sirainen+ XSync(dpy, 0);
e2a88d59c0d47d63ce1ad5b1fd95e487124a3fd4Timo Sirainen return 1;
83942ac160cdfb922c3a2f29ddfae2a13ebf8b5dTimo Sirainen }
83942ac160cdfb922c3a2f29ddfae2a13ebf8b5dTimo Sirainen
eef20a55e19a239244b14963d716cf0d070fe1bbTimo Sirainen