Subject: Re: bug#16058: 24.3.50; X protocol error: BadAlloc...

From: Dmitry Antipov <[email-masked]>
Date: Thu, 05 Dec 2013 12:46:47 +0400

On 12/05/2013 11:10 AM, Thierry Volpiatto wrote:

> How did you get the backtrace ?
> bt return "No stack"

This is because the program has exited. X protocol error messages
are displayed by using glibc's printf and friends, so you could
just insert breakpoints to printf and fprintf.

> So you mean try to reproduce the bug with emacs compiled with:

This may be annoying. When I build with '--with-x-toolkit=lucid
--without-toolkit-scroll-bars --without-gconf --without-gsettings',
resulting binary depends on 92 libraries:

$ ldd src/emacs
	linux-vdso.so.1 =>  (0x00007fff239fe000)
	libtiff.so.5 => /lib64/libtiff.so.5 (0x000000387a200000)
	libjpeg.so.62 => /lib64/libjpeg.so.62 (0x0000003872600000)
	libpng15.so.15 => /lib64/libpng15.so.15 (0x0000003870200000)
	libz.so.1 => /lib64/libz.so.1 (0x000000386aa00000)
	libm.so.6 => /lib64/libm.so.6 (0x0000003869e00000)
	libgif.so.4 => /lib64/libgif.so.4 (0x000000387ae00000)
	libXpm.so.4 => /lib64/libXpm.so.4 (0x0000003871e00000)
	libXaw3d.so.8 => /lib64/libXaw3d.so.8 (0x00007ff20521d000)
	libXmu.so.6 => /lib64/libXmu.so.6 (0x0000003873e00000)
	libXt.so.6 => /lib64/libXt.so.6 (0x000000387ba00000)
	libSM.so.6 => /lib64/libSM.so.6 (0x0000003873200000)
	libICE.so.6 => /lib64/libICE.so.6 (0x0000003871600000)
	libXext.so.6 => /lib64/libXext.so.6 (0x000000386ee00000)
	libX11.so.6 => /lib64/libX11.so.6 (0x000000386d200000)
	libXrender.so.1 => /lib64/libXrender.so.1 (0x0000003873600000)
	libXft.so.2 => /lib64/libXft.so.2 (0x0000003870600000)
	libasound.so.2 => /lib64/libasound.so.2 (0x000000387d200000)
	librsvg-2.so.2 => /lib64/librsvg-2.so.2 (0x00007ff204fe4000)
	libgio-2.0.so.0 => /lib64/libgio-2.0.so.0 (0x0000003357a00000)
	libgdk_pixbuf-2.0.so.0 => /lib64/libgdk_pixbuf-2.0.so.0 (0x0000003359a00000)
	libcairo.so.2 => /lib64/libcairo.so.2 (0x00000031e2200000)
	libgobject-2.0.so.0 => /lib64/libgobject-2.0.so.0 (0x0000003357200000)
	libglib-2.0.so.0 => /lib64/libglib-2.0.so.0 (0x0000003356e00000)
	libMagickWand.so.5 => /lib64/libMagickWand.so.5 (0x000000387fa00000)
	libMagickCore.so.5 => /lib64/libMagickCore.so.5 (0x0000003880200000)
	libacl.so.1 => /lib64/libacl.so.1 (0x00007ff204dd9000)
	librt.so.1 => /lib64/librt.so.1 (0x000000386b200000)
	libdbus-1.so.3 => /lib64/libdbus-1.so.3 (0x0000003358200000)
	libXrandr.so.2 => /lib64/libXrandr.so.2 (0x0000003877e00000)
	libXinerama.so.1 => /lib64/libXinerama.so.1 (0x0000003877200000)
	libxml2.so.2 => /lib64/libxml2.so.2 (0x000000386f600000)
	libgpm.so.2 => /lib64/libgpm.so.2 (0x000000386be00000)
	libtinfo.so.5 => /lib64/libtinfo.so.5 (0x0000003872a00000)
	libselinux.so.1 => /lib64/libselinux.so.1 (0x000000386ba00000)
	libfreetype.so.6 => /lib64/libfreetype.so.6 (0x000000386ea00000)
	libfontconfig.so.1 => /lib64/libfontconfig.so.1 (0x000000386fa00000)
	libotf.so.0 => /lib64/libotf.so.0 (0x00007ff204bbf000)
	libm17n-flt.so.0 => /lib64/libm17n-flt.so.0 (0x000000386c200000)
	libm17n-core.so.0 => /lib64/libm17n-core.so.0 (0x00007ff204991000)
	libgnutls.so.28 => /lib64/libgnutls.so.28 (0x00007ff204685000)
	libpthread.so.0 => /lib64/libpthread.so.0 (0x000000386a600000)
	libgomp.so.1 => /lib64/libgomp.so.1 (0x0000003879e00000)
	libc.so.6 => /lib64/libc.so.6 (0x0000003869a00000)
	libjbig.so.2.0 => /lib64/libjbig.so.2.0 (0x000000387b600000)
	libuuid.so.1 => /lib64/libuuid.so.1 (0x000000386e200000)
	libxcb.so.1 => /lib64/libxcb.so.1 (0x000000386ca00000)
	libdl.so.2 => /lib64/libdl.so.2 (0x000000386a200000)
	/lib64/ld-linux-x86-64.so.2 (0x0000003869600000)
	libpangocairo-1.0.so.0 => /lib64/libpangocairo-1.0.so.0 (0x00000031e2600000)
	libpango-1.0.so.0 => /lib64/libpango-1.0.so.0 (0x0000003359600000)
	libcroco-0.6.so.3 => /lib64/libcroco-0.6.so.3 (0x00007ff204446000)
	libffi.so.6 => /lib64/libffi.so.6 (0x000000386d600000)
	libgmodule-2.0.so.0 => /lib64/libgmodule-2.0.so.0 (0x0000003357600000)
	libresolv.so.2 => /lib64/libresolv.so.2 (0x000000386c600000)
	libpixman-1.so.0 => /lib64/libpixman-1.so.0 (0x0000003872e00000)
	libEGL.so.1 => /lib64/libEGL.so.1 (0x00000031e1a00000)
	libxcb-shm.so.0 => /lib64/libxcb-shm.so.0 (0x000000387d600000)
	libxcb-render.so.0 => /lib64/libxcb-render.so.0 (0x0000003876e00000)
	libGL.so.1 => /lib64/libGL.so.1 (0x00000031e1200000)
	liblcms.so.1 => /lib64/liblcms.so.1 (0x000000387fe00000)
	liblzma.so.5 => /lib64/liblzma.so.5 (0x000000386de00000)
	libbz2.so.1 => /lib64/libbz2.so.1 (0x0000003875600000)
	libltdl.so.7 => /lib64/libltdl.so.7 (0x000000387be00000)
	libgcc_s.so.1 => /lib64/libgcc_s.so.1 (0x000000386ae00000)
	libattr.so.1 => /lib64/libattr.so.1 (0x000000386f200000)
	libpcre.so.1 => /lib64/libpcre.so.1 (0x000000386b600000)
	libexpat.so.1 => /lib64/libexpat.so.1 (0x000000386e600000)
	libp11-kit.so.0 => /lib64/libp11-kit.so.0 (0x0000003881800000)
	libtasn1.so.6 => /lib64/libtasn1.so.6 (0x0000003882a00000)
	libnettle.so.4 => /lib64/libnettle.so.4 (0x0000003882200000)
	libhogweed.so.2 => /lib64/libhogweed.so.2 (0x0000003883400000)
	libgmp.so.10 => /lib64/libgmp.so.10 (0x00007ff2041c8000)
	libXau.so.6 => /lib64/libXau.so.6 (0x000000386ce00000)
	libpangoft2-1.0.so.0 => /lib64/libpangoft2-1.0.so.0 (0x000000335a600000)
	libgthread-2.0.so.0 => /lib64/libgthread-2.0.so.0 (0x0000003357e00000)
	libharfbuzz.so.0 => /lib64/libharfbuzz.so.0 (0x0000003359200000)
	libX11-xcb.so.1 => /lib64/libX11-xcb.so.1 (0x0000003877600000)
	libxcb-dri2.so.0 => /lib64/libxcb-dri2.so.0 (0x0000003879200000)
	libxcb-xfixes.so.0 => /lib64/libxcb-xfixes.so.0 (0x000000387c600000)
	libxcb-shape.so.0 => /lib64/libxcb-shape.so.0 (0x0000003870a00000)
	libgbm.so.1 => /lib64/libgbm.so.1 (0x00000031e1e00000)
	libwayland-client.so.0 => /lib64/libwayland-client.so.0 (0x0000003871200000)
	libwayland-server.so.0 => /lib64/libwayland-server.so.0 (0x0000003870e00000)
	libglapi.so.0 => /lib64/libglapi.so.0 (0x00000031e1600000)
	libudev.so.1 => /lib64/libudev.so.1 (0x0000003872200000)
	libdrm.so.2 => /lib64/libdrm.so.2 (0x00000031d7200000)
	libXdamage.so.1 => /lib64/libXdamage.so.1 (0x000000387aa00000)
	libXfixes.so.3 => /lib64/libXfixes.so.3 (0x0000003875e00000)
	libxcb-glx.so.0 => /lib64/libxcb-glx.so.0 (0x0000003878a00000)
	libXxf86vm.so.1 => /lib64/libXxf86vm.so.1 (0x0000003878600000)
	libfreebl3.so => /lib64/libfreebl3.so (0x0000003875200000)
	libgraphite2.so.3 => /lib64/libgraphite2.so.3 (0x00007ff203fa4000)

