Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 249680 - x11-misc/xscreensaver-5.07 crashes with an X error on startup
Summary: x11-misc/xscreensaver-5.07 crashes with an X error on startup
Status: RESOLVED FIXED
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: Current packages (show other bugs)
Hardware: PPC Linux
: High normal
Assignee: Samuli Suominen (RETIRED)
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2008-12-03 06:24 UTC by Brian Tarricone
Modified: 2009-05-02 10:29 UTC (History)
3 users (show)

See Also:
Package list:
Runtime testing required: ---


Attachments
xscreensaver.log (xscreensaver.log,2.20 KB, text/plain)
2008-12-03 06:25 UTC, Brian Tarricone
Details
patch to only call XRRGetCrtcInfo() if an output's crtcs are valid (fix-randr1.2-usage.diff,2.29 KB, patch)
2008-12-04 07:00 UTC, Brian Tarricone
Details | Diff
fix-randr1.2-again.diff (fix-randr.diff,580 bytes, patch)
2009-05-01 06:14 UTC, Brian Tarricone
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Brian Tarricone 2008-12-03 06:24:31 UTC
Xscreensaver fails to start with an X error.  Running with -sync -debug gives me the following backtrace:

#0  0x0fad7078 in raise () from /lib/libc.so.6
#1  0x0fad8a74 in abort () from /lib/libc.so.6
#2  0x1000b2b8 in saver_exit (si=0xbff65978, status=<value optimized out>, 
    dump_core_reason=<value optimized out>) at windows.c:904
#3  0x100061cc in saver_ehandler (dpy=0x10052780, error=0xbff654f8)
    at xscreensaver.c:374
#4  0x0fd3aeb8 in _XError () from /usr/lib/libX11.so.6
#5  0x0fd3ce90 in _XReply () from /usr/lib/libX11.so.6
#6  0x0ff78d18 in XRRGetCrtcInfo () from /usr/lib/libXrandr.so.2
#7  0x1000c378 in update_screen_layout (si=0xbff65978) at screens.c:411
#8  0x100070d4 in main (argc=1, argv=0xbff65e04) at xscreensaver.c:822

