JDK-6853592 : VM test nsk.regression.b4261880 fails with "X Error of failed request: BadWindow" inconsistently.
  • Type: Bug
  • Component: client-libs
  • Sub-Component: java.awt
  • Affected Version: 7
  • Priority: P4
  • Status: Resolved
  • Resolution: Fixed
  • OS: generic
  • CPU: x86
  • Submitted: 2009-06-22
  • Updated: 2011-01-19
  • Resolved: 2009-10-14
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 7 Other
7 b74Fixed OpenJDK6Fixed
Related Reports
Relates :  
Description
The attached test fails with message:
-->/net/vmsqe.russia/export/jdk/re/7/promoted/ea/b60/binaries//solaris-i586/bin/java nsk.regression.b4261880.b4261880
X Error of failed request:  BadWindow (invalid Window parameter)
  Major opcode of failed request:  20 (X_GetProperty)
  Resource id in failed request:  0x4000011
  Serial number of failed request:  2485
  Current serial number in output stream:  2485

java -version:
/net/vmsqe.russia/export/jdk/re/7/promoted/ea/b60/binaries//solaris-i586/bin/java -version
java version "1.7.0-ea"
Java(TM) SE Runtime Environment (build 1.7.0-ea-b60)
Java HotSpot(TM) Server VM (build 16.0-b03, mixed mode)

There severeal attempts could be needed to reproduce it.
Test
	nsk/regression/b4261880
(This was  added to allow vmsqe-scripts to find out this test.)

Comments
EVALUATION AWT have a VM shutdown hook on X11. The hook uninstalls our custom error handler and install the default error handler. The behaviour of the default error handler - upon an error it prints a message and exits. The expected AWT behaviour would be smoothly handle the error and print a message only if "noisyerrorhandler" property is specified. This might be surprising why any Xlib routines executed after the VM hook. But this is actually expected behaviour as JVM shuts down in response to when the last non-daemon thread exits. The AWT toolkit thread is daemon thread and the thread will be terminated at some indeterminate time. The suggested fix for the problem is to exclude the XSetErrorHandler call from the VM hook. I haven't found any violation of the XSetErrorHandler spec for the change. Another option would be forcibly terminate the toolkit thread forcibly but it doesn't look like a safe change.
30-09-2009

SUGGESTED FIX http://sa.sfbay.sun.com/projects/awt_data/7/6853592/
30-09-2009

EVALUATION This problem is only reproducible after the fix for 6678385.
28-09-2009

EVALUATION The BadWindow error comes from the following code ------------------------------------------------------------------------------ XDnDDropTargetProtocol class - isProtocolSupported method: int status = wpg1.execute(XErrorHandler.IgnoreBadWindowHandler.getInstance()); ------------------------------------------------------------------------------ The error is expected and shouldn't be printed to console unless someone specifies -Dsun.awt.noisyerrorhandler=true AWT uninstalls own error handler (re-installs the default error handler) in a VM shutdown hook but the toolkit thread is a daemon thread and it's still alive after the VM shutdown hook have been proceesed. Thus, any X11 error coming during shutdown will fall into the default error handler and may cause terminating the application.
08-09-2009