And with '--without-all' it's just 26:

$ ldd src/emacs
	linux-vdso.so.1 =>  (0x00007fffc6dfe000)
	libXaw.so.7 => /lib64/libXaw.so.7 (0x000000386ae00000)
	libXmu.so.6 => /lib64/libXmu.so.6 (0x0000003873e00000)
	libXt.so.6 => /lib64/libXt.so.6 (0x000000387ba00000)
	libSM.so.6 => /lib64/libSM.so.6 (0x0000003873200000)
	libICE.so.6 => /lib64/libICE.so.6 (0x0000003871600000)
	libXext.so.6 => /lib64/libXext.so.6 (0x000000386ee00000)
	libX11.so.6 => /lib64/libX11.so.6 (0x000000386d200000)
	libacl.so.1 => /lib64/libacl.so.1 (0x0000003356e00000)
	librt.so.1 => /lib64/librt.so.1 (0x000000386b200000)
	libXrandr.so.2 => /lib64/libXrandr.so.2 (0x0000003877e00000)
	libXinerama.so.1 => /lib64/libXinerama.so.1 (0x0000003877200000)
	libtinfo.so.5 => /lib64/libtinfo.so.5 (0x0000003872a00000)
	libfontconfig.so.1 => /lib64/libfontconfig.so.1 (0x000000386fa00000)
	libpthread.so.0 => /lib64/libpthread.so.0 (0x000000386a600000)
	libm.so.6 => /lib64/libm.so.6 (0x0000003869e00000)
	libc.so.6 => /lib64/libc.so.6 (0x0000003869a00000)
	libXpm.so.4 => /lib64/libXpm.so.4 (0x0000003871e00000)
	libuuid.so.1 => /lib64/libuuid.so.1 (0x000000386e200000)
	libxcb.so.1 => /lib64/libxcb.so.1 (0x000000386ca00000)
	libdl.so.2 => /lib64/libdl.so.2 (0x000000386a200000)
	libattr.so.1 => /lib64/libattr.so.1 (0x000000386f200000)
	/lib64/ld-linux-x86-64.so.2 (0x0000003869600000)
	libXrender.so.1 => /lib64/libXrender.so.1 (0x0000003873600000)
	libfreetype.so.6 => /lib64/libfreetype.so.6 (0x000000386ea00000)
	libexpat.so.1 => /lib64/libexpat.so.1 (0x000000386e600000)
	libXau.so.6 => /lib64/libXau.so.6 (0x000000386ce00000)

So if we have a glitch with some external library, there are 66 libraries
under suspicion. An idea is to remove library dependencies one by one
using --without-XXX option until the problem disappears; if you have
a better approach, it's definitely appreciated.

Dmitry