Bug 23416 - XQueryTree returns BadWindow - needs documented in the XQueryTree man page
Summary: XQueryTree returns BadWindow - needs documented in the XQueryTree man page
Status: RESOLVED FIXED
Alias: None
Product: xorg
Classification: Unclassified
Component: Lib/Xlib (show other bugs)
Version: 7.4 (2008.09)
Hardware: x86-64 (AMD64) Linux (All)
: high major
Assignee: Xorg Project Team
QA Contact: Xorg Project Team
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2009-08-19 12:22 UTC by Bryce Harrington
Modified: 2009-09-02 19:09 UTC (History)
0 users

See Also:
i915 platform:
i915 features:


Attachments
StackTraceDebug.txt (13.91 KB, text/plain)
2009-08-19 12:22 UTC, Bryce Harrington
no flags Details

Description Bryce Harrington 2009-08-19 12:22:23 UTC
Created attachment 28790 [details]
StackTraceDebug.txt

Forwarding this bug reported for Firefox-3.5 in Ubuntu for Ubuntu reporter Matt Zimmerman:
https://bugs.edge.launchpad.net/ubuntu/+source/firefox-3.5/+bug/401055

[Problem]
The 'BadWindow' error is not documented as a possible return value for XQueryTree, yet it is being seen in Firefox-3.5 when the browser is launched.

[Original Report]
I have my default browser set to firefox-3.5, so when apport tries to launch a browser to display the Launchpad bug filing form, it opens firefox-3.5. The problem is that (about 80% of the time), it crashes with a BadWindow error, e.g.:

perseus:[~] ubuntu-bug firefox-3.5
perseus:[~]
Gdk-ERROR **: The program 'firefox-3.5' received an X Window System error.
This probably reflects a bug in the program.
The error was 'BadWindow (invalid Window parameter)'.
  (Details: serial 19 error_code 3 request_code 20 minor_code 0)
  (Note to programmers: normally, X errors are reported asynchronously;
   that is, you will receive the error a while after causing it.
   To debug your program, run it with the --sync command line
   option to change this behavior. You can then get a meaningful
   backtrace from your debugger if you break on the gdk_x_error() function.)
aborting...

If I keep trying, it eventually succeeds. I'm not able to reproduce the problem using "firefox-3.5 about:mozilla" so it may have something to do with the way that apport is invoking it.

In analyzing the problem, it appears to be that XQueryTree gives a BadWindow error, although it's unclear why it would do this (no mention of BadWindow in XQueryTree's man page, and grepping through the source code didn't reveal the code path that results in this being issued.)

The following patch was applied to firefox to bandaid over the issue:
http://bazaar.launchpad.net/~mozillateam/xulrunner/xulrunner-1.9.2.head/annotate/head%3A/debian/patches/lp401055_bz499498_debug_bandaid.patch

Asac noticed that he can trigger this more easily by using killall firefox-3.5 rather than shutting it down properly; from that it feels a bit like there is a window not properly removed from X.  Others have reported that running 'firefox-3.5 -no-remote' hides the issue.

ProblemType: Bug
Architecture: amd64
Date: Sat Jul 18 12:19:56 2009
DistroRelease: Ubuntu 9.10
Package: firefox-3.5 3.5.1+build1+nobinonly-0ubuntu1
ProcEnviron:
 LC_COLLATE=C
 PATH=(custom, user)
 LANG=en_US.UTF-8
 SHELL=/bin/zsh
ProcVersionSignature: Ubuntu 2.6.31-3.19-generic
SourcePackage: firefox-3.5
Uname: Linux 2.6.31-3-generic x86_64



Note that the attached stack trace is captured with --sync
Comment 1 Julien Cristau 2009-08-20 03:33:48 UTC
On Wed, Aug 19, 2009 at 12:22:24 -0700, bugzilla-daemon@freedesktop.org wrote:

> In analyzing the problem, it appears to be that XQueryTree gives a BadWindow
> error, although it's unclear why it would do this (no mention of BadWindow in
> XQueryTree's man page, and grepping through the source code didn't reveal the
> code path that results in this being issued.)
> 
BadWindow is the expected error if QueryTree is called on a nonexistent
window, afaict.
It's returned from dixLookupWindow(), called from ProcQueryTree() in the
server.
Comment 2 Bryce Harrington 2009-08-20 12:34:22 UTC
(In reply to comment #1)
> On Wed, Aug 19, 2009 at 12:22:24 -0700, bugzilla-daemon@freedesktop.org wrote:
> BadWindow is the expected error if QueryTree is called on a nonexistent
> window, afaict.

Okay, then this should be mentioned in the XQueryTree man page.  We can consider this bug report solved by an update to the man page.

> It's returned from dixLookupWindow(), called from ProcQueryTree() in the
> server.

Thanks

Bryce
Comment 3 Peter Hutterer 2009-09-02 19:09:39 UTC
Man page fix pushed as c2814a614dc4d9409bfa0f44c18bfd69ad7f7b85


Use of freedesktop.org services, including Bugzilla, is subject to our Code of Conduct. How we collect and use information is described in our Privacy Policy.