After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 135528 - [ximagesink] crashes on resize
[ximagesink] crashes on resize
Status: RESOLVED FIXED
Product: GStreamer
Classification: Platform
Component: gst-plugins
git master
Other Linux
: Normal normal
: 0.8.5
Assigned To: Julien MOUTTE
GStreamer Maintainers
Depends on:
Blocks:
 
 
Reported: 2004-02-26 19:40 UTC by Ronald Bultje
Modified: 2004-12-22 21:47 UTC
See Also:
GNOME target: ---
GNOME version: ---



Description Ronald Bultje 2004-02-26 19:40:14 UTC
gst-launch videotestsrc ! ffcolorspace ! ximagesink
RUNNING pipeline ...
[ .. runs fine .. - now resize the window ]
X Error of failed request:  BadAccess (attempt to access private resource
denied)
  Major opcode of failed request:  146 (MIT-SHM)
  Minor opcode of failed request:  3 (X_ShmPutImage)
  Serial number of failed request:  179
  Current serial number in output stream:  180
Comment 1 Ronald Bultje 2004-03-05 03:51:16 UTC
I've tracked this down to the following two:

XSync (ximagesink->xcontext->disp, FALSE);

Around line 290 in ximagesink.c, gst_ximagesink_ximage_put (). From
man XSync: "Client applications seldom need to call XSync." Why do we
use it? Is it hiding other bugs? Anyway, I commented it out, and then
got (seems to take quite a few more resizes to crash, but still)
crashes in:

XGetWindowAttributes (ximagesink->xcontext->disp,
                        ximagesink->xwindow->win, &attr);

around line 410 in ximagesink.c,
gst_ximagesink_xwindow_update_geometry (). I'm not sure why. The
XWindowID didn't change.

Anyway, all this reminds me that we need an error handler in
ximagesink and xvimagesink that calls GST_ELEMENT_ERROR() instead of
just crashing. See man XSetErrorHandler.
Comment 2 David Schleef 2004-03-05 03:56:47 UTC
XSetErrorHandler() isn't useful, since it's global to Xlib, not tied
to a particular file descriptor.  Thus, ximagesink setting an error
handler will interfere with gdk's.
Comment 3 Ronald Bultje 2004-03-05 04:26:06 UTC
Given the error messages I'm guessing that somehow, even though I set
synchronous to true, it doesn't run in synced-mode. It's simply the
XShmPutImage() before it.

And well, we'll have to figure out something else then, maybe call the
old handler from our new one or so (I'm quite sure gtk does that too,
will check some day)... But simply aborting isn't really a good thing
either.
Comment 4 David Schleef 2004-03-22 23:35:53 UTC
The only XSync call in ximagesink.c that seems appropriate is on line
112, just before XSetErrorHandler().

I'd like to hear from dolphy why the others might be necessary.  Also,
the sync flag is not handled correctly.
Comment 5 Julien MOUTTE 2004-04-07 20:59:33 UTC
Well i thought it was necessary to call XSync after each call supposed to
trigger some changes on the server...

I might check again the specifications for that...
Comment 6 Julien MOUTTE 2004-07-19 10:52:43 UTC
I ve been looking at the documentation and XSync calls are maybe not really
needed in that case. Although they are completely harmless and i don't think
that might cause any crash..

Should we close that bug ? Do you still see a non expected behaviour ?
Comment 7 Ronald Bultje 2004-07-19 13:28:38 UTC
Yes I still see it. Close bugs when they're fixed, not anytime else. Please let
me know if you can reproduce it.

The XSync() calls are indeed harmless, they were a first impression of where the
bug might come from. They do make behaviour non-ideal, though, because you do
manual optimizing which is ususally not the optimal way of doing stuff. I'd
still vote for removing them. Note, however, that this is irrelevant w.r.t. this
bug and should therefore be discussed elsewhere.

I *think* (but cannot test or proove) that the crashes come from async resizes
to the X server and then us trying to upload a larger image than the server has
currently configured internally to it. That breaks, X sends an error back and we
crash as a result. I don't know how to fix it, I don't want to touch ximagesink
right now. It's written nicely, but I have other priorities, unfortunately.
Comment 8 Thomas Vander Stichele 2004-07-21 08:21:19 UTC
XSync() is useful if you want to make sure your call has succeeded.  Given how
the X sinks work it is not very harmful in most cases since they aren't called
on every chain.

I'm currently going through the sinks adding error checking for all calls and
trying to trigger all instances of these errors people are ssing.
Comment 9 Julien MOUTTE 2004-07-26 09:53:01 UTC
Ronald do you still have the problem ? I have done some modifications in the
image allocation code. I can't reproduce the bug here...

thanks,
Comment 10 Ronald Bultje 2004-10-01 11:01:58 UTC
Yes, appears fixed now. Thanks.