JDK-6996160 : MToolkit regression introduced in 6u23 client build 2010-09-20.6u23
  • Type: Bug
  • Component: client-libs
  • Sub-Component: java.awt
  • Affected Version: 6u23
  • Priority: P1
  • Status: Closed
  • Resolution: Fixed
  • OS: solaris
  • CPU: x86
  • Submitted: 2010-10-29
  • Updated: 2011-01-19
  • Resolved: 2010-11-05
The Version table provides details related to the release that this issue/RFE will be addressed.

Unresolved : Release in which this issue/RFE will be addressed.
Resolved: Release in which this issue/RFE has been resolved.
Fixed : Release in which this issue/RFE has been fixed. The release containing this fix may be available for download as an Early Access Release or a General Availability Release.

To download the current JDK release, click here.
JDK 6
6u23 b04Fixed
Related Reports
Relates :  
Description
This regression may be introduced in the fix of the following bug:
http://monaco.sfbay.sun.com/detail.jsf?cr=6944561
This regression happened on the following two machines:
Solaris 5.10 (SunOS awt-sqe7 5.10 Generic i86pc i386 i86pc)
Gnu Linux (Linux d2-comet 2.6.22-14-generic #1 SMP Tue Feb 12 07:42:25 UTC 2008 i686 GNU/Linux)

To verify it, please compile and run TestCursor.java in the attachments for CR 6944561.

Here are the details:
on the machine: SunOS awt-sqe7 5.10 Generic i86pc i386 i86pc

/net/jarchive.sfbay/export/jcg/NB.archived/6u23/client/2010-09-15.6u23/solaris-i586/bin/java -Dawt.toolkit=sun.awt.motif.MToolkit TestCursor
run fine.

but
/net/jarchive.sfbay/export/jcg/NB.archived/6u23/client/2010-09-20.6u23/solaris-i586/bin/java -Dawt.toolkit=sun.awt.motif.MToolkit TestCursor
gave the following error:
X Error of failed request:  BadWindow (invalid Window parameter)
  Major opcode of failed request:  20 (X_GetProperty)
  Resource id in failed request:  0x0
  Serial number of failed request:  188
  Current serial number in output stream:  188

and
/net/jarchive.sfbay/export/jcg/NB.archived/6u23/client/current.6u23/solaris-i586/bin/java -Dawt.toolkit=sun.awt.motif.MToolkit TestCursor
gave the same error:
X Error of failed request:  BadWindow (invalid Window parameter)
  Major opcode of failed request:  20 (X_GetProperty)
  Resource id in failed request:  0x0
  Serial number of failed request:  188
  Current serial number in output stream:  188

For XToolkit, it run fine.
/net/jarchive.sfbay/export/jcg/NB.archived/6u23/client/2010-09-20.6u23/solaris-i586/bin/java -Dawt.toolkit=sun.awt.X11.XToolkit TestCursor
run fine


on the machine:
Linux d2-comet 2.6.22-14-generic #1 SMP Tue Feb 12 07:42:25 UTC 2008 i686 GNU/Linux

/net/jano1.sfbay/export1/jcg/ws-depot/6u23/client/nb/archived/2010-09-15.6u23/linux-i586/bin/java -Dawt.toolkit=sun.awt.motif.MToolkit TestCursor
run fine

but
/net/jano1.sfbay/export1/jcg/ws-depot/6u23/client/nb/archived/2010-09-20.6u23/linux-i586/bin/java -Dawt.toolkit=sun.awt.motif.MToolkit TestCursor
gave the following error:
X Error of failed request:  BadWindow (invalid Window parameter)
  Major opcode of failed request:  20 (X_GetProperty)
  Resource id in failed request:  0x0
  Serial number of failed request:  218
  Current serial number in output stream:  218
and 
/net/jano1.sfbay/export1/jcg/ws-depot/6u23/client/nb/archived/current.6u23/linux-i586/bin/java -Dawt.toolkit=sun.awt.motif.MToolkit TestCursor
gave the following error:
X Error of failed request:  BadWindow (invalid Window parameter)
  Major opcode of failed request:  20 (X_GetProperty)
  Resource id in failed request:  0x0
  Serial number of failed request:  217
  Current serial number in output stream:  217

Comments
SUGGESTED FIX Partially (for MToolkit only) revert the fix for 6678385: diff -r a7695de5b83c src/solaris/native/sun/awt/awt_GraphicsEnv.c --- a/src/solaris/native/sun/awt/awt_GraphicsEnv.c Fri Oct 22 23:14:14 2010 -0700 +++ b/src/solaris/native/sun/awt/awt_GraphicsEnv.c Tue Nov 02 15:08:41 2010 +0300 @@ -158,6 +158,17 @@ #ifndef HEADLESS +#ifndef XAWT +/* + * XErrorHandler. Only used for MToolkit as XToolkit provides synthetic + * error handling, see ToolkitErrorHandler in XlibWrapper.c + */ +int xerror_handler(Display *disp, XErrorEvent *err) +{ + return 0; +} +#endif + /* * XIOErrorHandler */ @@ -797,6 +808,9 @@ return NULL; } +#ifndef XAWT + XSetErrorHandler(xerror_handler); +#endif XSetIOErrorHandler(xioerror_handler); /* set awt_numScreens, and whether or not we're using Xinerama */ diff -r a7695de5b83c src/solaris/native/sun/awt/awt_InputMethod.c --- a/src/solaris/native/sun/awt/awt_InputMethod.c Fri Oct 22 23:14:14 2010 -0700 +++ b/src/solaris/native/sun/awt/awt_InputMethod.c Tue Nov 02 15:08:41 2010 +0300 @@ -1450,6 +1450,17 @@ ximCallback.callback = (XIMProc)DestroyXIMCallback; ximCallback.client_data = NULL; XSetIMValues(X11im, XNDestroyCallback, &ximCallback, NULL); + +#ifndef XAWT + /* + * Workaround for Solaris 2.6 bug 4097754. We're affected by this problem + * because Motif also calls XOpenIM for us. Re-registering the error handler + * that MToolkit has registered already after calling XOpenIM avoids the + * problem. + */ + extern int xerror_handler(); + XSetErrorHandler(xerror_handler); +#endif } static void DestroyXIMCallback(XIM im, XPointer client_data, XPointer call_data) { diff -r a7695de5b83c src/solaris/native/sun/awt/awt_MToolkit.c --- a/src/solaris/native/sun/awt/awt_MToolkit.c Fri Oct 22 23:14:14 2010 -0700 +++ b/src/solaris/native/sun/awt/awt_MToolkit.c Tue Nov 02 15:08:41 2010 +0300 @@ -1894,6 +1894,25 @@ XtAppProcessEvent(awt_appContext, iMask & ~XtIMXEvent); } + /* + * Bug #4361799: Forte4J sometimes crashes on Solaris: + * There is an underlying bug in Selection.c in Xt lib. + * The routine HandleSelectionEvents, can call EndProtectedSection() + * more than StartProtectedSection(), and then EndProtectedSection + * will restore the default XError handler. As a result awt's + * XError handler gets removed and we later crash on an XError. + * + * This happens when we call XtAppProcessEvent with event type 1e + * (SelectionRequest) when running two copies of Forte + * + * XSetErrorHandler can safely be called repeatedly, so we are + * fixing this with the sledgehammer, and resetting our XError + * handler every time through the loop: + */ + { + extern int xerror_handler(); + XSetErrorHandler(xerror_handler); + } } /* processOneEvent() */ /*
02-11-2010

EVALUATION Regression of 6678385/6u23 integrated into 6u23-b03. *** (#1 of 1): [ UNSAVED ] ###@###.###
02-11-2010