The slocate cron job, /etc/cron.daily/slocate, fails with this message: /etc/cron.daily/slocate: line 11: 6318 Segmentation fault /usr/bin/updatedb Reproducible: Always Steps to Reproduce: 1. run /usr/bin/updatedb 2. 3. Actual Results: It crashes with a segfault Expected Results: Not crashed and it would have been really great if it had worked too ;) Portage 2.0.49-r7 (default-alpha-1.4, gcc-3.2.3, glibc-2.3.1-r4,2.3.2-r1, 2.4.21-alpha-r1) ================================================================= System uname: 2.4.21-alpha-r1 alpha EV67 ccache version 2.3 [enabled] ACCEPT_KEYWORDS="alpha ~alpha" AUTOCLEAN="yes" CFLAGS="-mcpu=ev67 -O3 -pipe " CHOST="alphaev67-unknown-linux-gnu" COMPILER="gcc3" CONFIG_PROTECT="/etc /var/qmail/control /usr/share/config /usr/kde/2/share/config /usr/kde/3/share/config /usr/X11R6/lib/X11/xkb" CONFIG_PROTECT_MASK="/etc/gconf /etc/env.d" CXXFLAGS="-mcpu=ev67 -O3 -pipe " DISTDIR="/usr/portage/distfiles" FEATURES="ccache" GENTOO_MIRRORS="http://gentoo.oregonstate.edu http://www.ibiblio.org/pub/Linux/distributions/gentoo" MAKEOPTS="-j1" PKGDIR="/usr/portage/packages" PORTAGE_TMPDIR="/var/tmp" PORTDIR="/usr/portage" PORTDIR_OVERLAY="/usr/local/my_gentoo" SYNC="rsync://rsync.gentoo.org/gentoo-portage" USE="alpha encode foomaticdb gif jpeg kde libg++ libwww mikmod ncurses oss pdflib png qt quicktime sdl spell truetype xml2 xmms xv gnome-libs gdbm berkdb slang readline tcltk ruby gpm tcpd pam ssl perl python esd imlib oggvorbis motif mozilla ev6 ipv6 X xinerama gtk gtk2 opengl java zlib gnome cups ldap crypt mozsvg mozspellcheck -alsa -nls"
what if you run `updatedb` yourself ? if it dies, does running it through `strace` show anything useful ?
Yes, it segfaults if I run it both as a normal user or root ... *** *** [pmoore@sockpuppet ~ ]whoami pmoore [pmoore@sockpuppet ~ ]/usr/bin/updatedb Segmentation fault [pmoore@sockpuppet ~ ]su - Password: sockpuppet root # whoami root sockpuppet root # /usr/bin/updatedb Segmentation fault *** As far as using strace, here is the output ... *** sockpuppet root # strace /usr/bin/updatedb execve("/usr/bin/updatedb", ["/usr/bin/updatedb"], [/* 37 vars */]) = 0 uname({sys="Linux", node="sockpuppet", ...}) = 0 brk(0) = 0x120019d70 fcntl(0, F_GETFD) = 0 fcntl(1, F_GETFD) = 0 fcntl(2, F_GETFD) = 0 access("/etc/suid-debug", F_OK) = -1 ENOENT (No such file or directory) open("/etc/ld.so.preload", O_RDONLY) = 3 fstat(3, {st_mode=S_IFREG|0644, st_size=0, ...}) = 0 close(3) = 0 open("/etc/ld.so.cache", O_RDONLY) = 3 fstat(3, {st_mode=S_IFREG|0644, st_size=44185, ...}) = 0 mmap(NULL, 44185, PROT_READ, MAP_PRIVATE, 3, 0) = 0x20000018000 close(3) = 0 open("/lib/libc.so.6.1", O_RDONLY) = 3 read(3, "\177ELF\2\1\1\0\0\0\0\0\0\0\0\0\3\0&\220\1\0\0\0\20\212"..., 1024) = 10 24 fstat(3, {st_mode=S_IFREG|0755, st_size=1828364, ...}) = 0 mmap(NULL, 1621968, PROT_READ|PROT_EXEC, MAP_PRIVATE, 3, 0) = 0x2000002a000 mprotect(0x2000019c000, 106448, PROT_NONE) = 0 mmap(0x200001aa000, 40960, PROT_READ|PROT_WRITE|PROT_EXEC, MAP_PRIVATE|MAP_FIXED , 3, 0x170000) = 0x200001aa000 mmap(0x200001b4000, 8144, PROT_READ|PROT_WRITE|PROT_EXEC, MAP_PRIVATE|MAP_FIXED| MAP_ANONYMOUS, -1, 0) = 0x200001b4000 close(3) = 0 munmap(0x20000018000, 44185) = 0 open("/etc/updatedb.conf", O_RDONLY) = 3 brk(0) = 0x120019d70 brk(0x12001bd70) = 0x12001bd70 brk(0) = 0x12001bd70 brk(0x12001c000) = 0x12001c000 read(3, "# Copyright 1999-2003 Gentoo Tec"..., 4096) = 588 close(3) = 0 open("/etc/mtab", O_RDONLY) = 3 read(3, "/dev/scsi/host0/bus0/target0/lun"..., 4096) = 4096 brk(0) = 0x12001c000 brk(0x12001e000) = 0x12001e000 read(3, "ps/wildcat nfs ro,nosuid,intr,ad"..., 4096) = 4096 read(3, "ipher/build/asdu3.dsk8 nfs ro,ad"..., 4096) = 4096 read(3, "set15 /mnt/zk3_direct_maps/share"..., 4096) = 2758 --- SIGSEGV (Segmentation fault) @ 0 (0) --- +++ killed by SIGSEGV +++ ***
Has anyone been able to reproduce this, or am I on my own for this one?
Paul, you're on your own. Just kidding. I'm looking into it. Though from the strace output, it appears to be dying while scanning NFS mounts, which I think it should be ignoring. You might try building it like this: FEATURES="-distcc -strip" CFLAGS="-O0 -ggdb" emerge slocate then run it under gdb to find out where it's breaking. Mine seems to be running fine so far.
Hmm, I have been playing with this some more and here is the call stack when it segfaults: *** (gdb) run Starting program: /usr/bin/updatedb Program received signal SIGSEGV, Segmentation fault. 0x00000200000bbec0 in _int_malloc () from /lib/libc.so.6.1 (gdb) bt #0 0x00000200000bbec0 in _int_malloc () from /lib/libc.so.6.1 #1 0x00000200000ba7c0 in malloc () from /lib/libc.so.6.1 #2 0x000002000011aea8 in fts_alloc () from /lib/libc.so.6.1 #3 0x000002000011a590 in fts_build () from /lib/libc.so.6.1 #4 0x000002000011a044 in fts_read () from /lib/libc.so.6.1 #5 0x000000012000398c in create_db () #6 0x0000000120005834 in main () *** I have also noticed that running the following command: 'slocate -u -v' does not segfault while 'slocate -u -c -v' does. It is important to note that 'updatedb' is equivalent to 'slocate -u -c'. A quick look at the code doesn't make anything obvious but I will keep looking into this. Here is my /etc/updatedb.conf: *** # Copyright 1999-2003 Gentoo Technologies, Inc. # Distributed under the terms of the GNU General Public License v2 # $Header: /home/cvsroot/gentoo-x86/sys-apps/slocate/files/updatedb.conf,v 1.5 2003/10/31 21:17:53 iggy Exp $ # This file sets environment variables which are used by updatedb # filesystems which are pruned from updatedb database PRUNEFS="NFS nfs afs proc smbfs autofs auto iso9660 devfs tmpfs ncpfs sysfs" export PRUNEFS # paths which are pruned from updatedb database PRUNEPATHS="/tmp /var/tmp" export PRUNEPATHS # netpaths which are added NETPATHS="" export NETPATHS ***
Thanks for looking into this, Paul. updatedb works fine on my system... $ epm -q slocate glibc slocate-2.7-r2 glibc-2.3.2-r8
Paul, this seems to be breaking while working on automounted directories. Recently some new stuff has been added to the PRUNEDIRS for slocate. Would you mind remerging slocate, update the /etc files, and trying this again? It continues to work well for me.. ;-)
Still broken with the latest stuff. I will try to debug it and get you guys a patch. I've just been swamped lately. My apologies.
Paul, any progress on this? I would fix it myself but I don't know what the problem is...
No, sorry. I have been pretty busy with work lately. If having this open is screwing up some metrics go ahead and close it - I'll either reopen it if is something serious or just send you a patch. Thanks for your patience.
No problem, Paul. There's no metrics to worry about. I just like to check back occasionally.
Paul, I guess I should close this unless you have a patch available...?
Yeah, I'm just going to go and mark it as INVALID. Sorry guys.