Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 293426 - gnome-base/gnome-settings-daemon: xrdb race condition
Summary: gnome-base/gnome-settings-daemon: xrdb race condition
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: [OLD] GNOME (show other bugs)
Hardware: All All
: High normal (vote)
Assignee: Gentoo Linux Gnome Desktop Team
Depends on:
Reported: 2009-11-16 21:26 UTC by Chris Coleman
Modified: 2010-05-28 19:07 UTC (History)
0 users

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


Note You need to log in before you can comment on or make changes to this bug.
Description Chris Coleman 2009-11-16 21:26:36 UTC
I recently found that fonts in OpenOffice were not being rendered consistently between sessions. Sometimes they respected my gnome-control-center settings and sometimes not.

Today I figured out why. I shall try to communicate to you, the reader, the problem.

OpenOffice uses libXft to render fonts. The `xsettings` plugin of gnome-settings-daemon exports font settings to libXft applications by calling `xrdb -merge`. The `font` plugin of gnome-settings-daemon also calls `xrdb -merge` to export X cursor settings. They both do this at initialization.

Here lies the problem. Sometimes, especially on multi-core systems, these two xrdb processes execute simultaneously.

This is basically what happens:

1. The first xrdb process asks the X server for the list of resources.
2. The second xrdb process asks the X server for the list of resources.
3. The two processes update their lists internally.
4. The first xrdb process sends its list back to the X server.
5. The second xrdb process sends its list back to the X server.
6. The second xrdb process wins.

Sometimes it works as it should:

$ xrdb -query
Xcursor.size:	18
Xcursor.theme:	Vanilla-DMZ
Xcursor.theme_core:	true
Xft.antialias:	1
Xft.dpi:	96
Xft.hinting:	1
Xft.hintstyle:	hintslight
Xft.rgba:	rgb

Sometimes it works as it shouldn't:

$ xrdb -query
Xcursor.size:	18
Xcursor.theme:	Vanilla-DMZ
Xcursor.theme_core:	true

Sometimes it works as it oughtn't:

$ xrdb -query
Xft.antialias:	1
Xft.dpi:	96
Xft.hinting:	1
Xft.hintstyle:	hintslight
Xft.lcdfilter:	lcddefault
Xft.rgba:	rgb

This bug should affect other applications that use libXft and not just OpenOffice.

This isn't Gentoo specific and should probably be filed upstream. I might do that. I did _kind_of_ reproduce this in Ubuntu in VirtualBox: I wrote a script that repeatedly executed two xrdb processes simultaneously; sometimes one `xrdb -merge` process won over the other. It wasn't so frequent, but I think that's because it was in VirtualBox with a single virtual processor.

Reproducible: Always

Steps to Reproduce:
See above.
Actual Results:  
See above.

Expected Results:  
See above.
Comment 1 Chris Coleman 2009-11-16 21:27:19 UTC
Portage (default/linux/amd64/10.0/desktop, gcc-4.4.2, glibc-2.11-r0, 2.6.31-gentoo-r6 x86_64)
System uname: Linux-2.6.31-gentoo-r6-x86_64-Intel-R-_Core-TM-2_Quad_CPU_Q6600_@_2.40GHz-with-gentoo-2.0.1
Timestamp of tree: Mon, 16 Nov 2009 09:15:01 +0000
ccache version 2.4 [enabled]
app-shells/bash:     4.0_p35
dev-java/java-config: 2.1.9-r1
dev-lang/python:     2.6.4, 3.1.1-r1
dev-util/ccache:     2.4-r8
dev-util/cmake:      2.6.4-r3
sys-apps/baselayout: 2.0.1
sys-apps/openrc:     0.5.2-r2
sys-apps/sandbox:    2.2
sys-devel/autoconf:  2.13, 2.63-r1
sys-devel/automake:  1.9.6-r2, 1.10.2, 1.11
sys-devel/binutils:  2.20
sys-devel/gcc-config: 1.4.1
sys-devel/libtool:   2.2.6a
virtual/os-headers:  2.6.30-r1
ACCEPT_KEYWORDS="amd64 ~amd64"
CFLAGS="-march=core2 -O2 -pipe"
CONFIG_PROTECT="/etc /usr/share/X11/xkb /var/lib/hsqldb"
CONFIG_PROTECT_MASK="/etc/ca-certificates.conf /etc/env.d /etc/env.d/java/ /etc/fonts/fonts.conf /etc/gconf /etc/gentoo-release /etc/revdep-rebuild /etc/sandbox.d /etc/terminfo /etc/udev/rules.d"
CXXFLAGS="-march=core2 -O2 -pipe"
FEATURES="assume-digests ccache distlocks fixpackages news parallel-fetch protect-owned sandbox sfperms strict unmerge-logs unmerge-orphans userfetch"
MAKEOPTS="-j4 -l4"
PORTAGE_RSYNC_OPTS="--recursive --links --safe-links --perms --times --compress --force --whole-file --delete --stats --timeout=180 --exclude=/distfiles --exclude=/local --exclude=/packages"
USE="X a52 aac acl acpi alsa amd64 berkdb branding bzip2 cairo cdr cli consolekit cracklib crypt cups dbus dri dts dvd dvdr eds emboss encode evo fam firefox flac fortran gdbm gif gnome gpm gstreamer gtk hal iconv java jpeg ldap libnotify mad mikmod mmx modules mp3 mp4 mpeg mudflap multilib ncurses nls nptl nptlonly ogg opengl openmp openssl pam pcre pdf perl png policykit ppds pppd pulseaudio python qt3support quicktime readline reflection sdl session spell spl sse sse2 ssl ssse3 startup-notification svg sysfs tcpd thunar tiff truetype unicode usb vorbis x264 xml xorg xulrunner xv xvid zlib" ALSA_CARDS="ali5451 als4000 atiixp atiixp-modem bt87x ca0106 cmipci emu10k1x ens1370 ens1371 es1938 es1968 fm801 hda-intel intel8x0 intel8x0m maestro3 trident usb-audio via82xx via82xx-modem ymfpci" 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 authn_alias authn_anon 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 deflate dir disk_cache env expires ext_filter file_cache filter headers include info log_config logio mem_cache mime mime_magic negotiation rewrite setenvif speling status unique_id userdir usertrack vhost_alias" ELIBC="glibc" INPUT_DEVICES="evdev" KERNEL="linux" LCD_DEVICES="bayrad cfontz cfontz633 glk hd44780 lb216 lcdm001 mtxorb ncurses text" LINGUAS="en_GB" USERLAND="GNU" VIDEO_CARDS="nvidia" 
Comment 2 Chris Coleman 2009-11-16 23:39:07 UTC
I think I should also mention that I have patched my libXft, gnome-settings-daemon, gnome-control-center (and also cairo, but that's not relevant to this bug) with LCD sub-pixel hinting patches from Ubuntu. That's what made the bug so obvious to me. Sometimes OpenOffice rendered its fonts nicely on my LCD monitor, sometimes it didn't.

On some systems the only indication that this bug exists might be the output of `xrdb -query`. Try logging out and in again and run `xrdb -query`. Then repeat. Is the output the same? It should be the same each time.
Comment 3 Chris Coleman 2010-05-24 19:06:44 UTC
This bug was inadvertently fixed upstream by the fix for another bug. Since gnome-settings-daemon no longer calls xrdb, there is no longer a potential race condition between two xrdb processes resulting in one of them being ineffective.

I'll close this bug now. Apparently nobody else experienced or noticed it. I'll just add the upstream patch into my private overlay until gnome 2.30 comes to portage.