Bug 2475

Summary: huge delay in XtConvertAndStore with utf8 locale
Product: xorg Reporter: Zsolt Barat <joy>
Component: Lib/XtAssignee: Xorg Project Team <xorg-team>
Status: RESOLVED WORKSFORME QA Contact: Xorg Project Team <xorg-team>
Severity: normal    
Priority: high CC: agriffis, jeremyhu, pva
Version: 6.8.0Keywords: i18n
Hardware: x86 (IA32)   
OS: Linux (All)   
Whiteboard: 2011BRB_Reviewed
i915 platform: i915 features:

Description Zsolt Barat 2005-02-05 13:46:15 UTC
while having a utf-8 locale switched on, loading of an x-app with bitmapfont
like xcalc or xfontsel takes a long time with high cpu-load. this seems to be
caused by the underlying XLC_LOCALE in en_US.UTF-8, with missing asian encodings.
strace xcalc says:
select(4, [3], NULL, NULL, NULL)        = 1 (in [3])
read(3, "\1\3174\0\0\0\0\0\0\0\0\0\4\0\0\0@\vL\t\1\0\0\0\220y\\"..., 32) = 32
writev(3, [{"1\0\t\0\1\0\31\0", 8}, {"*-*-*-*-*-JISX0208.1983-0", 25},
{"\0\0\0", 3}], 3) = 36
read(3, 0xbfffd400, 32)                 = -1 EAGAIN (Resource temporarily
unavailable)
as asian encodings aren't really needed with european locales it would be nice
if they could be ommited. didn`t tried it with instaled jisx encodings tough.

Gentoo Base System version 1.4.16
Portage 2.0.51-r15 (default-linux/x86/2004.3, gcc-3.4.3, glibc-2.3.4.20041102-r0
, 2.6.9-ac11 i686)
=================================================================
System uname: 2.6.9-ac11 i686 Intel(R) Pentium(R) III Mobile CPU       866MHz
Python:              dev-lang/python-2.3.4 [2.3.4 (#1, Jan 10 2005, 19:01:23)]
distcc 2.16 i686-pc-linux-gnu (protocols 1 and 2) (default port 3632) [enabled]
ccache version 2.3 [enabled]
dev-lang/python:     2.3.4
sys-devel/autoconf:  2.59-r6, 2.13
sys-devel/automake:  1.5, 1.8.5-r2, 1.6.3, 1.7.9, 1.4_p6, 1.9.4
sys-devel/binutils:  2.15.92.0.2-r1
sys-devel/libtool:   1.5.10-r4
virtual/os-headers:  2.6.8.1-r2
ACCEPT_KEYWORDS="x86"
AUTOCLEAN="yes"
CFLAGS="-O3 -march=pentium3 -pipe -fomit-frame-pointer -mfpmath=sse,387 -msse -m
mmx"
CHOST="i686-pc-linux-gnu"
CONFIG_PROTECT="/etc /usr/kde/2/share/config /usr/kde/3.3/env /usr/kde/3.3/share
/config /usr/kde/3.3/shutdown /usr/kde/3/share/config /usr/lib/X11/xkb /usr/shar
e/config /var/qmail/control"
CONFIG_PROTECT_MASK="/etc/gconf /etc/terminfo /etc/env.d"
CXXFLAGS="-O3 -march=pentium3 -pipe -fomit-frame-pointer -mfpmath=sse,387 -msse
-mmmx"
DISTDIR="/usr/portage/distfiles"
FEATURES="autoaddcvs autoconfig ccache distcc distlocks sandbox sfperms"
GENTOO_MIRRORS="ftp://ftp.uni-erlangen.de/pub/mirrors/gentoo ftp://ftp.wh2.tu-dr
esden.de/pub/mirrors/gentoo ftp://ftp.tu-clausthal.de/pub/linux/gentoo http://ge
ntoo.oregonstate.edu"
LANG="POSIX"
LC_ALL="POSIX"
MAKEOPTS="-j5"
PKGDIR="/usr/portage/packages"
PORTAGE_TMPDIR="/home"
PORTDIR="/usr/portage"
SYNC="rsync://rsync.europe.gentoo.org/gentoo-portage"
USE="X acpi apache2 apm avi bash-completion berkdb bitmap-fonts cdr crypt cups d
oc encode ethereal f77 fam ffmpeg font-server foomaticdb fortran gdbm gif gpm gt
k gtk2 imlib insecure-drivers ipv6 java jpeg junit libg++ libwww mad makecheck m
ikmod mmx motif mpeg mysql ncurses nls nptl oggvorbis opengl oss pam pdflib perl
 png python qt quicktime readline real sdl slang spell sse ssl svga tcltk tcpd t
iff truetype truetype-fonts type1-fonts unicode x86 xml2 xv zlib"
Unset:  ASFLAGS, CBUILD, CTARGET, LDFLAGS, PORTDIR_OVERLAY

* x11-base/xorg-x11-6.8.0-r4
   Install date: Sat Feb  5 07:37:42 2005
   USE=""
   CFLAGS="-O3 -march=pentium3 -pipe -fomit-frame-pointer -mno-sse2 -mno-sse3"

reproduce:
switch to locale de_DE.UTF-8
start xcalc
Comment 1 Aron Griffis 2005-05-03 08:01:54 UTC
I'm seeing this also, on alpha and amd64 (both 64-bit, but the original report
here is 32-bit)

I'm also on Gentoo, with xorg-x11-6.8.2-r1 installed on both machines.  One way
to repeat the problem is to try to pop up the font menu in xterm
(ctrl-right-button).  X starts grinding and takes about 1 minute to recover
before the menu will show.

The other methods mentioned above (xcalc or xfontsel) also reproduce the problem
for me.  The only message I get is
    Warning: Missing charsets in String to FontSet conversion

I have set in the environment:
    LANG=en_US.utf8

If I unset LANG prior to running xcalc, it comes up normally with no delay.
Comment 2 Aron Griffis 2005-05-12 13:44:12 UTC
Did some ltracing when running gvim.  The long delay is clearly happening in
XtConvertAndStore.  (Remember that this is gvim built with Athena widgets, not gtk)

$ ltrace -t gvim &> gvim-times.ltrace
....
15:20:52 XtScreen(0x120243420, 105, 0x12041e960, 0x1000002af, 2) = 0x12022e830
15:20:52 XRootWindowOfScreen(0x12022e830, 105, 0x12041e960, 0x1000002af, 2) = 56
15:20:52 XtDisplay(0x120243420, 105, 0x12041e960, 0x1000002af, 2) = 0x1202299e0
15:20:52 XGetIconSizes(0x1202299e0, 56, 0x11fffe390, 0x11fffe2a0, 2) = 0
15:20:52 XpmCreatePixmapFromData(0x1202299e0, 56, 0x120200a70, 0x12020a0d0,
0x12020a0d8) = 0
15:20:52 XtConvertAndStore(0x120243420, 0x20000974abb, 0x11fffe1a0,
0x20000974ba0, 0x11fffe1b0Warning: Missing charsets in String to FontSet conversion
) = 1

** note huge delay here (and Warning above) **

15:22:15 XLoadQueryFont(0x1202299e0, 0x11fffe250, 320, 0x1201a544b, 0x2000063) =
0x120486210
15:22:15 XSetFont(0x1202299e0, 0x120436c60, 0x1800008, 10, 2) = 1
15:22:15 XawInitializeWidgetSet(0x11fffc060, 8192, 0x200000a197a, 0x20000000299,
4) = 0
15:22:15 XtAddConverter(0x20000974abb, 0x20000974a84, 0x200008f22f0, 0, 0) =
0x120494d20
15:22:15 XmuCreateStippledPixmap(0x12022e830, 1, 0, 1, 9) = 0x1800009
15:22:15 XtAddCallback(0x1204ad830, 0x20000974528, 0x120176fd0, 0, 1) = 1
....

I also tested with only /usr/share/fonts/misc/ in my font path (using xset fp=).
 This reduces the delay considerably, but it was still there, and the warning
still appeared.  So the problem is not due to esoteric fonts in my font path.
Comment 3 Chris Bainbridge 2006-02-28 20:41:37 UTC
Possibly related to #4939?
Comment 4 Daniel Stone 2007-02-27 01:25:19 UTC
Sorry about the phenomenal bug spam, guys.  Adding xorg-team@ to the QA contact so bugs don't get lost in future.
Comment 5 Jeremy Huddleston Sequoia 2011-10-03 00:20:54 UTC
Moving to a more appropriate component.

Is this still an issue?
Comment 6 Peter 2011-10-03 07:44:34 UTC
Currently I'm unable to reporduce this issue with xfig.
Comment 7 Jeremy Huddleston Sequoia 2011-10-03 11:39:27 UTC
Thanks

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.