From tfheen at projects.linpro.no Tue Nov 3 09:32:45 2009 From: tfheen at projects.linpro.no (tfheen at projects.linpro.no) Date: Tue, 3 Nov 2009 10:32:45 +0100 (CET) Subject: r4340 - branches/2.0/varnish-cache/lib/libvarnishcompat Message-ID: <20091103093245.B13551F732B@projects.linpro.no> Author: tfheen Date: 2009-11-03 10:32:45 +0100 (Tue, 03 Nov 2009) New Revision: 4340 Modified: branches/2.0/varnish-cache/lib/libvarnishcompat/execinfo.c Log: Merge missing part of r4058, adjust include path for execinfo.h Modified: branches/2.0/varnish-cache/lib/libvarnishcompat/execinfo.c =================================================================== --- branches/2.0/varnish-cache/lib/libvarnishcompat/execinfo.c 2009-10-23 09:18:41 UTC (rev 4339) +++ branches/2.0/varnish-cache/lib/libvarnishcompat/execinfo.c 2009-11-03 09:32:45 UTC (rev 4340) @@ -38,7 +38,7 @@ #include #include -#include "execinfo.h" +#include "compat/execinfo.h" void *getreturnaddr(int); void *getframeaddr(int); From tfheen at projects.linpro.no Wed Nov 4 09:38:08 2009 From: tfheen at projects.linpro.no (tfheen at projects.linpro.no) Date: Wed, 4 Nov 2009 10:38:08 +0100 (CET) Subject: r4341 - branches/2.0/varnish-cache/bin/varnishd Message-ID: <20091104093808.7A73D1F73F8@projects.linpro.no> Author: tfheen Date: 2009-11-04 10:38:08 +0100 (Wed, 04 Nov 2009) New Revision: 4341 Modified: branches/2.0/varnish-cache/bin/varnishd/cache_acceptor_epoll.c Log: Add missing bit of r4183 This bit got missing when we merged the new epoll acceptor for 2.0. Disable SO_LINGER when we time out a connection due to sess_timeout, so that we do not RST connections that have still not transmitted their data. Modified: branches/2.0/varnish-cache/bin/varnishd/cache_acceptor_epoll.c =================================================================== --- branches/2.0/varnish-cache/bin/varnishd/cache_acceptor_epoll.c 2009-11-03 09:32:45 UTC (rev 4340) +++ branches/2.0/varnish-cache/bin/varnishd/cache_acceptor_epoll.c 2009-11-04 09:38:08 UTC (rev 4341) @@ -192,6 +192,7 @@ if (sp->t_open > deadline) break; VTAILQ_REMOVE(&sesshead, sp, list); + TCP_linger(sp->fd, 0); vca_close_session(sp, "timeout"); SES_Delete(sp); } From tfheen at projects.linpro.no Fri Nov 6 09:27:25 2009 From: tfheen at projects.linpro.no (tfheen at projects.linpro.no) Date: Fri, 6 Nov 2009 10:27:25 +0100 (CET) Subject: r4342 - branches/2.0/varnish-cache/doc Message-ID: <20091106092725.07BC81F7425@projects.linpro.no> Author: tfheen Date: 2009-11-06 10:27:24 +0100 (Fri, 06 Nov 2009) New Revision: 4342 Added: branches/2.0/varnish-cache/doc/changes-2.0.4-2.0.5.xml branches/2.0/varnish-cache/doc/changes-2.0.5.xml Modified: branches/2.0/varnish-cache/doc/Makefile.am Log: Document changes to 2.0.5 Modified: branches/2.0/varnish-cache/doc/Makefile.am =================================================================== --- branches/2.0/varnish-cache/doc/Makefile.am 2009-11-04 09:38:08 UTC (rev 4341) +++ branches/2.0/varnish-cache/doc/Makefile.am 2009-11-06 09:27:24 UTC (rev 4342) @@ -1,6 +1,7 @@ # $Id$ CHANGELOGS = \ + changes-2.0.5.html \ changes-2.0.4.html \ changes-2.0.3.html \ changes-2.0.2.html \ @@ -12,6 +13,7 @@ changes-1.0.4.html XML = \ + changes-2.0.4-2.0.5.xml \ changes-2.0.3-2.0.4.xml \ changes-2.0.2-2.0.3.xml \ changes-2.0.1-2.0.2.xml \ Added: branches/2.0/varnish-cache/doc/changes-2.0.4-2.0.5.xml =================================================================== --- branches/2.0/varnish-cache/doc/changes-2.0.4-2.0.5.xml (rev 0) +++ branches/2.0/varnish-cache/doc/changes-2.0.4-2.0.5.xml 2009-11-06 09:27:24 UTC (rev 4342) @@ -0,0 +1,161 @@ + + +]> + + + + varnishd + + + Handle object workspace overruns better. + + + + Allow turning off ESI processing per request by using + set req.esi = off. + + + + Tell the kernel that we expect to use the mmap-ed file in + a random fashion. On Linux, this turns off/down readahead and + increases performance. + + + + Make it possible to change the maximum number of HTTP + headers we allow by + passing --with-max-header-fields=NUM rather than + changing the code. + + + + Implement support for HTTP continuation lines. + + + + Change how connections are closed and only use SO_LINGER + for orderly connection closure. This should hopefully make + worker threads less prone to hangups on network problems. + + + + Handle multi-element purges correctly. Previously we + ended up with parse errors when this was done from VCL. + + + + Handle illegal responses from the backend better by + serving a 503 page rather than panic-ing. + + + + When we run into an assertion that is not true, Varnish + would previously dump a little bit of information about itself. + Extend that information with a backtrace. Note that this relies + on the varnish binary being unstripped. + + + + Add a session_max parameter that limits the maximum + number of sessions we keep open before we start dropping new + connections summarily. + + + + Try to consume less memory when doing ESI processing by + properly rolling back used workspace after processing an + object. This should make it possible to + turn sess_workspace quite a bit for users with + ESI-heavy pages. + + + + Turn on session_linger by default. Tests + have shown that session_linger helps a fair bit + with performance. + + + + Rewrite the epoll acceptor for better performance. This + should lead to both higher processing rates and maximum number + of connections on Linux. + + + + Add If-None-Match support, this gives significant + bandwidth savings for users with compliant browsers. + + + + RFC2616 specifies + that ETag, Content-Location, Expires, Cache-Control + and Vary should be emitted when delivering a + response with the 304 response code. + + + + Various fixes which makes Varnish compile and work on AIX. + + + + Turn on TCP_DEFER_ACCEPT on Linux. This should make us + less suspecible to denial of service attacks as well as give us + slightly better performance. + + + + Add an .initial property to the backend + probe specification. This is the number of good probes we + pretend to have seen. The default is one less than .threshold, + which means the first probe will decide if we consider the + backend healthy. + + + + Make it possible to compare strings against other + string-like objects, not just plain strings. This allows you to + compare two headers, for instance. + + + + When support for restart + in vcl_error was added, there was no check to + prevent infinte recursion. This has now been fixed. + + + + + Turn on purge_dups by default. This should make us + consume less memory when there are many bans for the same + pattern added. + + + + Add a new log tag called FetchError which + tries to explain why we could not fetch an object from the + backend. + + + + Change the default srcaddr_ttl to 0. It is + not used by anything and has been removed in the development + version. This will increase performance somewhat. + + + + + + varnishtop + + varnishtop did not handle variable-length log fields + correctly. This is now fixed. + + + + varnishtop previously did not print the name of the tag, + which made it very hard to understand. We now print out the + tag name. + + + Added: branches/2.0/varnish-cache/doc/changes-2.0.5.xml =================================================================== --- branches/2.0/varnish-cache/doc/changes-2.0.5.xml (rev 0) +++ branches/2.0/varnish-cache/doc/changes-2.0.5.xml 2009-11-06 09:27:24 UTC (rev 4342) @@ -0,0 +1,12 @@ + + + +]> + + + Varnish + 2.0.5 + + + From tfheen at projects.linpro.no Fri Nov 6 10:00:47 2009 From: tfheen at projects.linpro.no (tfheen at projects.linpro.no) Date: Fri, 6 Nov 2009 11:00:47 +0100 (CET) Subject: r4343 - branches/2.0/varnish-cache/bin/varnishd Message-ID: <20091106100047.196F81F732B@projects.linpro.no> Author: tfheen Date: 2009-11-06 11:00:46 +0100 (Fri, 06 Nov 2009) New Revision: 4343 Modified: branches/2.0/varnish-cache/bin/varnishd/varnishd.c Log: Merge r4338: Send stderr to /dev/null when running nm Previously, running varnishd -V would sometimes say: nm: 'varnishd': No such file which is wrong. Silence this message Modified: branches/2.0/varnish-cache/bin/varnishd/varnishd.c =================================================================== --- branches/2.0/varnish-cache/bin/varnishd/varnishd.c 2009-11-06 09:27:24 UTC (rev 4342) +++ branches/2.0/varnish-cache/bin/varnishd/varnishd.c 2009-11-06 10:00:46 UTC (rev 4343) @@ -463,7 +463,7 @@ struct symbols *s; p = NULL; - asprintf(&p, "nm -an %s", a0); + asprintf(&p, "nm -an %s 2>/dev/null", a0); if (p == NULL) return; fi = popen(p, "r"); From tfheen at projects.linpro.no Mon Nov 9 10:16:05 2009 From: tfheen at projects.linpro.no (tfheen at projects.linpro.no) Date: Mon, 9 Nov 2009 11:16:05 +0100 (CET) Subject: r4344 - branches/2.0/varnish-cache Message-ID: <20091109101605.BA20137F31@projects.linpro.no> Author: tfheen Date: 2009-11-09 11:16:05 +0100 (Mon, 09 Nov 2009) New Revision: 4344 Modified: branches/2.0/varnish-cache/configure.ac Log: Bump version number to 2.0.5 Modified: branches/2.0/varnish-cache/configure.ac =================================================================== --- branches/2.0/varnish-cache/configure.ac 2009-11-06 10:00:46 UTC (rev 4343) +++ branches/2.0/varnish-cache/configure.ac 2009-11-09 10:16:05 UTC (rev 4344) @@ -3,7 +3,7 @@ AC_PREREQ(2.59) AC_COPYRIGHT([Copyright (c) 2006-2008 Linpro AS / Verdens Gang AS]) AC_REVISION([$Id$]) -AC_INIT([Varnish], [2.0.4], [varnish-dev at projects.linpro.no]) +AC_INIT([Varnish], [2.0.5], [varnish-dev at projects.linpro.no]) AC_CONFIG_SRCDIR(include/varnishapi.h) AM_CONFIG_HEADER(config.h) From tfheen at projects.linpro.no Mon Nov 9 10:18:01 2009 From: tfheen at projects.linpro.no (tfheen at projects.linpro.no) Date: Mon, 9 Nov 2009 11:18:01 +0100 (CET) Subject: r4345 - tags Message-ID: <20091109101801.8C26C37F31@projects.linpro.no> Author: tfheen Date: 2009-11-09 11:18:01 +0100 (Mon, 09 Nov 2009) New Revision: 4345 Added: tags/varnish-2.0.5/ Log: Release 2.0.5 Copied: tags/varnish-2.0.5 (from rev 4344, branches/2.0) From ingvar at projects.linpro.no Mon Nov 9 14:09:59 2009 From: ingvar at projects.linpro.no (ingvar at projects.linpro.no) Date: Mon, 9 Nov 2009 15:09:59 +0100 (CET) Subject: r4346 - trunk/varnish-cache/redhat Message-ID: <20091109140959.8E95137F31@projects.linpro.no> Author: ingvar Date: 2009-11-09 15:09:59 +0100 (Mon, 09 Nov 2009) New Revision: 4346 Modified: trunk/varnish-cache/redhat/varnish.spec Log: Some changelog items from Fedora Modified: trunk/varnish-cache/redhat/varnish.spec =================================================================== --- trunk/varnish-cache/redhat/varnish.spec 2009-11-09 10:18:01 UTC (rev 4345) +++ trunk/varnish-cache/redhat/varnish.spec 2009-11-09 14:09:59 UTC (rev 4346) @@ -1,12 +1,14 @@ Summary: High-performance HTTP accelerator Name: varnish -Version: 2.0.2 +Version: 2.0.5 Release: 1%{?dist} License: BSD Group: System Environment/Daemons URL: http://www.varnish-cache.org/ Source0: http://downloads.sourceforge.net/varnish/varnish-%{version}.tar.gz #Patch0: varnish.varnishtest_debugflag.patch +#Patch1: varnish.s390x_pagesize.patch +#Patch2: varnish.sparc_pagesize.patch BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n) # The svn sources needs autoconf, automake and libtool to generate a suitable # configure script. Release tarballs would not need this @@ -64,12 +66,14 @@ %setup -q #%setup -q -n varnish-cache -#%patch0 -p0 - # The svn sources needs to generate a suitable configure script # Release tarballs would not need this #./autogen.sh +#%patch0 -p0 +#%patch1 -p0 +#%patch2 -p0 + # Hack to get 32- and 64-bits tests run concurrently on the same build machine case `uname -m` in ppc64 | s390x | x86_64 | sparc64 ) @@ -91,7 +95,7 @@ %build # Remove "--disable static" if you want to build static libraries -# jemalloc is not compatible with Red Hat's ppc64 RHEL5 kernel koji server :-( +# jemalloc is not compatible with Red Hat's ppc* RHEL5 kernel koji server :-( %ifarch ppc64 ppc %configure --disable-static --localstatedir=/var/lib --disable-jemalloc %else @@ -235,6 +239,24 @@ %postun libs -p /sbin/ldconfig %changelog +* Mon Nov 09 2009 Ingvar Hagelund - 2.0.5-1 +- New upstream release + +* Thu Aug 13 2009 Ingvar Hagelund - 2.0.4-4 +- Added a sparc specific patch to libjemalloc. + +* Sun Jul 26 2009 Fedora Release Engineering - 2.0.4-3 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_12_Mass_Rebuild + +* Thu May 04 2009 Ingvar Hagelund - 2.0.4-2 +- Added a s390 specific patch to libjemalloc. + +* Fri Mar 27 2009 Ingvar Hagelund - 2.0.4-1 + New upstream release 2.0.4 + +* Wed Feb 25 2009 Fedora Release Engineering - 2.0.3-2 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_11_Mass_Rebuild + * Wed Feb 11 2009 Ingvar Hagelund - 2.0.3-1 New upstream release 2.0.3. A bugfix and feature enhancement release From ingvar at projects.linpro.no Mon Nov 9 15:17:49 2009 From: ingvar at projects.linpro.no (ingvar at projects.linpro.no) Date: Mon, 9 Nov 2009 16:17:49 +0100 (CET) Subject: r4347 - branches/2.0/varnish-cache/redhat Message-ID: <20091109151749.7E60337F31@projects.linpro.no> Author: ingvar Date: 2009-11-09 16:17:49 +0100 (Mon, 09 Nov 2009) New Revision: 4347 Modified: branches/2.0/varnish-cache/redhat/varnish.spec Log: merged r4346 from trunk Modified: branches/2.0/varnish-cache/redhat/varnish.spec =================================================================== --- branches/2.0/varnish-cache/redhat/varnish.spec 2009-11-09 14:09:59 UTC (rev 4346) +++ branches/2.0/varnish-cache/redhat/varnish.spec 2009-11-09 15:17:49 UTC (rev 4347) @@ -1,12 +1,14 @@ Summary: High-performance HTTP accelerator Name: varnish -Version: 2.0.4 +Version: 2.0.5 Release: 1%{?dist} License: BSD Group: System Environment/Daemons URL: http://www.varnish-cache.org/ Source0: http://downloads.sourceforge.net/varnish/varnish-%{version}.tar.gz #Patch0: varnish.varnishtest_debugflag.patch +#Patch1: varnish.s390x_pagesize.patch +#Patch2: varnish.sparc_pagesize.patch BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n) # The svn sources needs autoconf, automake and libtool to generate a suitable # configure script. Release tarballs would not need this @@ -64,12 +66,13 @@ %setup -q #%setup -q -n varnish-cache - # The svn sources needs to generate a suitable configure script # Release tarballs would not need this #./autogen.sh #%patch0 -p0 +#%patch1 -p0 +#%patch2 -p0 # Hack to get 32- and 64-bits tests run concurrently on the same build machine case `uname -m` in @@ -92,7 +95,7 @@ %build # Remove "--disable static" if you want to build static libraries -# jemalloc is not compatible with Red Hat's ppc64 RHEL5 kernel koji server :-( +# jemalloc is not compatible with Red Hat's ppc* RHEL5 kernel koji server :-( %ifarch ppc64 ppc %configure --disable-static --localstatedir=/var/lib --disable-jemalloc %else @@ -236,6 +239,18 @@ %postun libs -p /sbin/ldconfig %changelog +* Mon Nov 09 2009 Ingvar Hagelund - 2.0.5-1 +- New upstream release + +* Thu Aug 13 2009 Ingvar Hagelund - 2.0.4-4 +- Added a sparc specific patch to libjemalloc. + +* Sun Jul 26 2009 Fedora Release Engineering - 2.0.4-3 +- Rebuilt for https://fedoraproject.org/wiki/Fedora_12_Mass_Rebuild + +* Thu May 04 2009 Ingvar Hagelund - 2.0.4-2 +- Added a s390 specific patch to libjemalloc. + * Fri Mar 27 2009 Ingvar Hagelund - 2.0.4-1 New upstream release 2.0.4 From phk at projects.linpro.no Tue Nov 10 19:49:33 2009 From: phk at projects.linpro.no (phk at projects.linpro.no) Date: Tue, 10 Nov 2009 20:49:33 +0100 (CET) Subject: r4348 - trunk/varnish-cache/bin/varnishtest Message-ID: <20091110194933.267661F73E5@projects.linpro.no> Author: phk Date: 2009-11-10 20:49:32 +0100 (Tue, 10 Nov 2009) New Revision: 4348 Modified: trunk/varnish-cache/bin/varnishtest/vtc_client.c Log: Add a -repeat N facility to clients. Modified: trunk/varnish-cache/bin/varnishtest/vtc_client.c =================================================================== --- trunk/varnish-cache/bin/varnishtest/vtc_client.c 2009-11-09 15:17:49 UTC (rev 4347) +++ trunk/varnish-cache/bin/varnishtest/vtc_client.c 2009-11-10 19:49:32 UTC (rev 4348) @@ -58,6 +58,8 @@ char *connect; + unsigned repeat; + pthread_t tp; }; @@ -75,26 +77,30 @@ struct vtclog *vl; int fd; int i; + unsigned u; CAST_OBJ_NOTNULL(c, priv, CLIENT_MAGIC); AN(c->connect); vl = vtc_logopen(c->name); - vtc_log(vl, 2, "Started"); - vtc_log(vl, 3, "Connect to %s", c->connect); - fd = VSS_open(c->connect); - for (i = 0; fd < 0 && i < 3; i++) { - (void)sleep(1); + if (c->repeat == 0) + c->repeat = 1; + vtc_log(vl, 2, "Started (%u iterations)", c->repeat); + for (u = 0; u < c->repeat; u++) { + vtc_log(vl, 3, "Connect to %s", c->connect); fd = VSS_open(c->connect); + for (i = 0; fd < 0 && i < 3; i++) { + (void)sleep(1); + fd = VSS_open(c->connect); + } + assert(fd >= 0); + vtc_log(vl, 3, "Connected to %s fd is %d", c->connect, fd); + http_process(vl, c->spec, fd, 1); + vtc_log(vl, 3, "Closing fd %d", fd); + TCP_close(&fd); } - assert(fd >= 0); - vtc_log(vl, 3, "Connected to %s fd is %d", c->connect, fd); - http_process(vl, c->spec, fd, 1); - vtc_log(vl, 3, "Closing fd %d", fd); - TCP_close(&fd); vtc_log(vl, 2, "Ending"); - return (NULL); } @@ -223,6 +229,11 @@ av++; continue; } + if (!strcmp(*av, "-repeat")) { + c->repeat = atoi(av[1]); + av++; + continue; + } if (!strcmp(*av, "-start")) { client_start(c); continue; From phk at projects.linpro.no Mon Nov 16 09:35:10 2009 From: phk at projects.linpro.no (phk at projects.linpro.no) Date: Mon, 16 Nov 2009 10:35:10 +0100 (CET) Subject: r4349 - in trunk/varnish-cache: bin/varnishd bin/varnishtest include/compat lib/libvarnishcompat Message-ID: <20091116093510.4BEBA38D05@projects.linpro.no> Author: phk Date: 2009-11-16 10:35:09 +0100 (Mon, 16 Nov 2009) New Revision: 4349 Modified: trunk/varnish-cache/bin/varnishd/cache_panic.c trunk/varnish-cache/bin/varnishtest/flint.lnt trunk/varnish-cache/bin/varnishtest/flint.sh trunk/varnish-cache/bin/varnishtest/vtc.c trunk/varnish-cache/bin/varnishtest/vtc_http.c trunk/varnish-cache/bin/varnishtest/vtc_log.c trunk/varnish-cache/bin/varnishtest/vtc_varnish.c trunk/varnish-cache/include/compat/execinfo.h trunk/varnish-cache/lib/libvarnishcompat/execinfo.c Log: Hide GCC specific backtrace() compat function under a #ifdef. We do not want to be dependent on GCC. Fixes #577 Modified: trunk/varnish-cache/bin/varnishd/cache_panic.c =================================================================== --- trunk/varnish-cache/bin/varnishd/cache_panic.c 2009-11-10 19:49:32 UTC (rev 4348) +++ trunk/varnish-cache/bin/varnishd/cache_panic.c 2009-11-16 09:35:09 UTC (rev 4349) @@ -271,6 +271,8 @@ size_t i; size = backtrace (array, 10); + if (size == 0) + return; vsb_printf(vsp, "Backtrace:\n"); for (i = 0; i < size; i++) { vsb_printf (vsp, " "); Modified: trunk/varnish-cache/bin/varnishtest/flint.lnt =================================================================== --- trunk/varnish-cache/bin/varnishtest/flint.lnt 2009-11-10 19:49:32 UTC (rev 4348) +++ trunk/varnish-cache/bin/varnishtest/flint.lnt 2009-11-16 09:35:09 UTC (rev 4349) @@ -11,7 +11,18 @@ -esym(850, av) +-esym(528, svnid) +-ffc // No automatic custody + +-e712 // 14 Info 712 Loss of precision (___) (___ to ___) +-e747 // 16 Info 747 Significant prototype coercion (___) ___ to ___ + + + + + + // -header(../../config.h) // Fix strchr() semtics, it can only return NULL if arg2 != 0 Modified: trunk/varnish-cache/bin/varnishtest/flint.sh =================================================================== --- trunk/varnish-cache/bin/varnishtest/flint.sh 2009-11-10 19:49:32 UTC (rev 4348) +++ trunk/varnish-cache/bin/varnishtest/flint.sh 2009-11-16 09:35:09 UTC (rev 4349) @@ -1,30 +1,9 @@ #!/bin/sh -T=/tmp/_$$ flexelint \ -I/usr/include \ -I. \ -I../../include \ -I../.. \ flint.lnt \ - *.c > $T 2>&1 - -for t in Error Warning Info Note -do - sed -n "/$t [0-9][0-9][0-9]:/s/.*\($t [0-9][0-9][0-9]\).*/\1/p" $T -done | awk ' -$2 == 830 { next } -$2 == 831 { next } - { - i=$2"_"$1 - h[i]++ - n++ - } -END { - printf "%5d %s\n", n, "Total" - for (i in h) - printf "%5d %s\n", h[i], i - } -' | sort -rn - -cat $T + *.c Modified: trunk/varnish-cache/bin/varnishtest/vtc.c =================================================================== --- trunk/varnish-cache/bin/varnishtest/vtc.c 2009-11-10 19:49:32 UTC (rev 4348) +++ trunk/varnish-cache/bin/varnishtest/vtc.c 2009-11-16 09:35:09 UTC (rev 4349) @@ -52,7 +52,7 @@ char *vtc_desc; int vtc_error; /* Error encountered */ int vtc_stop; /* Stops current test without error */ -pthread_t vtc_thread;; +pthread_t vtc_thread; /********************************************************************** * Read a file into memory Modified: trunk/varnish-cache/bin/varnishtest/vtc_http.c =================================================================== --- trunk/varnish-cache/bin/varnishtest/vtc_http.c 2009-11-10 19:49:32 UTC (rev 4348) +++ trunk/varnish-cache/bin/varnishtest/vtc_http.c 2009-11-16 09:35:09 UTC (rev 4349) @@ -39,7 +39,6 @@ #include #include #include -#include #include "libvarnish.h" #include "vct.h" @@ -521,6 +520,7 @@ if (!strcmp(*av, "-body")) { AZ(body); REPLACE(body, av[1]); + AN(body); av++; bodylen = strlen(body); for (b = body; *b != '\0'; b++) { Modified: trunk/varnish-cache/bin/varnishtest/vtc_log.c =================================================================== --- trunk/varnish-cache/bin/varnishtest/vtc_log.c 2009-11-10 19:49:32 UTC (rev 4348) +++ trunk/varnish-cache/bin/varnishtest/vtc_log.c 2009-11-16 09:35:09 UTC (rev 4349) @@ -33,7 +33,6 @@ #include #include -#include #include #include #include Modified: trunk/varnish-cache/bin/varnishtest/vtc_varnish.c =================================================================== --- trunk/varnish-cache/bin/varnishtest/vtc_varnish.c 2009-11-10 19:49:32 UTC (rev 4348) +++ trunk/varnish-cache/bin/varnishtest/vtc_varnish.c 2009-11-16 09:35:09 UTC (rev 4349) @@ -103,7 +103,7 @@ if (i != 0) { vtc_log(v->vl, 0, "CLI failed (%s) = %d %u %s", cmd, i, retval, r); - return (retval); + return ((enum cli_status_e)retval); } assert(i == 0); vtc_dump(v->vl, 4, "CLI RX", r); @@ -213,12 +213,13 @@ { struct varnish *v; char buf[BUFSIZ]; - struct pollfd fds[1]; + struct pollfd *fds, fd; int i; CAST_OBJ_NOTNULL(v, priv, VARNISH_MAGIC); TCP_nonblocking(v->fds[0]); while (1) { + fds = &fd; memset(fds, 0, sizeof fds); fds->fd = v->fds[0]; fds->events = POLLIN; @@ -406,7 +407,7 @@ return; u = varnish_ask_cli(v, cli, NULL); vtc_log(v->vl, 2, "CLI %03u <%s>", u, cli); - if (exp != 0 && exp != u) + if (exp != 0 && exp != (unsigned)u) vtc_log(v->vl, 0, "FAIL CLI response %u expected %u", u, exp); } @@ -616,7 +617,7 @@ } if (!strcmp(*av, "-cliok")) { AN(av[1]); - varnish_cli(v, av[1], CLIS_OK); + varnish_cli(v, av[1], (unsigned)CLIS_OK); av++; continue; } Modified: trunk/varnish-cache/include/compat/execinfo.h =================================================================== --- trunk/varnish-cache/include/compat/execinfo.h 2009-11-10 19:49:32 UTC (rev 4348) +++ trunk/varnish-cache/include/compat/execinfo.h 2009-11-16 09:35:09 UTC (rev 4349) @@ -35,7 +35,6 @@ int backtrace(void **, int); char ** backtrace_symbols(void *const *, int); -void backtrace_symbols_fd(void *const *, int, int); #ifdef __cplusplus } Modified: trunk/varnish-cache/lib/libvarnishcompat/execinfo.c =================================================================== --- trunk/varnish-cache/lib/libvarnishcompat/execinfo.c 2009-11-10 19:49:32 UTC (rev 4348) +++ trunk/varnish-cache/lib/libvarnishcompat/execinfo.c 2009-11-16 09:35:09 UTC (rev 4349) @@ -29,6 +29,10 @@ #include "svnid.h" SVNID("$Id: execinfo.c,v 1.3 2004/07/19 05:21:09 sobomax Exp $") +#include "compat/execinfo.h" + +#if defined (__GNUC__) && __GNUC__ >= 4 /* XXX Correct version to check for ? */ + #include #include #include @@ -39,10 +43,9 @@ #include #include -#include "compat/execinfo.h" -void *getreturnaddr(int); -void *getframeaddr(int); +static void *getreturnaddr(int); +static void *getframeaddr(int); #define D10(x) ceil(log10(((x) == 0) ? 2 : ((x) + 1))) @@ -133,51 +136,7 @@ return rval; } -#if 0 -void -backtrace_symbols_fd(void *const *buffer, int size, int fd) -{ - int i, len, offset; - char *buf; - Dl_info info; - - for (i = 0; i < size; i++) { - if (dladdr(buffer[i], &info) != 0) { - if (info.dli_sname == NULL) - info.dli_sname = "???"; - if (info.dli_saddr == NULL) - info.dli_saddr = buffer[i]; - offset = (const char *)buffer[i] - (const char *)info.dli_saddr; - /* "0x01234567 at filename" */ - len = 2 + /* "0x" */ - (sizeof(void *) * 2) + /* "01234567" */ - 2 + /* " <" */ - strlen(info.dli_sname) + /* "function" */ - 1 + /* "+" */ - D10(offset) + /* "offset */ - 5 + /* "> at " */ - strlen(info.dli_fname) + /* "filename" */ - 2; /* "\n\0" */ - buf = alloca(len); - if (buf == NULL) - return; - snprintf(buf, len, "%p <%s+%d> at %s\n", - buffer[i], info.dli_sname, offset, info.dli_fname); - } else { - len = 2 + /* "0x" */ - (sizeof(void *) * 2) + /* "01234567" */ - 2; /* "\n\0" */ - buf = alloca(len); - if (buf == NULL) - return; - snprintf(buf, len, "%p\n", buffer[i]); - } - write(fd, buf, len - 1); - } -} -#endif - -void * +static void * getreturnaddr(int level) { @@ -314,7 +273,7 @@ } } -void * +static void * getframeaddr(int level) { @@ -450,3 +409,23 @@ default: return NULL; } } + +#else + +int +backtrace(void **buffer, int size) +{ + (void)buffer; + (void)size; + return (0); +} + +char ** +backtrace_symbols(void *const *buffer, int size) +{ + (void)buffer; + (void)size; + return (0); +} + +#endif From phk at projects.linpro.no Mon Nov 16 10:58:31 2009 From: phk at projects.linpro.no (phk at projects.linpro.no) Date: Mon, 16 Nov 2009 11:58:31 +0100 (CET) Subject: r4350 - trunk/varnish-cache/bin/varnishd Message-ID: <20091116105831.25A1038D05@projects.linpro.no> Author: phk Date: 2009-11-16 11:58:30 +0100 (Mon, 16 Nov 2009) New Revision: 4350 Modified: trunk/varnish-cache/bin/varnishd/flint.sh Log: Drag in /usr/local/include now that PCRE is required. Modified: trunk/varnish-cache/bin/varnishd/flint.sh =================================================================== --- trunk/varnish-cache/bin/varnishd/flint.sh 2009-11-16 09:35:09 UTC (rev 4349) +++ trunk/varnish-cache/bin/varnishd/flint.sh 2009-11-16 10:58:30 UTC (rev 4350) @@ -5,6 +5,7 @@ -I. \ -I../../include \ -I../.. \ + -I/usr/local/include \ -DVARNISH_STATE_DIR=\"foo\" \ *.c \ ../../lib/libvarnish/*.c \ From phk at projects.linpro.no Mon Nov 16 12:44:03 2009 From: phk at projects.linpro.no (phk at projects.linpro.no) Date: Mon, 16 Nov 2009 13:44:03 +0100 (CET) Subject: r4351 - in trunk/varnish-cache/bin: varnishd varnishtest/tests Message-ID: <20091116124403.A61F028138@projects.linpro.no> Author: phk Date: 2009-11-16 13:44:03 +0100 (Mon, 16 Nov 2009) New Revision: 4351 Added: trunk/varnish-cache/bin/varnishtest/tests/e00017.vtc Modified: trunk/varnish-cache/bin/varnishd/cache.h trunk/varnish-cache/bin/varnishd/cache_esi.c trunk/varnish-cache/bin/varnishd/cache_hash.c trunk/varnish-cache/bin/varnishd/cache_response.c trunk/varnish-cache/bin/varnishd/stevedore.c Log: Rework ESI storage allocation. Previously we stored the esi-metadata in the object workspace, but since we are trying to make that a snug fit and we cannot preestimate how much space ESI parsing will need, this no longer works. Instead parse the ESI metadata into the workers workspace and when done, allocate a storage object and move it all into that. Beware that this may increase the memory cost for ESI objects by the stevedores granularity. Fixes #578 Modified: trunk/varnish-cache/bin/varnishd/cache.h =================================================================== --- trunk/varnish-cache/bin/varnishd/cache.h 2009-11-16 10:58:30 UTC (rev 4350) +++ trunk/varnish-cache/bin/varnishd/cache.h 2009-11-16 12:44:03 UTC (rev 4351) @@ -89,7 +89,7 @@ struct objhead; struct objcore; struct workreq; -struct esi_bit; +struct esidata; struct vrt_backend; struct cli_proto; struct ban; @@ -342,7 +342,7 @@ VTAILQ_HEAD(, storage) store; - VTAILQ_HEAD(, esi_bit) esibits; + struct esidata *esidata; double last_use; Modified: trunk/varnish-cache/bin/varnishd/cache_esi.c =================================================================== --- trunk/varnish-cache/bin/varnishd/cache_esi.c 2009-11-16 10:58:30 UTC (rev 4350) +++ trunk/varnish-cache/bin/varnishd/cache_esi.c 2009-11-16 12:44:03 UTC (rev 4351) @@ -54,9 +54,8 @@ #include "vrt.h" #include "vcl.h" #include "cache.h" +#include "stevedore.h" -#define NDEFELEM 10 - /*--------------------------------------------------------------------*/ struct esi_bit { @@ -65,11 +64,8 @@ txt verbatim; txt host; txt include; - int free_this; }; -VTAILQ_HEAD(esibithead, esi_bit); - struct esi_ptr { const char *p; const char *e; @@ -87,14 +83,24 @@ txt t; struct esi_bit *eb; - struct esi_bit *ebl; /* list of */ - int neb; int remflg; /* inside */ int incmt; /* inside comment */ + + unsigned space; /* ... needed */ + + VTAILQ_HEAD(, esi_bit) esibits; + }; +struct esidata { + unsigned magic; +#define ESIDATA_MAGIC 0x7255277f + VTAILQ_HEAD(, esi_bit) esibits; + struct storage *storage; +}; + /*-------------------------------------------------------------------- - * Move the parse-pointer forward. + * Move an esi_ptr one char forward */ static void @@ -118,6 +124,10 @@ return; } +/*-------------------------------------------------------------------- + * Consume one input character. + */ + static void N(struct esi_work *ew) { @@ -209,18 +219,12 @@ esi_addbit(struct esi_work *ew, const char *verbatim, unsigned len) { - if (ew->neb == 0) { - ew->ebl = calloc(NDEFELEM, sizeof(struct esi_bit)); - XXXAN(ew->ebl); - ew->neb = NDEFELEM; - ew->ebl->free_this = 1; - } - ew->eb = ew->ebl; - ew->ebl++; - ew->neb--; + ew->space += sizeof(*ew->eb); + ew->eb = (void*)WS_Alloc(ew->sp->wrk->ws, sizeof *ew->eb); + AN(ew->eb); + memset(ew->eb, 0, sizeof *ew->eb); - - VTAILQ_INSERT_TAIL(&ew->sp->obj->esibits, ew->eb, list); + VTAILQ_INSERT_TAIL(&ew->esibits, ew->eb, list); if (verbatim != NULL) { ew->eb->verbatim.b = TRUST_ME(verbatim); if (len > 0) @@ -231,8 +235,10 @@ Tlen(ew->eb->verbatim), Tlen(ew->eb->verbatim), ew->eb->verbatim.b); - } else - ew->eb->verbatim.b = ew->eb->verbatim.e = (void*)ew->eb; + } else { + AN(ew->s.p); + ew->eb->verbatim.b = ew->eb->verbatim.e = TRUST_ME(ew->s.p); + } } /*--------------------------------------------------------------------*/ @@ -381,12 +387,12 @@ if ( val.b != val.e ) { s = Tlen(val) + 1; - c = WS_Alloc(ws, s); + c = WS_Alloc(ew->sp->wrk->ws, s); XXXAN(c); memcpy(c, val.b, Tlen(val)); val.b = c; val.e = val.b + s; - *val.e = '\0'; + val.e[-1] = '\0'; } if (Tlen(val) > 7 && !memcmp(val.b, "http://", 7)) { @@ -428,7 +434,7 @@ if (q != NULL) tag.e = q + 1; - u = WS_Reserve(ws, 0); + u = WS_Reserve(ew->sp->wrk->ws, 0); v = snprintf(ws->f, u - 1, "%.*s%.*s", pdiff(tag.b, tag.e), tag.b, pdiff(val.b, val.e), val.b); @@ -436,8 +442,12 @@ xxxassert(v < u); eb->include.b = ws->f; eb->include.e = ws->f + v; - WS_Release(ws, v); + WS_Release(ew->sp->wrk->ws, v); } + if (eb->include.b != NULL) + ew->space += Tlen(eb->include); + if (eb->host.b != NULL) + ew->space += Tlen(eb->host); } } @@ -654,6 +664,11 @@ ESI_Parse(struct sess *sp) { struct esi_work *ew, eww[1]; + struct esi_bit *eb; + struct esidata *ed; + struct storage *st; + unsigned u; + char *hack; CHECK_OBJ_NOTNULL(sp, SESS_MAGIC); CHECK_OBJ_NOTNULL(sp->obj, OBJECT_MAGIC); @@ -680,13 +695,19 @@ if (!contain_esi(sp->obj)) return; + /* XXX: debugging hack */ + hack = sp->wrk->ws->f; + VSL_stats->esi_parse++; /* XXX: only if GET ? */ ew = eww; memset(eww, 0, sizeof eww); + VTAILQ_INIT(&ew->esibits); ew->sp = sp; ew->off = 1; + ew->space += sizeof(struct esidata); + ew->p.st = VTAILQ_FIRST(&sp->obj->store); AN(ew->p.st); ew->p.p = (char *)ew->p.st->ptr; @@ -751,6 +772,48 @@ if (ew->incmt) esi_error(ew, ew->t.e, -1, "ESI 1.0 unterminated