Will attach log in a sec.
Comment 1 Brian Tarricone 2008-12-03 06:25:26 UTC
Created attachment 174134 [details]
xscreensaver.log
Comment 2 Brian Tarricone 2008-12-03 06:26:37 UTC
(I guess it appends to the log file; that's 2 runs of xscreensaver in the same file.)
Comment 3 Brian Tarricone 2008-12-03 07:01:48 UTC
Not sure if this is useful, but:

$ ./test-randr 
test-randr: 22:59:41: XRRQueryExtension(dpy, ...) ==> 97, 173
test-randr: 22:59:41: XRRQueryVersion(dpy, ...) ==> 1, 2

test-randr: 22:59:41: Screen 0
test-randr: 22:59:41:   Available Rotations:	 0 90 180 270
test-randr: 22:59:41:   Current Rotation:	 0
test-randr: 22:59:41:   Available Reflections:	 X Y
test-randr: 22:59:41:   Current Reflections:	 none
test-randr: 22:59:41:   + size 0: 1024 x 768	 rates: 60 85 75 70
test-randr: 22:59:41:     size 1: 832 x 624	 rates: 75
test-randr: 22:59:41:     size 2: 800 x 600	 rates: 85 72 75 60 56
test-randr: 22:59:41:     size 3: 640 x 480	 rates: 85 73 75 60
test-randr: 22:59:41:     size 4: 720 x 400	 rates: 85
test-randr: 22:59:41:     size 5: 640 x 400	 rates: 85
test-randr: 22:59:41:     size 6: 640 x 350	 rates: 85

test-randr: 22:59:41:   Output 0: LVDS-0: connected (58)
test-randr: 22:59:41:   + CRTC 0 (58): 1024x768+0+0

test-randr: 22:59:41:   Output 1: DVI-I-0: disconnected (0)


test-randr: awaiting events...


I'm on a ppc laptop (PowerBook G4) with an nvidia NV34M chipset, using nouveau git from a couple days ago.  RandR version is 1.2.
Comment 4 Jeroen Roovers (RETIRED) gentoo-dev 2008-12-03 15:53:08 UTC
Please post your `emerge --info' too.
Comment 5 Brian Tarricone 2008-12-03 19:25:57 UTC
Portage 2.1.6_rc2 (default-linux/ppc/ppc32/2007.0/G4, gcc-4.3.2, glibc-2.8_p20080602-r0, 2.6.27-gentoo-r4 ppc)
=================================================================
System uname: Linux-2.6.27-gentoo-r4-ppc-7447-7457,_altivec_supported-with-glibc2.0
Timestamp of tree: Sun, 30 Nov 2008 12:20:01 +0000
distcc 3.0 powerpc-unknown-linux-gnu [enabled]
ccache version 2.4 [enabled]
app-shells/bash:     3.2_p48
dev-java/java-config: 1.3.7, 2.1.6-r1
dev-lang/python:     2.4.4-r5, 2.5.2-r8
dev-python/pycrypto: 2.0.1-r6
dev-util/ccache:     2.4-r8
dev-util/cmake:      2.4.8
sys-apps/baselayout: 2.0.0
sys-apps/openrc:     0.3.0-r1
sys-apps/sandbox:    1.2.18.1-r3
sys-devel/autoconf:  2.13, 2.61-r2
sys-devel/automake:  1.4_p6, 1.5, 1.6.3, 1.7.9-r1, 1.8.5-r3, 1.9.6-r2, 1.10.2
sys-devel/binutils:  2.19
sys-devel/gcc-config: 1.4.0-r4
sys-devel/libtool:   2.2.6a
virtual/os-headers:  2.6.27-r2
ACCEPT_KEYWORDS="ppc ~ppc"
CBUILD="powerpc-unknown-linux-gnu"
CFLAGS="-O2 -ggdb -mcpu=G4 -mtune=G4 -maltivec -mabi=altivec -fno-strict-aliasing -pipe"
CHOST="powerpc-unknown-linux-gnu"
CONFIG_PROTECT="/etc"
CONFIG_PROTECT_MASK="/etc/ca-certificates.conf /etc/env.d /etc/env.d/java/ /etc/fonts/fonts.conf /etc/gconf /etc/gentoo-release /etc/php/apache2-php5/ext-active/ /etc/php/cgi-php5/ext-active/ /etc/php/cli-php5/ext-active/ /etc/revdep-rebuild /etc/terminfo /etc/texmf/web2c /etc/udev/rules.d"
CXXFLAGS="-O2 -ggdb -mcpu=G4 -mtune=G4 -maltivec -mabi=altivec -fno-strict-aliasing -pipe"
DISTDIR="/usr/portage/distfiles"
FEATURES="ccache distcc distlocks parallel-fetch protect-owned sandbox sfperms strict unmerge-orphans userfetch"
GENTOO_MIRRORS="http://gentoo.netnitco.net http://adelie.polymtl.ca/ http://cdot.senecac.on.ca/software/gentoo/ ftp://sunsite.informatik.rwth-aachen.de/pub/Linux/gentoo ftp://ftp.twaren.net/Linux/Gentoo/"
LANG="en_US.utf8"
LDFLAGS="-ggdb -O1 -Wl,-z,combreloc"
MAKEOPTS="-j2"
PKGDIR="/usr/portage/packages"
PORTAGE_RSYNC_OPTS="--recursive --links --safe-links --perms --times --compress --force --whole-file --delete --stats --timeout=180 --exclude=/distfiles --exclude=/local --exclude=/packages"
PORTAGE_TMPDIR="/var/tmp"
PORTDIR="/usr/portage"
PORTDIR_OVERLAY="/usr/local/portage/layman/mozilla /usr/local/portage /usr/local/nouveau-overlay /usr/local/initng-overlay"
SYNC="rsync://rsync.namerica.gentoo.org/gentoo-portage"
USE="X a52 aac acl aim alsa altivec amr ao apache2 apm audiofile avahi berkdb bindist bluetooth bogofilter bzip2 cairo cdda cddb cdio cdparanoia cdr cgi chardet cli consolekit cpudetection cracklib crypt cups curl dbus dri dts dv dvd dvdread encode exif expat fam fastcgi fat fbcon ffmpeg fftw filter firefox flac ftp gd gdbm gif glibc-compat20 gnutls gphoto2 gpm gtk gtkhtml hal hbci hfs iconv icq id3tag ieee1394 imagemagick imap ipod ipv6 isdnlog jabber javascript jpeg kerberos lame libffi libgcrypt libnotify libsamplerate libwww logrotate lzo mad maildir matroska mbox midi mime mmap mp2 mp3 mp4 mpeg mudflap mysql ncurses nls nntp nptl nptlonly nsplugin ntfs objc objc++ offensive ofx ogg opengl openmp oscar pam pcre pdf perl php png posix postproc ppc ppcsha1 pppd pulseaudio python quicktime quotes readline reflection rtc ruby samba sasl scintilla scrobbler sdl session sharedext shorten sndfile soap sockets sox spell spl sqlite sqlite3 srt ssh ssl startup-notification subversion svg swat syslog sysvipc t1lib tcpd theora tiff truetype unicode usb vcd vcdx vorbis wifi wma x264 xattr xcomposite xface xfs xft xine xinerama xml xmlreader xmlrpc xmlwriter xorg xosd xpm xrender xscreensaver xsl xulrunner xv xvid yahoo zip zlib" ALSA_CARDS="aoa aoa-fabric-layout aoa-onyx aoa-soundbus aoa-soundbus-i2s        aoa-tas aoa-toonie powermac usb-audio via82xx" ALSA_PCM_PLUGINS="adpcm alaw asym copy dmix dshare dsnoop empty extplug file hooks iec958 ioplug ladspa lfloat linear meter mmap_emul mulaw multi null plug rate route share shm softvol" APACHE2_MODULES="actions alias auth_basic auth_digest authn_anon                  authn_dbd authn_dbm authn_default authn_file                  authz_dbm authz_default authz_groupfile authz_host                  authz_owner authz_user autoindex cache dav dav_fs                  dav_lock dbd deflate dir disk_cache env expires                  ext_filter file_cache filter headers ident imagemap                  include info log_config logio mem_cache mime                  mime_magic negotiation proxy proxy_ajp                  proxy_balancer proxy_connect proxy_http rewrite                  setenvif so speling status unique_id userdir                  usertrack vhost_alias" ELIBC="glibc" INPUT_DEVICES="keyboard mouse synaptics" KERNEL="linux" LCD_DEVICES="bayrad cfontz cfontz633 glk hd44780 lb216 lcdm001 mtxorb ncurses text" USERLAND="GNU" VIDEO_CARDS="nouveau nv nvidia"
Unset:  CPPFLAGS, CTARGET, EMERGE_DEFAULT_OPTS, FFLAGS, INSTALL_MASK, LC_ALL, LINGUAS, PORTAGE_COMPRESS, PORTAGE_COMPRESS_FLAGS, PORTAGE_RSYNC_EXTRA_OPTS
Comment 6 Brian Tarricone 2008-12-04 06:57:17 UTC
Ok, looking at what gdb says about certain things during the crash.  Specifically this bit of code:

XRROutputInfo *rroi = XRRGetOutputInfo (dpy, res, 
                                        res->outputs[k]);
RRCrtc crtc = (rroi->crtc ? rroi->crtc : rroi->crtcs[0]);
XRRCrtcInfo *crtci = XRRGetCrtcInfo (dpy, res, crtc);

... which gets executed for each screen.  The X error occurs for me when k==1, which is my laptop's external monitor port (output named DVI-I-0).  This output isn't connected to anything.  The 'crtc' variable feels wrong to me: here it's 1146505517 (rroi->crtc is zero, so it sets it from rroi->crtcs[0]).  However, in the 'res' structure (an XRRScreenResources struct), the crtc/output XIDs are low numbers -- 56, 57, 58, and 59.

Perhaps the X driver doesn't connect CRTCs to outputs that aren't connected, and so this gets set to a weird undefined/random value?  Not sure if this is a driver bug, or if apps just aren't supposed to query crtc info for outputs that are disabled / not connected.  Indeed, rroi->ncrtc here is 0, so I'm not surprised the data in rroi->crtcs isn't valid.

If I run 'xrandr --verbose', I get this for the second output:

DVI-I-0 disconnected (normal)
	Identifier: 0x3c
	Timestamp:  259034
	Subpixel:   unknown
	Clones:    
	CRTCs:

So, clearly, there are no CRTCs assigned to the second output.  Let me see if I can whip up a patch...
Comment 7 Brian Tarricone 2008-12-04 07:00:07 UTC
Created attachment 174215 [details, diff]
patch to only call XRRGetCrtcInfo() if an output's crtcs are valid

Ok, that was easier than I thought.  This works for me, though I don't have an external monitor to test multi-head with.
Comment 8 Samuli Suominen (RETIRED) gentoo-dev 2008-12-05 09:31:35 UTC
Jamie, I believe Kelnos mailed you directly about this issue; xrandr 1.2 bug. Can you kindly review it, please?
Comment 9 Jamie Zawinski 2008-12-10 00:53:04 UTC
I don't have any idea what this means.  As far as I can tell,

              RRCrtc crtc = (rroi->crtc ? rroi->crtc : rroi->crtcs[0]);
              XRRCrtcInfo *crtci = XRRGetCrtcInfo (dpy, res, crtc);

ought to work.  Someone who is able to reproduce this is going to have to step through it in gdb and figure out why that X error is being thrown.

I guess it's the second "disconnected" (whatever that means) screen that is being troublesome.
Comment 10 Brian Tarricone 2008-12-10 01:30:14 UTC
(In reply to comment #9)
> I don't have any idea what this means.  As far as I can tell,
> 
>               RRCrtc crtc = (rroi->crtc ? rroi->crtc : rroi->crtcs[0]);
>               XRRCrtcInfo *crtci = XRRGetCrtcInfo (dpy, res, crtc);
> 
> ought to work.

No, it shouldn't.  That code assumes that the rroi->crtcs array has at least one element, which apparently isn't always the case.  The rroi struct has a field that tells you the number of elements in that array, but the current code ignores it.

> Someone who is able to reproduce this is going to have to step
> through it in gdb and figure out why that X error is being thrown.

That's exactly what I did.  The problem is that the output has *no* CRTC assigned to it.  rroi->crtc is zero, and rroi->ncrtc is also zero, which means that the rroi->crtcs array is either uninitialised, or pointing off into invalid memory (which perhaps doesn't crash by luck?).  The reason the X error is thrown is because you call XRRGetCrtcInfo() with an invalid ID in the 'crtc' variable (because rroi->crtcs[0] is junk).

> I guess it's the second "disconnected" (whatever that means) screen that is
> being troublesome.

Yep, exactly.  (Well, disconnected *output* is a better way of looking at it, not screen.  My laptop's DVI port didn't have anything plugged into it.)
Comment 11 Samuli Suominen (RETIRED) gentoo-dev 2009-01-19 14:41:58 UTC
Brian, Jamie, ChangeLog for 5.08 says "Arrgh, more RANDR noise! Fixes this time for rotated screens, and for systems where RANDR lies and says the screen size is 0x0." but I don't see exactly this patch applied. Does it cover this issue as well?
Comment 12 Brian Tarricone 2009-01-20 19:33:07 UTC
(In reply to comment #11)
> Brian, Jamie, ChangeLog for 5.08 says "Arrgh, more RANDR noise! Fixes this time
> for rotated screens, and for systems where RANDR lies and says the screen size
> is 0x0." but I don't see exactly this patch applied. Does it cover this issue
> as well?

I don't have time to look at this right now, but I'd guess not.  When googling about my problem, I found a patch for another randr problem which is what this changelog entry is probably referring to.
Comment 13 Brian Tarricone 2009-02-19 07:07:13 UTC
Blocked on bug #255549 on this for now...

Looking at the code in 5.08, though, I suspect this might be fixed.  It's a little different from my patch, but it looks like it should have the same effect.  Will verify when I can...
Comment 14 Samuli Suominen (RETIRED) gentoo-dev 2009-04-30 14:15:49 UTC
Brian, Jamie, what's the status for this? This patch needed for 5.08, or should it be modified for it?
Comment 15 Brian Tarricone 2009-05-01 00:58:07 UTC
5.08-r1 still crashes on startup here, same X error.  My patch doesn't apply to 5.08 due to some refactoring; needs to be reworked.
Comment 16 Brian Tarricone 2009-05-01 06:14:34 UTC
Created attachment 190015 [details, diff]
fix-randr1.2-again.diff

Easy fix, though...
Comment 17 Samuli Suominen (RETIRED) gentoo-dev 2009-05-02 10:29:25 UTC
(In reply to comment #16)
> Created an attachment (id=190015) [edit]
> fix-randr1.2-again.diff
> 
> Easy fix, though...
> 

Thanks Brian, =x11-misc/xscreensaver-5.08-r2 includes your patch, finally.

Jamie, it would be great if you could include this upstream if it's correct in your opinion.