[Varnish] #850: jemalloc fails to init on Ubuntu 8.04

Varnish varnish-bugs at varnish-cache.org
Thu Jan 27 11:05:17 CET 2011


#850: jemalloc fails to init on Ubuntu 8.04
----------------------+-----------------------------------------------------
 Reporter:  miohtama  |        Type:  defect  
   Status:  new       |    Priority:  normal  
Milestone:            |   Component:  varnishd
  Version:  2.1.4     |    Severity:  minor   
 Keywords:            |  
----------------------+-----------------------------------------------------
 Hi,

 Long-term support release of Ubuntu 8.04 does no longer work with Varnish.
 I suspect this is change in libc or other system library.

 jemalloc fails to initialize and deadlocks itself.

 Related bug: https://bugs.launchpad.net/firefox/+bug/333624

 By looking the jemalloc source code shipped with Varnish there is a
 comment:

 {{{
         /*
          * sysconf(3) would be the preferred method for determining the
 number
          * of CPUs, but it uses malloc internally, which causes untennable
          * recursion during malloc initialization.
          */
         fd = open("/proc/cpuinfo", O_RDONLY);
         if (fd == -1)
                 return (1); /* Error. */
         /*
 }}}

 But apparently open() also cause a call to malloc which leads to the
 situation where jemalloc waits its own mutex:


 {{{
  strace /usr/sbin/varnishd
 execve("/usr/sbin/varnishd", ["/usr/sbin/varnishd"], [/* 21 vars */]) = 0
 brk(0)                                  = 0x675000
 mmap(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) =
 0x7fb3d030c000
 access("/etc/ld.so.nohwcap", F_OK)      = -1 ENOENT (No such file or
 directory)
 mmap(NULL, 8192, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) =
 0x7fb3d030a000
 access("/etc/ld.so.preload", R_OK)      = 0
 open("/etc/ld.so.preload", O_RDONLY)    = 3
 fstat(3, {st_mode=S_IFREG|0644, st_size=18, ...}) = 0
 mmap(NULL, 18, PROT_READ|PROT_WRITE, MAP_PRIVATE, 3, 0) = 0x7fb3d0309000
 close(3)                                = 0
 open("/lib/libaux.so.1", O_RDONLY)      = 3
 read(3, "\177ELF\2\1\1\0\0\0\0\0\0\0\0\0\3\0>\0\1\0\0\0\20\16\0"..., 832)
 = 832
 fstat(3, {st_mode=S_IFREG|0644, st_size=8248, ...}) = 0
 mmap(NULL, 2103304, PROT_READ|PROT_EXEC, MAP_PRIVATE|MAP_DENYWRITE, 3, 0)
 = 0x7fb3cfeee000
 mprotect(0x7fb3cfef0000, 2093056, PROT_NONE) = 0
 mmap(0x7fb3d00ef000, 4096, PROT_READ|PROT_WRITE,
 MAP_PRIVATE|MAP_FIXED|MAP_DENYWRITE, 3, 0x1000) = 0x7fb3d00ef000
 close(3)                                = 0
 munmap(0x7fb3d0309000, 18)              = 0
 open("/etc/ld.so.cache", O_RDONLY)      = 3
 fstat(3, {st_mode=S_IFREG|0644, st_size=16743, ...}) = 0
 mmap(NULL, 16743, PROT_READ, MAP_PRIVATE, 3, 0) = 0x7fb3d0305000
 close(3)                                = 0
 access("/etc/ld.so.nohwcap", F_OK)      = -1 ENOENT (No such file or
 directory)
 open("/usr/lib/libvarnish.so.1", O_RDONLY) = 3
 read(3, "\177ELF\2\1\1\0\0\0\0\0\0\0\0\0\3\0>\0\1\0\0\0\3402\0\0"..., 832)
 = 832
 fstat(3, {st_mode=S_IFREG|0644, st_size=69592, ...}) = 0
 mmap(NULL, 2164896, PROT_READ|PROT_EXEC, MAP_PRIVATE|MAP_DENYWRITE, 3, 0)
 = 0x7fb3cfcdd000
 mprotect(0x7fb3cfcee000, 2093056, PROT_NONE) = 0
 mmap(0x7fb3cfeed000, 4096, PROT_READ|PROT_WRITE,
 MAP_PRIVATE|MAP_FIXED|MAP_DENYWRITE, 3, 0x10000) = 0x7fb3cfeed000
 close(3)                                = 0
 access("/etc/ld.so.nohwcap", F_OK)      = -1 ENOENT (No such file or
 directory)
 open("/usr/lib/libvarnishcompat.so.1", O_RDONLY) = 3
 read(3, "\177ELF\2\1\1\0\0\0\0\0\0\0\0\0\3\0>\0\1\0\0\0@\7\0\0\0"..., 832)
 = 832
 fstat(3, {st_mode=S_IFREG|0644, st_size=5384, ...}) = 0
 mmap(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) =
 0x7fb3d0304000
 mmap(NULL, 2100752, PROT_READ|PROT_EXEC, MAP_PRIVATE|MAP_DENYWRITE, 3, 0)
 = 0x7fb3cfadc000
 mprotect(0x7fb3cfadd000, 2093056, PROT_NONE) = 0
 mmap(0x7fb3cfcdc000, 4096, PROT_READ|PROT_WRITE,
 MAP_PRIVATE|MAP_FIXED|MAP_DENYWRITE, 3, 0) = 0x7fb3cfcdc000
 close(3)                                = 0
 access("/etc/ld.so.nohwcap", F_OK)      = -1 ENOENT (No such file or
 directory)
 open("/usr/lib/libvcl.so.1", O_RDONLY)  = 3
 read(3, "\177ELF\2\1\1\0\0\0\0\0\0\0\0\0\3\0>\0\1\0\0\00002\0\0"..., 832)
 = 832
 fstat(3, {st_mode=S_IFREG|0644, st_size=98240, ...}) = 0
 mmap(NULL, 2193544, PROT_READ|PROT_EXEC, MAP_PRIVATE|MAP_DENYWRITE, 3, 0)
 = 0x7fb3cf8c4000
 mprotect(0x7fb3cf8da000, 2097152, PROT_NONE) = 0
 mmap(0x7fb3cfada000, 8192, PROT_READ|PROT_WRITE,
 MAP_PRIVATE|MAP_FIXED|MAP_DENYWRITE, 3, 0x16000) = 0x7fb3cfada000
 close(3)                                = 0
 access("/etc/ld.so.nohwcap", F_OK)      = -1 ENOENT (No such file or
 directory)
 open("/lib/libdl.so.2", O_RDONLY)       = 3
 read(3, "\177ELF\2\1\1\0\0\0\0\0\0\0\0\0\3\0>\0\1\0\0\0 \16\0\0"..., 832)
 = 832
 fstat(3, {st_mode=S_IFREG|0644, st_size=14624, ...}) = 0
 mmap(NULL, 2109728, PROT_READ|PROT_EXEC, MAP_PRIVATE|MAP_DENYWRITE, 3, 0)
 = 0x7fb3cf6c0000
 mprotect(0x7fb3cf6c2000, 2097152, PROT_NONE) = 0
 mmap(0x7fb3cf8c2000, 8192, PROT_READ|PROT_WRITE,
 MAP_PRIVATE|MAP_FIXED|MAP_DENYWRITE, 3, 0x2000) = 0x7fb3cf8c2000
 close(3)                                = 0
 access("/etc/ld.so.nohwcap", F_OK)      = -1 ENOENT (No such file or
 directory)
 open("/lib/libpthread.so.0", O_RDONLY)  = 3
 read(3, "\177ELF\2\1\1\0\0\0\0\0\0\0\0\0\3\0>\0\1\0\0\0\260W\0\0"..., 832)
 = 832
 fstat(3, {st_mode=S_IFREG|0755, st_size=130224, ...}) = 0
 mmap(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) =
 0x7fb3d0303000
 mmap(NULL, 2208624, PROT_READ|PROT_EXEC, MAP_PRIVATE|MAP_DENYWRITE, 3, 0)
 = 0x7fb3cf4a4000
 mprotect(0x7fb3cf4ba000, 2097152, PROT_NONE) = 0
 mmap(0x7fb3cf6ba000, 8192, PROT_READ|PROT_WRITE,
 MAP_PRIVATE|MAP_FIXED|MAP_DENYWRITE, 3, 0x16000) = 0x7fb3cf6ba000
 mmap(0x7fb3cf6bc000, 13168, PROT_READ|PROT_WRITE,
 MAP_PRIVATE|MAP_FIXED|MAP_ANONYMOUS, -1, 0) = 0x7fb3cf6bc000
 close(3)                                = 0
 access("/etc/ld.so.nohwcap", F_OK)      = -1 ENOENT (No such file or
 directory)
 open("/lib/libnsl.so.1", O_RDONLY)      = 3
 read(3, "\177ELF\2\1\1\0\0\0\0\0\0\0\0\0\3\0>\0\1\0\0\0\240@\0\0"..., 832)
 = 832
 fstat(3, {st_mode=S_IFREG|0644, st_size=93080, ...}) = 0
 mmap(NULL, 2198224, PROT_READ|PROT_EXEC, MAP_PRIVATE|MAP_DENYWRITE, 3, 0)
 = 0x7fb3cf28b000
 mprotect(0x7fb3cf2a1000, 2093056, PROT_NONE) = 0
 mmap(0x7fb3cf4a0000, 8192, PROT_READ|PROT_WRITE,
 MAP_PRIVATE|MAP_FIXED|MAP_DENYWRITE, 3, 0x15000) = 0x7fb3cf4a0000
 mmap(0x7fb3cf4a2000, 6864, PROT_READ|PROT_WRITE,
 MAP_PRIVATE|MAP_FIXED|MAP_ANONYMOUS, -1, 0) = 0x7fb3cf4a2000
 close(3)                                = 0
 access("/etc/ld.so.nohwcap", F_OK)      = -1 ENOENT (No such file or
 directory)
 open("/lib/libm.so.6", O_RDONLY)        = 3
 read(3, "\177ELF\2\1\1\0\0\0\0\0\0\0\0\0\3\0>\0\1\0\0\0\260>\0\0"..., 832)
 = 832
 fstat(3, {st_mode=S_IFREG|0644, st_size=526560, ...}) = 0
 mmap(NULL, 2621672, PROT_READ|PROT_EXEC, MAP_PRIVATE|MAP_DENYWRITE, 3, 0)
 = 0x7fb3cf00a000
 mprotect(0x7fb3cf08a000, 2093056, PROT_NONE) = 0
 mmap(0x7fb3cf289000, 8192, PROT_READ|PROT_WRITE,
 MAP_PRIVATE|MAP_FIXED|MAP_DENYWRITE, 3, 0x7f000) = 0x7fb3cf289000
 close(3)                                = 0
 access("/etc/ld.so.nohwcap", F_OK)      = -1 ENOENT (No such file or
 directory)
 open("/lib/libc.so.6", O_RDONLY)        = 3
 read(3, "\177ELF\2\1\1\0\0\0\0\0\0\0\0\0\3\0>\0\1\0\0\0\340\342"..., 832)
 = 832
 fstat(3, {st_mode=S_IFREG|0755, st_size=1436976, ...}) = 0
 mmap(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) =
 0x7fb3d0302000
 mmap(NULL, 3543672, PROT_READ|PROT_EXEC, MAP_PRIVATE|MAP_DENYWRITE, 3, 0)
 = 0x7fb3ceca8000
 mprotect(0x7fb3cee00000, 2097152, PROT_NONE) = 0
 mmap(0x7fb3cf000000, 20480, PROT_READ|PROT_WRITE,
 MAP_PRIVATE|MAP_FIXED|MAP_DENYWRITE, 3, 0x158000) = 0x7fb3cf000000
 mmap(0x7fb3cf005000, 17016, PROT_READ|PROT_WRITE,
 MAP_PRIVATE|MAP_FIXED|MAP_ANONYMOUS, -1, 0) = 0x7fb3cf005000
 close(3)                                = 0
 access("/etc/ld.so.nohwcap", F_OK)      = -1 ENOENT (No such file or
 directory)
 open("/lib/librt.so.1", O_RDONLY)       = 3
 read(3, "\177ELF\2\1\1\0\0\0\0\0\0\0\0\0\3\0>\0\1\0\0\0\240#\0\0"..., 832)
 = 832
 fstat(3, {st_mode=S_IFREG|0644, st_size=35784, ...}) = 0
 mmap(NULL, 2132968, PROT_READ|PROT_EXEC, MAP_PRIVATE|MAP_DENYWRITE, 3, 0)
 = 0x7fb3cea9f000
 mprotect(0x7fb3ceaa7000, 2093056, PROT_NONE) = 0
 mmap(0x7fb3ceca6000, 8192, PROT_READ|PROT_WRITE,
 MAP_PRIVATE|MAP_FIXED|MAP_DENYWRITE, 3, 0x7000) = 0x7fb3ceca6000
 close(3)                                = 0
 access("/etc/ld.so.nohwcap", F_OK)      = -1 ENOENT (No such file or
 directory)
 open("/usr/lib/libpcre.so.3", O_RDONLY) = 3
 read(3, "\177ELF\2\1\1\0\0\0\0\0\0\0\0\0\3\0>\0\1\0\0\0\240\23\0"..., 832)
 = 832
 fstat(3, {st_mode=S_IFREG|0644, st_size=154200, ...}) = 0
 mmap(NULL, 2249472, PROT_READ|PROT_EXEC, MAP_PRIVATE|MAP_DENYWRITE, 3, 0)
 = 0x7fb3ce879000
 mprotect(0x7fb3ce89e000, 2097152, PROT_NONE) = 0
 mmap(0x7fb3cea9e000, 4096, PROT_READ|PROT_WRITE,
 MAP_PRIVATE|MAP_FIXED|MAP_DENYWRITE, 3, 0x25000) = 0x7fb3cea9e000
 close(3)                                = 0
 mmap(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) =
 0x7fb3d0301000
 mmap(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) =
 0x7fb3d0300000
 arch_prctl(ARCH_SET_FS, 0x7fb3d03006e0) = 0
 mprotect(0x7fb3cf000000, 12288, PROT_READ) = 0
 munmap(0x7fb3d0305000, 16743)           = 0
 set_tid_address(0x7fb3d0300770)         = 8167
 set_robust_list(0x7fb3d0300780, 0x18)   = 0
 futex(0x7fffd830b9ec, 0x81 /* FUTEX_??? */, 1) = 0
 rt_sigaction(SIGRTMIN, {0x7fb3cf4a92d0, [], SA_RESTORER|SA_SIGINFO,
 0x7fb3cf4b27d0}, NULL, 8) = 0
 rt_sigaction(SIGRT_1, {0x7fb3cf4a9350, [],
 SA_RESTORER|SA_RESTART|SA_SIGINFO, 0x7fb3cf4b27d0}, NULL, 8) = 0
 rt_sigprocmask(SIG_UNBLOCK, [RTMIN RT_1], NULL, 8) = 0
 getrlimit(RLIMIT_STACK, {rlim_cur=8192*1024, rlim_max=RLIM_INFINITY}) = 0
 getrlimit(RLIMIT_NOFILE, {rlim_cur=1024, rlim_max=1024}) = 0
 close(1024)                             = -1 EBADF (Bad file descriptor)
 ...
 open("/proc/cpuinfo", O_RDONLY)         = 3
 futex(0x7fb3cf8c310c, 0x81 /* FUTEX_??? */, 2147483647) = 0
 futex(0x663640, 0x80 /* FUTEX_??? */, 2
 }}}

 I am not sure whether this is issue with libc, System libraries, jemalloc,
 Varnish or what, so I hope little guidance to narrow down this bug.

 I have tested Varnish source build and Varnish shipped from Ubuntu
 repositories and they both seem to enjoy this issue.

-- 
Ticket URL: <http://varnish-cache.org/trac/ticket/850>
Varnish <http://varnish-cache.org/>
The Varnish HTTP Accelerator




More information about the varnish-bugs mailing list