I have a shell script that uses xdotool to drive a GUI web browser.
It's been developed (by me) over a fairly long period of time, and it is >pretty well debugged. It does what it is supposed to do.
However, every once in a while, it generates the following sort of message:
X Error of failed request: BadWindow (invalid Window parameter)
Major opcode of failed request: 3 (X_GetWindowAttributes)
Resource id in failed request: 0x3000001
Serial number of failed request: 371
Current serial number in output stream: 372
Possibly some sort of race condition error - something is requesting >information on a window that has just been destroyed, or a simple
coding error and the window parameter is unset and is any old value.
Its a bug and it could be either in a client program or in the X
server. Its unlikely to be in Xlib since thats just a simple interface
layer on top of the X protocol and the core lib hasn't changed in
literally decades so this bug would have been spotted and fixed a long
long time ago.
I have a shell script that uses xdotool to drive a GUI web browser.
It's been developed (by me) over a fairly long period of time, and it is pretty well debugged. It does what it is supposed to do.
However, every once in a while, it generates the following sort of message:
X Error of failed request: BadWindow (invalid Window parameter)
Major opcode of failed request: 3 (X_GetWindowAttributes)
Resource id in failed request: 0x3000001
Serial number of failed request: 371
Current serial number in output stream: 372
And here's the funny thing: the script is running with "set -e", so any
error (non-zero return) should cause the script to abort. However, when
the above message is displayed, there is no error abort. From this, I conclude that xdotool isn't returning a non-zero status, even though something has gone wrong.
In fact, what I think is going on is that Xlib (or some other low-level library) is generating this message directly. Note that I also see this message from time to time when running xev, so it is not unique to any particular X app. Thus, as I say, it seems to be coming directly from the library.
My main problem is that I can't tell which of the many invocations of
xdotool is causing this message to be displayed. Short of turning on
"set -x" mode in the script, which I do not want to do, I need a way to detect which line in my script is causing the message to be displayed.
One way, and not a particularly bad idea, would be to wrap every call to xdotool with Expect and watch for the string. I could probably do this,
but I'm posting here to see if anyone has any ideas for a better way.
Note, incidentally, that this error is not actually fatal. The script
still works - did what it was supposed to do - even though the message was displayed. I would just like to know where it is coming from.
In article <q029o0$evi$1@gioia.aioe.org>,
<blt_801s6@mydwnbxz32vpvm.co.uk> wrote:
....
Possibly some sort of race condition error - something is requesting >>information on a window that has just been destroyed, or a simple
coding error and the window parameter is unset and is any old value.
Its a bug and it could be either in a client program or in the X
server. Its unlikely to be in Xlib since thats just a simple interface >>layer on top of the X protocol and the core lib hasn't changed in
literally decades so this bug would have been spotted and fixed a long
long time ago.
I'm not sure what this response means - or what point you are driving at - >but I don't think it addresses any of the issues raised in the OP.
Others, please do carry on...
In article <q029o0$evi$1@gioia.aioe.org>,
<blt_801s6@mydwnbxz32vpvm.co.uk> wrote:
...
Possibly some sort of race condition error - something is requesting >>information on a window that has just been destroyed, or a simple
coding error and the window parameter is unset and is any old value.
Its a bug and it could be either in a client program or in the X
server. Its unlikely to be in Xlib since thats just a simple interface >>layer on top of the X protocol and the core lib hasn't changed in
literally decades so this bug would have been spotted and fixed a long
long time ago.
I'm not sure what this response means - or what point you are driving at - but I don't think it addresses any of the issues raised in the OP.
Others, please do carry on...
I have a shell script that uses xdotool to drive a GUI web browser.
It's been developed (by me) over a fairly long period of time, and it is >pretty well debugged. It does what it is supposed to do.
However, every once in a while, it generates the following sort of message:
X Error of failed request: BadWindow (invalid Window parameter)
Major opcode of failed request: 3 (X_GetWindowAttributes)
Resource id in failed request: 0x3000001
Serial number of failed request: 371
Current serial number in output stream: 372
In article <q023lo$2cv$1@news.xmission.com>,
Kenny McCormack <gazelle@shell.xmission.com> wrote:
I have a shell script that uses xdotool to drive a GUI web browser.
It's been developed (by me) over a fairly long period of time, and it is >>pretty well debugged. It does what it is supposed to do.
However, every once in a while, it generates the following sort of message: >>
X Error of failed request: BadWindow (invalid Window parameter)
Major opcode of failed request: 3 (X_GetWindowAttributes)
Resource id in failed request: 0x3000001
Serial number of failed request: 371
Current serial number in output stream: 372
This looks like the default message that X prints when you haven't set
an error handler.
Presumably xdotool does not override the default error handler (so you
get the message) and does not check every return value (so it does not
act on the error).
So the right thing is to fix xdotool. The simplest thing would be to
add an error handler (using XSetErrorHandler()) that just exits with
an error status. That should be trivial. Of course that will only be >satisfactory if it doesn't need to do any cleaning up in the event of
an error, and if you don't mind it exiting as a result of what may be
an unimportant error.
So the right thing is to fix xdotool. The simplest thing would be to
add an error handler (using XSetErrorHandler()) that just exits with
an error status. That should be trivial. Of course that will only be >>satisfactory if it doesn't need to do any cleaning up in the event of
an error, and if you don't mind it exiting as a result of what may be
an unimportant error.
Thanks for the info. Alas, I don't think fixing xdotool is within my pay >grade.
As I noted in the OP, the issue isn't so much "fixing" this, and, as you
say, it isn't at all clear whether or not it should be treated as fatal,
but rather, just one of detection. I'd like to know which line in the
script is producing the error.
| Sysop: | Amessyroom |
|---|---|
| Location: | Fayetteville, NC |
| Users: | 65 |
| Nodes: | 6 (0 / 6) |
| Uptime: | 62:43:12 |
| Calls: | 862 |
| Files: | 1,311 |
| D/L today: |
10 files (20,373K bytes) |
| Messages: | 264,046 |