From phk at FreeBSD.org Tue Mar 1 01:08:32 2016 From: phk at FreeBSD.org (Poul-Henning Kamp) Date: Tue, 01 Mar 2016 02:08:32 +0100 Subject: [master] 12ffe07 White space nitpicking Message-ID: commit 12ffe076dfda17ddd434853b1f2a9b29522e945f Author: Poul-Henning Kamp Date: Mon Feb 29 10:59:25 2016 +0000 White space nitpicking diff --git a/bin/varnishd/cache/cache_hash.c b/bin/varnishd/cache/cache_hash.c index 3a48d86..1d9d798 100644 --- a/bin/varnishd/cache/cache_hash.c +++ b/bin/varnishd/cache/cache_hash.c @@ -675,7 +675,7 @@ HSH_Unbusy(struct worker *wrk, struct objcore *oc) Lck_Lock(&oh->mtx); assert(oh->refcnt > 0); assert(oc->refcnt > 0); - if (!(oc->flags & OC_F_PRIVATE)) + if (!(oc->flags & OC_F_PRIVATE)) oc->refcnt++; // For EXP_Insert /* XXX: strictly speaking, we should sort in Date: order. */ VTAILQ_REMOVE(&oh->objcs, oc, hsh_list); @@ -684,7 +684,7 @@ HSH_Unbusy(struct worker *wrk, struct objcore *oc) if (!VTAILQ_EMPTY(&oh->waitinglist)) hsh_rush(wrk, oh); Lck_Unlock(&oh->mtx); - if (!(oc->flags & OC_F_PRIVATE)) + if (!(oc->flags & OC_F_PRIVATE)) EXP_Insert(wrk, oc); } From phk at FreeBSD.org Tue Mar 1 01:08:32 2016 From: phk at FreeBSD.org (Poul-Henning Kamp) Date: Tue, 01 Mar 2016 02:08:32 +0100 Subject: [master] 5d4e916 More 10 year aniversary late-night ruminations. Message-ID: commit 5d4e9160fafbc571b2d5e056f8ee02f65242b681 Author: Poul-Henning Kamp Date: Tue Mar 1 01:07:19 2016 +0000 More 10 year aniversary late-night ruminations. diff --git a/doc/sphinx/phk/index.rst b/doc/sphinx/phk/index.rst index 65108ed..0556769 100644 --- a/doc/sphinx/phk/index.rst +++ b/doc/sphinx/phk/index.rst @@ -8,6 +8,7 @@ You may or may not want to know what Poul-Henning thinks. .. toctree:: :maxdepth: 1 + thatslow.rst firstdesign.rst 10goingon50.rst brinch-hansens-arrows.rst diff --git a/doc/sphinx/phk/thatslow.rst b/doc/sphinx/phk/thatslow.rst new file mode 100644 index 0000000..f35b65b --- /dev/null +++ b/doc/sphinx/phk/thatslow.rst @@ -0,0 +1,194 @@ +.. _phk_that_slow: + +================= +Going fast slowly +================= + +If I count in my source tree, right here and now, Varnish has 100K lines +of sourcecode:: + + 75619 lines in .c files + 18489 lines in .h files + 2625 lines in .py files + 670 lines in .vcc files + 501 lines in .vcl files + +A little over 20K lines of testcases:: + + 21777 lines in .vtc files + +A little over 20K lines of documentation:: + + 22169 lines in .rst files + +And probably about 5K lines of "misc":: + + 1393 lines in .am files + 712 lines in .ac files + 613 lines in .lnt files + +For the sake of simplicity, lets us call it a round 150K total lines [#f1]_. + +Varnish has been in existence for 10 years, so that's 15K lines per year. + +200 workdays a year makes that 75 lines a day. + +7.5 hours of work per day gives 10 lines per hour. + +Even though I have written the vast majority of the source code, +Varnish is far from a one-person project. + +I have no way to estimate the average number of full time persons +over the last ten years, so lets pick the worst case and say that +only two persons were full time. + +It follows that there is *no way* average output of those two persons +exceeded 5 linies per hour, measured over the ten year history of +the project. + +Does that number seem low or high to you ? + +Anyway, What do programmers do all day? +--------------------------------------- + +(`Yeah, yeah, yeah, I know... `_) + +Back before the dot-com disaster, people had actually spent considerable +time and effort to find out what kind of productivity to expect from +a programmer, after all, how could you ever estimate a project without +knowing that crucial number? + +The results were all over the place, to put it mildly, but they were +universally much lower than everybody expected. + +With his seminal The Mythical Man-Month, Frederick P. Brooks brought +the ballpark estimate "10 lines per programmer per day" into common +use, despite everything he wrote in the text surrounding that number +arguing for the exact opposite. + +With the ultimate focus on quality and correctness, for instance +the Apollo and Space Shuttle software, productivity drops to less +than one line of code per day per employee. + +The estimated upper bound on Varnish productivity is almost an order +of magnitude above Brooks ball-park estimate, and another easily +ignorable magnitude away from the unrealistic goal of being the +same quality as the software for the Space Shuttle. + +So we are inside Brooks ball-park, even if a bit on the high side [#f2]_, + +What took us so long ? +---------------------- + +The surprise over the 5LOC/h number is undoubtedly inversely +proportional to the age of the reader. + +Back when I was a kid I could write 1000 lines in a single +sleep-deprived session across midnight [#f3]_, but it didn't take +that long before I discovered that I had to throw out most if it +once I woke up again. + +I was 40 years old when I started Varnish and I had 22 years +of professional experience, a *lot* of them staring at, and +often fixing/improving/refactoring, other peoples source code. + +Over the years I came to appreciate Antonie de Saint Exup?rys +observation:: + + Perfection is attained, not when there is nothing more + to add, but when there is nothing more to remove. + +And eventually I no longer think about code lines as an asset +to be accumulated, but rather as an expenditure to be avoided. + +When I started Varnish, one of my main personal goals was to +make it my highest quality program - ever [#f4]_. + +This is why Varnish is written in "pidgin C" style and lousy with +asserts which don't do anything [#f5]_, except clarify programmer +intent [#f6]_, and in case of mistakes, stop bad things before they +get out of hand. + +And this is why there are other "pointless overheads" in the Varnish +source code, from the panic/backtrace code over the "miniobj" +type-safety to obscure hints to Gimpel Softwares FlexeLint product. + +Needless to say, it is also not by accident that the 20K lines of +testcases exercise over 90% of the varnishd source code lines. + +And insisting on doing things right, rather than *"we can fix it +properly later"* which is so widespread in FOSS source code [#f7]_, +is not going to boost your line count either. + +But did it work ? +----------------- + +A 10 year project aniversary is a good reason to stop and see +if the expected roses are there to be smelled. + +We have lots of numbers, commits (10538), bugreports (1864), CVEs +(2) [#f8]_ or Coverity detections (a dozen?) but It is pretty nigh +impossible to measure program quality, even though we tend to know +it when we see it. + +There are also uncountable events which should be in the ledger, +503s [#f9]_, crashes, hair-tearing, head-scrathing, coffee-drinking, +manual- and source-code thumbing and frustrated cries of help on IRC. + +In the other cup there are equally intangible positives, pats on +the shoulder, free beers, X-mas and birthday presents from my Amazon +wish-list (Thanks!), and more snarky tweets about how great Varnish +is than I can remember. + +All in all, the best I have been able to do, to convince myself that +I have not *totally* missed my goal, is a kind of "The curious case +of the dog in the night-time" observation: + +I have never yet had a person tell me Varnish made their life more +miserable. + +I'll take that. + +*phk* + +.. rubric:: Footnotes + +.. [#f1] We can do a better and more precise estimate if we want. + For instance we have not typed in the 30 line BSD-2 Blurp *all* + 314 times, and upwards of 30% of the rest are blank lines. + However, there is no way we can reduce the number by an order + of magnitude, in particular not because code that was written + and subsequently removed is not part of the base data. + +.. [#f2] Which is to be expected really: We don't program on punched cards. + +.. [#f3] And I did. Migrating an oilcompany from IBM mainframes + to 16-bit UNIX computers in 198x was an interesting challenge. + +.. [#f4] Having half the world adopt your hastily hacked up md5crypt + with a glaringly obvious, but fortunately harmless, bug will do + that to you. + +.. [#f5] Roughly 10% of the source code lines were asserts last I looked. + +.. [#f6] I prefer asserts over comments for this, since the compiler + can also see them. The good news is, the compiler can also see + that they don't do anything so a lot fewer are present in the + binary program. Interestingly, a couple of them allows the compiler + to optimize much harder. No, I won't tell you which those are. + +.. [#f7] Only code where that is a bigger problem is phd-ware: Software + written as proof-of-concept and abandonned in haste when the diploma + was in hand. + +.. [#f8] Obviously, a high count of CVE's should be a real reason for + concern, but there is no meaningful difference between having + one, two or three CVE's over the course of ten years. + The two CVEs against Varnish were both utterly bogus "trophy-hunter" + CVEs in my opinion. (But don't take my word for it, judge for + yourself.) + +.. [#f9] There used to be a link back to the Varnish project on the + default.vcl's 503 page, but we removed it after a large national + institution in a non-english country showed it to a *lot* of people + who clicked on the only link they could see on the page. From dridi.boukelmoune at gmail.com Tue Mar 1 08:56:55 2016 From: dridi.boukelmoune at gmail.com (Dridi Boukelmoune) Date: Tue, 01 Mar 2016 09:56:55 +0100 Subject: [master] 77b8a29 Le Typo Message-ID: commit 77b8a298f05d068250851d6c54d428ec4b78b6ce Author: Dridi Boukelmoune Date: Tue Mar 1 09:56:07 2016 +0100 Le Typo diff --git a/doc/sphinx/phk/thatslow.rst b/doc/sphinx/phk/thatslow.rst index f35b65b..cece4bc 100644 --- a/doc/sphinx/phk/thatslow.rst +++ b/doc/sphinx/phk/thatslow.rst @@ -92,7 +92,7 @@ I was 40 years old when I started Varnish and I had 22 years of professional experience, a *lot* of them staring at, and often fixing/improving/refactoring, other peoples source code. -Over the years I came to appreciate Antonie de Saint Exup?rys +Over the years I came to appreciate Antoine de Saint-Exup?ry's observation:: Perfection is attained, not when there is nothing more From phk at FreeBSD.org Tue Mar 1 09:56:56 2016 From: phk at FreeBSD.org (Poul-Henning Kamp) Date: Tue, 01 Mar 2016 10:56:56 +0100 Subject: [master] 6fdd864 Another typo Message-ID: commit 6fdd86496355d532f94450fb753e4d9b8638f378 Author: Poul-Henning Kamp Date: Tue Mar 1 09:56:28 2016 +0000 Another typo diff --git a/doc/sphinx/phk/thatslow.rst b/doc/sphinx/phk/thatslow.rst index cece4bc..889d017 100644 --- a/doc/sphinx/phk/thatslow.rst +++ b/doc/sphinx/phk/thatslow.rst @@ -43,7 +43,7 @@ over the last ten years, so lets pick the worst case and say that only two persons were full time. It follows that there is *no way* average output of those two persons -exceeded 5 linies per hour, measured over the ten year history of +exceeded 5 lines per hour, measured over the ten year history of the project. Does that number seem low or high to you ? From phk at FreeBSD.org Tue Mar 1 09:58:34 2016 From: phk at FreeBSD.org (Poul-Henning Kamp) Date: Tue, 01 Mar 2016 10:58:34 +0100 Subject: [master] c44b9f7 And one more typo Message-ID: commit c44b9f78bdc04c0acf5f4ef063a81c4b6bd5fb2d Author: Poul-Henning Kamp Date: Tue Mar 1 09:58:27 2016 +0000 And one more typo diff --git a/doc/sphinx/phk/thatslow.rst b/doc/sphinx/phk/thatslow.rst index 889d017..c8c905a 100644 --- a/doc/sphinx/phk/thatslow.rst +++ b/doc/sphinx/phk/thatslow.rst @@ -27,7 +27,7 @@ And probably about 5K lines of "misc":: 712 lines in .ac files 613 lines in .lnt files -For the sake of simplicity, lets us call it a round 150K total lines [#f1]_. +For the sake of simplicity, let us call it a round 150K total lines [#f1]_. Varnish has been in existence for 10 years, so that's 15K lines per year. From dridi.boukelmoune at gmail.com Tue Mar 1 11:00:42 2016 From: dridi.boukelmoune at gmail.com (Dridi Boukelmoune) Date: Tue, 01 Mar 2016 12:00:42 +0100 Subject: [4.1] aad70ce Fix the VSL Proxy tag documentation Message-ID: commit aad70ce1452bea75b9d0360b515385fce99928cd Author: Dridi Boukelmoune Date: Mon Feb 29 22:57:21 2016 +0100 Fix the VSL Proxy tag documentation Both contents and formatting were off. diff --git a/include/tbl/vsl_tags.h b/include/tbl/vsl_tags.h index 56a9604..e1c946d 100644 --- a/include/tbl/vsl_tags.h +++ b/include/tbl/vsl_tags.h @@ -142,14 +142,14 @@ SLTM(HttpGarbage, SLT_F_BINARY, "Unparseable HTTP request", SLTM(Proxy, 0, "PROXY protocol information", "PROXY protocol information.\n\n" "The format is::\n\n" - "\t%d %s %d %s %d [key value]...\n" - "\t| | | | | |\n" - "\t| | | | | +- optional information\n" + "\t%d %s %d %s %d\n" + "\t| | | | |\n" "\t| | | | +- server port\n" - "\t| | | +- server ip\n" - "\t| | +- client port\n" - "\t| +- client ip\n" - "\t+---- PROXY protocol version\n" + "\t| | | +---- server ip\n" + "\t| | +------- client port\n" + "\t| +---------- client ip\n" + "\t+------------- PROXY protocol version\n" + "\n" ) SLTM(ProxyGarbage, 0, "Unparseable PROXY request", From phk at FreeBSD.org Tue Mar 1 21:51:19 2016 From: phk at FreeBSD.org (Poul-Henning Kamp) Date: Tue, 01 Mar 2016 22:51:19 +0100 Subject: [master] c1bc0d8 Snapshot & refcount the final ban to check, to avoid running of the ban-list if the lurker washes this OC while we check it. Message-ID: commit c1bc0d8ecee281d585d23173921ee8676421462f Author: Poul-Henning Kamp Date: Tue Mar 1 21:50:15 2016 +0000 Snapshot & refcount the final ban to check, to avoid running of the ban-list if the lurker washes this OC while we check it. Mostly diagnosed by: Martin Fixes: #1864 diff --git a/bin/varnishd/cache/cache_ban.c b/bin/varnishd/cache/cache_ban.c index 949ee93..490dbf8 100644 --- a/bin/varnishd/cache/cache_ban.c +++ b/bin/varnishd/cache/cache_ban.c @@ -524,7 +524,7 @@ BAN_CheckObject(struct worker *wrk, struct objcore *oc, struct req *req) { struct ban *b; struct vsl_log *vsl; - struct ban * volatile b0; + struct ban *b0, *bn; unsigned tests; CHECK_OBJ_NOTNULL(oc, OBJCORE_MAGIC); @@ -545,18 +545,23 @@ BAN_CheckObject(struct worker *wrk, struct objcore *oc, struct req *req) /* If that fails, make a safe check */ Lck_Lock(&ban_mtx); b0 = ban_start; + bn = oc->ban; + bn->refcount++; Lck_Unlock(&ban_mtx); - if (b0 == oc->ban) + AN(bn); + + if (b0 == bn) return (0); + /* * This loop is safe without locks, because we know we hold * a refcount on a ban somewhere in the list and we do not * inspect the list past that ban. */ tests = 0; - for (b = b0; b != oc->ban; b = VTAILQ_NEXT(b, list)) { + for (b = b0; b != bn; b = VTAILQ_NEXT(b, list)) { CHECK_OBJ_NOTNULL(b, BAN_MAGIC); if (b->flags & BANS_FLAG_COMPLETED) continue; @@ -565,6 +570,7 @@ BAN_CheckObject(struct worker *wrk, struct objcore *oc, struct req *req) } Lck_Lock(&ban_mtx); + bn->refcount--; VSC_C_main->bans_tested++; VSC_C_main->bans_tests_tested += tests; diff --git a/bin/varnishd/cache/cache_ban_lurker.c b/bin/varnishd/cache/cache_ban_lurker.c index 3e355c1..bca5dde 100644 --- a/bin/varnishd/cache/cache_ban_lurker.c +++ b/bin/varnishd/cache/cache_ban_lurker.c @@ -60,6 +60,7 @@ ban_cleantail(void) Lck_Lock(&ban_mtx); b = VTAILQ_LAST(&ban_head, banhead_s); if (b != VTAILQ_FIRST(&ban_head) && b->refcount == 0) { + assert(VTAILQ_EMPTY(&b->objcore)); if (b->flags & BANS_FLAG_COMPLETED) VSC_C_main->bans_completed--; if (b->flags & BANS_FLAG_OBJ) diff --git a/bin/varnishd/cache/cache_hash.c b/bin/varnishd/cache/cache_hash.c index 1d9d798..21088f7 100644 --- a/bin/varnishd/cache/cache_hash.c +++ b/bin/varnishd/cache/cache_hash.c @@ -408,10 +408,8 @@ HSH_Lookup(struct req *req, struct objcore **ocp, struct objcore **bocp, if (oc->ttl <= 0.) continue; - if (BAN_CheckObject(wrk, oc, req)) { - oc->flags |= OC_F_DYING; + if (BAN_CheckObject(wrk, oc, req)) continue; - } if (ObjHasAttr(wrk, oc, OA_VARY)) { vary = ObjGetAttr(wrk, oc, OA_VARY, NULL); From phk at FreeBSD.org Tue Mar 1 21:59:25 2016 From: phk at FreeBSD.org (Poul-Henning Kamp) Date: Tue, 01 Mar 2016 22:59:25 +0100 Subject: [master] c461c05 Only grab the reference count if we need it. Message-ID: commit c461c0534af077c0a10abebb1b2c812ce2baf22d Author: Poul-Henning Kamp Date: Tue Mar 1 21:59:07 2016 +0000 Only grab the reference count if we need it. Spotted by: Martin diff --git a/bin/varnishd/cache/cache_ban.c b/bin/varnishd/cache/cache_ban.c index 490dbf8..fb4a5a4 100644 --- a/bin/varnishd/cache/cache_ban.c +++ b/bin/varnishd/cache/cache_ban.c @@ -546,7 +546,8 @@ BAN_CheckObject(struct worker *wrk, struct objcore *oc, struct req *req) Lck_Lock(&ban_mtx); b0 = ban_start; bn = oc->ban; - bn->refcount++; + if (b0 != bn) + bn->refcount++; Lck_Unlock(&ban_mtx); AN(bn); From lkarsten at varnish-software.com Wed Mar 2 14:46:30 2016 From: lkarsten at varnish-software.com (Lasse Karstensen) Date: Wed, 02 Mar 2016 15:46:30 +0100 Subject: [master] 67f2e57 Write overridden file name also in created file. Message-ID: commit 67f2e575874d7bea15f541cd6c1d9de86f210f29 Author: Lasse Karstensen Date: Wed Mar 2 15:44:52 2016 +0100 Write overridden file name also in created file. This was forgotten in ecbdb32 and made the change moot. diff --git a/lib/libvcc/vmodtool.py b/lib/libvcc/vmodtool.py index 024d78a..0851871 100755 --- a/lib/libvcc/vmodtool.py +++ b/lib/libvcc/vmodtool.py @@ -928,7 +928,7 @@ def runmain(inputvcc, outputprefix="vcc_if"): fc.write('#include "config.h"\n') fc.write('#include "vcl.h"\n') fc.write('#include "vrt.h"\n') - fc.write('#include "vcc_if.h"\n') + fc.write('#include "%s.h"\n' % outputprefix) fc.write('#include "vmod_abi.h"\n') fc.write('\n') From phk at FreeBSD.org Wed Mar 2 18:43:23 2016 From: phk at FreeBSD.org (Poul-Henning Kamp) Date: Wed, 02 Mar 2016 19:43:23 +0100 Subject: [master] 934964d Set prefix/mandir to /usr/local on FreeBSD Message-ID: commit 934964d9ff838caf2d57dc673f3567c2666b383e Author: Poul-Henning Kamp Date: Wed Mar 2 18:42:57 2016 +0000 Set prefix/mandir to /usr/local on FreeBSD diff --git a/autogen.des b/autogen.des index 45698f4..a562b06 100755 --- a/autogen.des +++ b/autogen.des @@ -12,6 +12,12 @@ if [ -f /usr/bin/clang -a "x${CC}" = "x" ] ; then export CC fi +if [ "x`uname -o`" = "xFreeBSD" ] ; then + DST="--prefix=/usr/local --mandir=/usr/local/man" +else + DST="--prefix=/opt/varnish --mandir=/opt/varnish/man" +fi + rm -f configure . ./autogen.sh 2>&1 | egrep -v "(subdir-objects|is in a subdirectory)" @@ -23,10 +29,9 @@ export CONFIG_SHELL=/bin/sh # NB: FreeBSD's make on -current # env MAKE=gmake \ ./configure \ + $DST \ --enable-developer-warnings \ --enable-debugging-symbols \ --enable-dependency-tracking \ --enable-tests \ - --prefix=/opt/varnish \ - --mandir=/opt/varnish/man \ "$@" From fgsch at lodoss.net Wed Mar 2 18:56:13 2016 From: fgsch at lodoss.net (Federico G. Schwindt) Date: Wed, 02 Mar 2016 19:56:13 +0100 Subject: [master] 51e92b4 Log calls http_ForceField() in VSL using xxxUnset Message-ID: commit 51e92b447c64f88afa3feb368f41a1136711aaa8 Author: Federico G. Schwindt Date: Wed Mar 2 18:18:35 2016 +0000 Log calls http_ForceField() in VSL using xxxUnset Previously we would force the protocol and method fields to HTTP/1.1 and GET, respectively, but hide this from VSL showing 2 different entries for BereqProtocol and/or BereqMethod. Discussed with arianna at . Fixes #1662 diff --git a/bin/varnishd/cache/cache_http.c b/bin/varnishd/cache/cache_http.c index 7caaafd..8de17ec 100644 --- a/bin/varnishd/cache/cache_http.c +++ b/bin/varnishd/cache/cache_http.c @@ -752,11 +752,17 @@ http_GetMethod(const struct http *hp) void http_ForceField(const struct http *to, unsigned n, const char *t) { + int i; + CHECK_OBJ_NOTNULL(to, HTTP_MAGIC); assert(n < HTTP_HDR_FIRST); AN(t); - if (to->hd[n].b == NULL || strcmp(to->hd[n].b, t)) + if (to->hd[n].b == NULL || strcmp(to->hd[n].b, t)) { + i = (HTTP_HDR_UNSET - HTTP_HDR_METHOD); + i += to->logtag; + VSLbt(to->vsl, (enum VSL_tag_e)i, to->hd[n]); http_SetH(to, n, t); + } } /*--------------------------------------------------------------------*/ diff --git a/bin/varnishtest/tests/r01662.vtc b/bin/varnishtest/tests/r01662.vtc new file mode 100644 index 0000000..84d4800 --- /dev/null +++ b/bin/varnishtest/tests/r01662.vtc @@ -0,0 +1,27 @@ +varnishtest "Unhide http_ForceField() calls in VSL" + +server s1 { + rxreq + expect req.method == "GET" + expect req.proto == "HTTP/1.1" + txresp +} -start + +varnish v1 -vcl+backend { +} -start + +logexpect l1 -v v1 -g request { + expect * 1001 ReqMethod "HEAD" + expect * = ReqProtocol "HTTP/1.0" + expect * 1002 BereqUnset "HEAD" + expect 0 = BereqMethod "GET" + expect * = BereqUnset "HTTP/1.0" + expect 0 = BereqProtocol "HTTP/1.1" +} -start + +client c1 { + txreq -req HEAD -proto HTTP/1.0 + rxresp +} -run + +logexpect l1 -wait From guillaume at varnish-software.com Thu Mar 3 08:41:40 2016 From: guillaume at varnish-software.com (Guillaume Quintard) Date: Thu, 03 Mar 2016 09:41:40 +0100 Subject: [master] 345ba9e Always enable libvarnish test Message-ID: commit 345ba9e7d30d2acd2c38c41e7594ab6c9291b472 Author: Guillaume Quintard Date: Wed Mar 2 16:58:22 2016 +0100 Always enable libvarnish test diff --git a/lib/libvarnish/Makefile.am b/lib/libvarnish/Makefile.am index 967ec9c..bdda37d 100644 --- a/lib/libvarnish/Makefile.am +++ b/lib/libvarnish/Makefile.am @@ -42,7 +42,6 @@ libvarnish_la_CFLAGS = \ libvarnish_la_LIBADD = ${RT_LIBS} ${NET_LIBS} ${LIBM} @PCRE_LIBS@ \ @SAN_LDFLAGS@ -if ENABLE_TESTS TESTS = vnum_c_test noinst_PROGRAMS = ${TESTS} @@ -53,4 +52,3 @@ vnum_c_test_LDADD = ${LIBM} test: ${TESTS} @for test in ${TESTS} ; do ./$${test} ; done -endif From guillaume at varnish-software.com Thu Mar 3 08:41:40 2016 From: guillaume at varnish-software.com (Guillaume Quintard) Date: Thu, 03 Mar 2016 09:41:40 +0100 Subject: [master] 7c59611 Get rid of --enable-tests Message-ID: commit 7c596115a69ac810e14e4371c2fe91f30c278fa1 Author: Guillaume Quintard Date: Wed Mar 2 16:58:45 2016 +0100 Get rid of --enable-tests diff --git a/configure.ac b/configure.ac index 29afdfa..be1ea74 100644 --- a/configure.ac +++ b/configure.ac @@ -635,11 +635,6 @@ AC_ARG_ENABLE(debugging-symbols, AC_SUBST(AM_LT_LDFLAGS) -# --enable-tests -AC_ARG_ENABLE(tests, - AS_HELP_STRING([--enable-tests],[build test programs (default is NO)])) -AM_CONDITIONAL([ENABLE_TESTS], [test x$enable_tests = xyes]) - # Command line for compiling VCL code. I wish there were a simple way # to figure this out dynamically without introducing a run-time # dependency on libtool. From martin at varnish-software.com Thu Mar 3 09:49:43 2016 From: martin at varnish-software.com (Martin Blix Grydeland) Date: Thu, 03 Mar 2016 10:49:43 +0100 Subject: [master] d1b0f52 Check against the sampled oc->ban rather than the current oc->ban Message-ID: commit d1b0f52ed29efe1c4f60c474bd0ef89078c637c1 Author: Martin Blix Grydeland Date: Wed Mar 2 15:05:27 2016 +0100 Check against the sampled oc->ban rather than the current oc->ban Without this we could ban an object erranously if the ban lurker has moved the OC in the ban list while we were evaluating. diff --git a/bin/varnishd/cache/cache_ban.c b/bin/varnishd/cache/cache_ban.c index fb4a5a4..78504bb 100644 --- a/bin/varnishd/cache/cache_ban.c +++ b/bin/varnishd/cache/cache_ban.c @@ -577,7 +577,7 @@ BAN_CheckObject(struct worker *wrk, struct objcore *oc, struct req *req) oc->ban->refcount--; VTAILQ_REMOVE(&oc->ban->objcore, oc, ban_list); - if (b == oc->ban) { + if (b == bn) { /* not banned */ VTAILQ_INSERT_TAIL(&b0->objcore, oc, ban_list); b0->refcount++; From martin at varnish-software.com Thu Mar 3 09:49:43 2016 From: martin at varnish-software.com (Martin Blix Grydeland) Date: Thu, 03 Mar 2016 10:49:43 +0100 Subject: [master] 9b31cf3 Don't reset the oc->ban pointer from BAN_CheckObject Message-ID: commit 9b31cf338e93418571bfa6114fbb197143811493 Author: Martin Blix Grydeland Date: Wed Mar 2 14:59:09 2016 +0100 Don't reset the oc->ban pointer from BAN_CheckObject Resetting the pointer would race against the ban lurker moving the OC in the ban list and any object event listeners wanting to see the new ban timestamp on OEV_BANCHG. Fixes: #1863 diff --git a/bin/varnishd/cache/cache_ban.c b/bin/varnishd/cache/cache_ban.c index 78504bb..7494ee0 100644 --- a/bin/varnishd/cache/cache_ban.c +++ b/bin/varnishd/cache/cache_ban.c @@ -575,16 +575,14 @@ BAN_CheckObject(struct worker *wrk, struct objcore *oc, struct req *req) VSC_C_main->bans_tested++; VSC_C_main->bans_tests_tested += tests; - oc->ban->refcount--; - VTAILQ_REMOVE(&oc->ban->objcore, oc, ban_list); if (b == bn) { /* not banned */ + oc->ban->refcount--; + VTAILQ_REMOVE(&oc->ban->objcore, oc, ban_list); VTAILQ_INSERT_TAIL(&b0->objcore, oc, ban_list); b0->refcount++; oc->ban = b0; b = NULL; - } else { - oc->ban = NULL; } if (VTAILQ_LAST(&ban_head, banhead_s)->refcount == 0) From martin at varnish-software.com Thu Mar 3 09:49:43 2016 From: martin at varnish-software.com (Martin Blix Grydeland) Date: Thu, 03 Mar 2016 10:49:43 +0100 Subject: [master] 93d8050 Only set new lurker destination ban if we already had one. Message-ID: commit 93d805014df919f9be761c6d8ad4ed86eb90c2cb Author: Martin Blix Grydeland Date: Wed Mar 2 14:22:42 2016 +0100 Only set new lurker destination ban if we already had one. Without this we could start running ban_lurker_test_ban with an empty list of bans to test, causing a lot of unnecessary ban and oh mutex contention on every ban lurker invocation until the REQ ban triggering it is gone. Also don't call ban_lurker_test_ban when our destination ban is the same as the one being tested. This would be wasted work. Adjust the c00049.vtc test case for the bans now not being unnecessarily tested. diff --git a/bin/varnishd/cache/cache_ban_lurker.c b/bin/varnishd/cache/cache_ban_lurker.c index bca5dde..1741762 100644 --- a/bin/varnishd/cache/cache_ban_lurker.c +++ b/bin/varnishd/cache/cache_ban_lurker.c @@ -145,6 +145,9 @@ ban_lurker_test_ban(struct worker *wrk, struct vsl_log *vsl, struct ban *bt, unsigned tests; int i; + /* It's an error to give an empty list to test against */ + AZ(VTAILQ_EMPTY(obans)); + /* * First see if there is anything to do, and if so, insert marker */ @@ -222,12 +225,13 @@ ban_lurker_work(struct worker *wrk, struct vsl_log *vsl) bd = NULL; VTAILQ_INIT(&obans); for (; b != NULL; b = VTAILQ_NEXT(b, list)) { - if (bd != NULL) + if (bd != NULL && bd != b) ban_lurker_test_ban(wrk, vsl, b, &obans, bd); if (b->flags & BANS_FLAG_COMPLETED) continue; if (b->flags & BANS_FLAG_REQ) { - bd = VTAILQ_NEXT(b, list); + if (bd != NULL) + bd = VTAILQ_NEXT(b, list); continue; } n = ban_time(b->spec) - d; diff --git a/bin/varnishtest/tests/c00049.vtc b/bin/varnishtest/tests/c00049.vtc index e86c513..43f9e1b 100644 --- a/bin/varnishtest/tests/c00049.vtc +++ b/bin/varnishtest/tests/c00049.vtc @@ -132,8 +132,8 @@ varnish v1 -expect bans_deleted == 2 varnish v1 -expect bans_tested == 0 varnish v1 -expect bans_tests_tested == 0 varnish v1 -expect bans_obj_killed == 0 -varnish v1 -expect bans_lurker_tested == 10 -varnish v1 -expect bans_lurker_tests_tested == 11 +varnish v1 -expect bans_lurker_tested == 8 +varnish v1 -expect bans_lurker_tests_tested == 9 varnish v1 -expect bans_lurker_obj_killed == 4 varnish v1 -expect bans_dups == 0 @@ -157,8 +157,8 @@ varnish v1 -expect bans_deleted == 2 varnish v1 -expect bans_tested == 1 varnish v1 -expect bans_tests_tested == 1 varnish v1 -expect bans_obj_killed == 0 -varnish v1 -expect bans_lurker_tested == 10 -varnish v1 -expect bans_lurker_tests_tested == 11 +varnish v1 -expect bans_lurker_tested == 8 +varnish v1 -expect bans_lurker_tests_tested == 9 varnish v1 -expect bans_lurker_obj_killed == 4 varnish v1 -expect bans_dups == 0 @@ -182,8 +182,8 @@ varnish v1 -expect bans_deleted == 5 varnish v1 -expect bans_tested == 2 varnish v1 -expect bans_tests_tested == 2 varnish v1 -expect bans_obj_killed == 1 -varnish v1 -expect bans_lurker_tested == 10 -varnish v1 -expect bans_lurker_tests_tested == 11 +varnish v1 -expect bans_lurker_tested == 8 +varnish v1 -expect bans_lurker_tests_tested == 9 varnish v1 -expect bans_lurker_obj_killed == 4 varnish v1 -expect bans_dups == 0 From martin at varnish-software.com Thu Mar 3 09:49:43 2016 From: martin at varnish-software.com (Martin Blix Grydeland) Date: Thu, 03 Mar 2016 10:49:43 +0100 Subject: [master] 7bddf5a Assert that we don't give REQ bans to the ban lurker to test against. Message-ID: commit 7bddf5a0764eb898bf2bbff0c919bf5e393032c3 Author: Martin Blix Grydeland Date: Wed Mar 2 14:32:36 2016 +0100 Assert that we don't give REQ bans to the ban lurker to test against. diff --git a/bin/varnishd/cache/cache_ban_lurker.c b/bin/varnishd/cache/cache_ban_lurker.c index 1741762..65c552e 100644 --- a/bin/varnishd/cache/cache_ban_lurker.c +++ b/bin/varnishd/cache/cache_ban_lurker.c @@ -174,6 +174,7 @@ ban_lurker_test_ban(struct worker *wrk, struct vsl_log *vsl, struct ban *bt, VTAILQ_REMOVE(obans, bl, l_list); continue; } + AZ(bl->flags & BANS_FLAG_REQ); tests = 0; i = ban_evaluate(wrk, bl->spec, oc, NULL, &tests); VSC_C_main->bans_lurker_tested++; From martin at varnish-software.com Thu Mar 3 09:52:53 2016 From: martin at varnish-software.com (Martin Blix Grydeland) Date: Thu, 03 Mar 2016 10:52:53 +0100 Subject: [4.1] ea9e3aa Snapshot & refcount the final ban to check, to avoid running of the ban-list if the lurker washes this OC while we check it. Message-ID: commit ea9e3aa324e9e491540ddcf846038778f4696613 Author: Poul-Henning Kamp Date: Tue Mar 1 21:50:15 2016 +0000 Snapshot & refcount the final ban to check, to avoid running of the ban-list if the lurker washes this OC while we check it. Mostly diagnosed by: Martin Fixes: #1864 diff --git a/bin/varnishd/cache/cache_ban.c b/bin/varnishd/cache/cache_ban.c index 2838914..aea88e5 100644 --- a/bin/varnishd/cache/cache_ban.c +++ b/bin/varnishd/cache/cache_ban.c @@ -504,7 +504,7 @@ BAN_CheckObject(struct worker *wrk, struct objcore *oc, struct req *req) { struct ban *b; struct vsl_log *vsl; - struct ban * volatile b0; + struct ban *b0, *bn; unsigned tests; CHECK_OBJ_NOTNULL(oc, OBJCORE_MAGIC); @@ -524,18 +524,23 @@ BAN_CheckObject(struct worker *wrk, struct objcore *oc, struct req *req) /* If that fails, make a safe check */ Lck_Lock(&ban_mtx); b0 = ban_start; + bn = oc->ban; + bn->refcount++; Lck_Unlock(&ban_mtx); - if (b0 == oc->ban) + AN(bn); + + if (b0 == bn) return (0); + /* * This loop is safe without locks, because we know we hold * a refcount on a ban somewhere in the list and we do not * inspect the list past that ban. */ tests = 0; - for (b = b0; b != oc->ban; b = VTAILQ_NEXT(b, list)) { + for (b = b0; b != bn; b = VTAILQ_NEXT(b, list)) { CHECK_OBJ_NOTNULL(b, BAN_MAGIC); if (b->flags & BANS_FLAG_COMPLETED) continue; @@ -544,6 +549,7 @@ BAN_CheckObject(struct worker *wrk, struct objcore *oc, struct req *req) } Lck_Lock(&ban_mtx); + bn->refcount--; VSC_C_main->bans_tested++; VSC_C_main->bans_tests_tested += tests; diff --git a/bin/varnishd/cache/cache_ban_lurker.c b/bin/varnishd/cache/cache_ban_lurker.c index 63371f8..b4bbc30 100644 --- a/bin/varnishd/cache/cache_ban_lurker.c +++ b/bin/varnishd/cache/cache_ban_lurker.c @@ -60,6 +60,7 @@ ban_cleantail(void) Lck_Lock(&ban_mtx); b = VTAILQ_LAST(&ban_head, banhead_s); if (b != VTAILQ_FIRST(&ban_head) && b->refcount == 0) { + assert(VTAILQ_EMPTY(&b->objcore)); if (b->flags & BANS_FLAG_COMPLETED) VSC_C_main->bans_completed--; if (b->flags & BANS_FLAG_OBJ) From martin at varnish-software.com Thu Mar 3 09:52:53 2016 From: martin at varnish-software.com (Martin Blix Grydeland) Date: Thu, 03 Mar 2016 10:52:53 +0100 Subject: [4.1] 6dca7ae Only grab the reference count if we need it. Message-ID: commit 6dca7aecb0c57402e5f8def400676ddeed72cd24 Author: Poul-Henning Kamp Date: Tue Mar 1 21:59:07 2016 +0000 Only grab the reference count if we need it. Spotted by: Martin diff --git a/bin/varnishd/cache/cache_ban.c b/bin/varnishd/cache/cache_ban.c index aea88e5..deb4255 100644 --- a/bin/varnishd/cache/cache_ban.c +++ b/bin/varnishd/cache/cache_ban.c @@ -525,7 +525,8 @@ BAN_CheckObject(struct worker *wrk, struct objcore *oc, struct req *req) Lck_Lock(&ban_mtx); b0 = ban_start; bn = oc->ban; - bn->refcount++; + if (b0 != bn) + bn->refcount++; Lck_Unlock(&ban_mtx); AN(bn); From martin at varnish-software.com Thu Mar 3 09:52:53 2016 From: martin at varnish-software.com (Martin Blix Grydeland) Date: Thu, 03 Mar 2016 10:52:53 +0100 Subject: [4.1] 6831bdd Check against the sampled oc->ban rather than the current oc->ban Message-ID: commit 6831bdd5921cd606d3892cbe8ce7cc37dbfc4e53 Author: Martin Blix Grydeland Date: Wed Mar 2 15:05:27 2016 +0100 Check against the sampled oc->ban rather than the current oc->ban Without this we could ban an object erranously if the ban lurker has moved the OC in the ban list while we were evaluating. diff --git a/bin/varnishd/cache/cache_ban.c b/bin/varnishd/cache/cache_ban.c index deb4255..bb06490 100644 --- a/bin/varnishd/cache/cache_ban.c +++ b/bin/varnishd/cache/cache_ban.c @@ -556,7 +556,7 @@ BAN_CheckObject(struct worker *wrk, struct objcore *oc, struct req *req) oc->ban->refcount--; VTAILQ_REMOVE(&oc->ban->objcore, oc, ban_list); - if (b == oc->ban) { + if (b == bn) { /* not banned */ VTAILQ_INSERT_TAIL(&b0->objcore, oc, ban_list); b0->refcount++; From martin at varnish-software.com Thu Mar 3 09:52:53 2016 From: martin at varnish-software.com (Martin Blix Grydeland) Date: Thu, 03 Mar 2016 10:52:53 +0100 Subject: [4.1] ea2d74c Don't reset the oc->ban pointer from BAN_CheckObject Message-ID: commit ea2d74c4ac20a2182ad8e717076ad912fe2b5994 Author: Martin Blix Grydeland Date: Wed Mar 2 14:59:09 2016 +0100 Don't reset the oc->ban pointer from BAN_CheckObject Resetting the pointer would race against the ban lurker moving the OC in the ban list and any object event listeners wanting to see the new ban timestamp on OEV_BANCHG. Fixes: #1863 diff --git a/bin/varnishd/cache/cache_ban.c b/bin/varnishd/cache/cache_ban.c index bb06490..cfb8da0 100644 --- a/bin/varnishd/cache/cache_ban.c +++ b/bin/varnishd/cache/cache_ban.c @@ -554,16 +554,14 @@ BAN_CheckObject(struct worker *wrk, struct objcore *oc, struct req *req) VSC_C_main->bans_tested++; VSC_C_main->bans_tests_tested += tests; - oc->ban->refcount--; - VTAILQ_REMOVE(&oc->ban->objcore, oc, ban_list); if (b == bn) { /* not banned */ + oc->ban->refcount--; + VTAILQ_REMOVE(&oc->ban->objcore, oc, ban_list); VTAILQ_INSERT_TAIL(&b0->objcore, oc, ban_list); b0->refcount++; oc->ban = b0; b = NULL; - } else { - oc->ban = NULL; } if (VTAILQ_LAST(&ban_head, banhead_s)->refcount == 0) From martin at varnish-software.com Thu Mar 3 09:52:53 2016 From: martin at varnish-software.com (Martin Blix Grydeland) Date: Thu, 03 Mar 2016 10:52:53 +0100 Subject: [4.1] 26c2815 Only set new lurker destination ban if we already had one. Message-ID: commit 26c281595b3b6b4a8c4089fd2994f7ce480ab593 Author: Martin Blix Grydeland Date: Wed Mar 2 14:22:42 2016 +0100 Only set new lurker destination ban if we already had one. Without this we could start running ban_lurker_test_ban with an empty list of bans to test, causing a lot of unnecessary ban and oh mutex contention on every ban lurker invocation until the REQ ban triggering it is gone. Also don't call ban_lurker_test_ban when our destination ban is the same as the one being tested. This would be wasted work. Adjust the c00049.vtc test case for the bans now not being unnecessarily tested. diff --git a/bin/varnishd/cache/cache_ban_lurker.c b/bin/varnishd/cache/cache_ban_lurker.c index b4bbc30..fecf6b0 100644 --- a/bin/varnishd/cache/cache_ban_lurker.c +++ b/bin/varnishd/cache/cache_ban_lurker.c @@ -145,6 +145,9 @@ ban_lurker_test_ban(struct worker *wrk, struct vsl_log *vsl, struct ban *bt, unsigned tests; int i; + /* It's an error to give an empty list to test against */ + AZ(VTAILQ_EMPTY(obans)); + /* * First see if there is anything to do, and if so, insert marker */ @@ -223,12 +226,13 @@ ban_lurker_work(struct worker *wrk, struct vsl_log *vsl) bd = NULL; VTAILQ_INIT(&obans); for (; b != NULL; b = VTAILQ_NEXT(b, list)) { - if (bd != NULL) + if (bd != NULL && bd != b) ban_lurker_test_ban(wrk, vsl, b, &obans, bd); if (b->flags & BANS_FLAG_COMPLETED) continue; if (b->flags & BANS_FLAG_REQ) { - bd = VTAILQ_NEXT(b, list); + if (bd != NULL) + bd = VTAILQ_NEXT(b, list); continue; } n = ban_time(b->spec) - d; diff --git a/bin/varnishtest/tests/c00049.vtc b/bin/varnishtest/tests/c00049.vtc index e86c513..43f9e1b 100644 --- a/bin/varnishtest/tests/c00049.vtc +++ b/bin/varnishtest/tests/c00049.vtc @@ -132,8 +132,8 @@ varnish v1 -expect bans_deleted == 2 varnish v1 -expect bans_tested == 0 varnish v1 -expect bans_tests_tested == 0 varnish v1 -expect bans_obj_killed == 0 -varnish v1 -expect bans_lurker_tested == 10 -varnish v1 -expect bans_lurker_tests_tested == 11 +varnish v1 -expect bans_lurker_tested == 8 +varnish v1 -expect bans_lurker_tests_tested == 9 varnish v1 -expect bans_lurker_obj_killed == 4 varnish v1 -expect bans_dups == 0 @@ -157,8 +157,8 @@ varnish v1 -expect bans_deleted == 2 varnish v1 -expect bans_tested == 1 varnish v1 -expect bans_tests_tested == 1 varnish v1 -expect bans_obj_killed == 0 -varnish v1 -expect bans_lurker_tested == 10 -varnish v1 -expect bans_lurker_tests_tested == 11 +varnish v1 -expect bans_lurker_tested == 8 +varnish v1 -expect bans_lurker_tests_tested == 9 varnish v1 -expect bans_lurker_obj_killed == 4 varnish v1 -expect bans_dups == 0 @@ -182,8 +182,8 @@ varnish v1 -expect bans_deleted == 5 varnish v1 -expect bans_tested == 2 varnish v1 -expect bans_tests_tested == 2 varnish v1 -expect bans_obj_killed == 1 -varnish v1 -expect bans_lurker_tested == 10 -varnish v1 -expect bans_lurker_tests_tested == 11 +varnish v1 -expect bans_lurker_tested == 8 +varnish v1 -expect bans_lurker_tests_tested == 9 varnish v1 -expect bans_lurker_obj_killed == 4 varnish v1 -expect bans_dups == 0 From martin at varnish-software.com Thu Mar 3 09:52:53 2016 From: martin at varnish-software.com (Martin Blix Grydeland) Date: Thu, 03 Mar 2016 10:52:53 +0100 Subject: [4.1] e513927 Assert that we don't give REQ bans to the ban lurker to test against. Message-ID: commit e5139273f9daf4982c92edeb7ef68ce40d55c351 Author: Martin Blix Grydeland Date: Wed Mar 2 14:32:36 2016 +0100 Assert that we don't give REQ bans to the ban lurker to test against. diff --git a/bin/varnishd/cache/cache_ban_lurker.c b/bin/varnishd/cache/cache_ban_lurker.c index fecf6b0..c3d4a19 100644 --- a/bin/varnishd/cache/cache_ban_lurker.c +++ b/bin/varnishd/cache/cache_ban_lurker.c @@ -174,6 +174,7 @@ ban_lurker_test_ban(struct worker *wrk, struct vsl_log *vsl, struct ban *bt, VTAILQ_REMOVE(obans, bl, l_list); continue; } + AZ(bl->flags & BANS_FLAG_REQ); tests = 0; i = ban_evaluate(wrk, bl->spec, oc, NULL, &tests); VSC_C_main->bans_lurker_tested++; From nils.goroll at uplex.de Thu Mar 3 11:03:54 2016 From: nils.goroll at uplex.de (Nils Goroll) Date: Thu, 03 Mar 2016 12:03:54 +0100 Subject: [master] 5ca41d8 Fix an off-by-one when setting the first bit exceeding the current bitmap size Message-ID: commit 5ca41d8688b36302a76a80d2ed0d0083874b0cb3 Author: Nils Goroll Date: Thu Mar 3 11:56:22 2016 +0100 Fix an off-by-one when setting the first bit exceeding the current bitmap size When setting bit n (the n+1th bit) of an n-bit vbitmap, we'd miss to expand the bitmap and thus overflow our buffer and overwrite the first bit of the next byte in memory. diff --git a/include/vbm.h b/include/vbm.h index 13d2d5f..984a3ea 100644 --- a/include/vbm.h +++ b/include/vbm.h @@ -86,7 +86,7 @@ vbit_set(struct vbitmap *vb, unsigned bit) { if (bit >= vb->nbits) - vbit_expand(vb, bit); + vbit_expand(vb, bit + 1); vb->bits[VBITMAP_IDX(bit)] |= VBITMAP_BIT(bit); } From lkarsten at varnish-software.com Thu Mar 3 13:36:25 2016 From: lkarsten at varnish-software.com (Lasse Karstensen) Date: Thu, 03 Mar 2016 14:36:25 +0100 Subject: [master] ba519f4 Make RST output directory configurable as well. Message-ID: commit ba519f4d6a1550f84d1009a98cb3802ca5430964 Author: Lasse Karstensen Date: Thu Mar 3 14:21:59 2016 +0100 Make RST output directory configurable as well. Avoid some of the mess in src/ when building multiple vmods in the same git tree. diff --git a/lib/libvcc/vmodtool.py b/lib/libvcc/vmodtool.py index 0851871..c85506e 100755 --- a/lib/libvcc/vmodtool.py +++ b/lib/libvcc/vmodtool.py @@ -849,7 +849,7 @@ class SimpleTestCase(unittest.TestCase): ####################################################################### -def runmain(inputvcc, outputprefix="vcc_if"): +def runmain(inputvcc, rstdir, outputprefix="vcc_if"): # Read the file in lines = [] with open(inputvcc, "r") as fp: @@ -939,7 +939,7 @@ def runmain(inputvcc, outputprefix="vcc_if"): fh.close() for suf in ("", ".man"): - fp = open("vmod_%s%s.rst" % (vx[0].nam, suf), "w") + fp = open(join(rstdir, "vmod_%s%s.rst" % (vx[0].nam, suf)), "w") write_rst_file_warning(fp) vx[0].doc_dump(fp, suf) @@ -962,6 +962,8 @@ if __name__ == "__main__": help="Be strict when parsing input file. (vmod.vcc)") oparser.add_option('-o', metavar="prefix", default='vcc_if', help='Output file prefix. (default: "vcc_if")') + oparser.add_option('-w', '--rstdir', metavar="directory", default='.', + help='Where to save generated RST files. (default: ".")') oparser.add_option('', '--runtests', action='store_true', default=False, dest="runtests", help=optparse.SUPPRESS_HELP) (opts, args) = oparser.parse_args() @@ -984,4 +986,4 @@ if __name__ == "__main__": oparser.print_help() exit(-1) - runmain(i_vcc, outputprefix=opts.o) + runmain(i_vcc, opts.rstdir, outputprefix=opts.o) From nils.goroll at uplex.de Thu Mar 3 13:46:00 2016 From: nils.goroll at uplex.de (Nils Goroll) Date: Thu, 03 Mar 2016 14:46:00 +0100 Subject: [master] 39e2405 improve the vbm facility, rename former vbit_init to vbit_new Message-ID: commit 39e2405bb04317c893726f38d43676570a1bdf1a Author: Nils Goroll Date: Thu Mar 3 14:35:28 2016 +0100 improve the vbm facility, rename former vbit_init to vbit_new vbit_init now initializes a vbitmap from an arbitrary memory extent. If more bits are used than the extent provided, auto-sizing falls back to malloc, so vbit_destroy() should still be used. adding a test program diff --git a/.gitignore b/.gitignore index 0cfaa04..fb9cde6 100644 --- a/.gitignore +++ b/.gitignore @@ -57,6 +57,9 @@ cscope.*out /include/tbl/vrt_stv_var.h /include/tbl/vcc_types.h /include/vcs_version.h +/include/vbm_test +/include/vbm_test.log +/include/test-suite.log /lib/libvcc/vcc_fixed_token.c /lib/libvcc/vcc_obj.c /lib/libvcc/vcc_token_defs.h diff --git a/bin/varnishd/mgt/mgt_child.c b/bin/varnishd/mgt/mgt_child.c index 1673169..3aee527 100644 --- a/bin/varnishd/mgt/mgt_child.c +++ b/bin/varnishd/mgt/mgt_child.c @@ -206,7 +206,7 @@ mgt_child_inherit(int fd, const char *what) assert(fd >= 0); if (fd_map == NULL) - fd_map = vbit_init(128); + fd_map = vbit_new(128); AN(fd_map); if (what != NULL) vbit_set(fd_map, fd); diff --git a/include/Makefile.am b/include/Makefile.am index ced33c8..816e416 100644 --- a/include/Makefile.am +++ b/include/Makefile.am @@ -152,3 +152,12 @@ CLEANFILES = \ vcl.h \ vrt_obj.h \ vmod_abi.h + +TESTS = vbm_test + +noinst_PROGRAMS = ${TESTS} + +vbm_test_SOURCES = vbm_test.c vbm.h + +test: ${TESTS} + @for test in ${TESTS} ; do ./$${test} ; done diff --git a/include/vbm.h b/include/vbm.h index 984a3ea..94497ab 100644 --- a/include/vbm.h +++ b/include/vbm.h @@ -29,17 +29,33 @@ * Self-sizeing bitmap operations */ +#include +#include +#include + /********************************************************************** - * Generic bitmap functions, may be generalized at some point. + * Generic bitmap functions */ #define VBITMAP_TYPE unsigned /* Our preferred wordsize */ #define VBITMAP_LUMP (1024) /* How many bits we alloc at a time */ #define VBITMAP_WORD (sizeof(VBITMAP_TYPE) * 8) -#define VBITMAP_IDX(n) (n / VBITMAP_WORD) -#define VBITMAP_BIT(n) (1U << (n % VBITMAP_WORD)) +#define VBITMAP_IDX(n) ((n) / VBITMAP_WORD) +#define VBITMAP_BIT(n) (1U << ((n) % VBITMAP_WORD)) + +static inline unsigned +vbit_rndup(unsigned bit, unsigned to) { + bit += to - 1; + bit -= (bit % to); + + return (bit); +} struct vbitmap { + unsigned flags; +#define VBITMAP_FL_MALLOC 1 /* struct vbitmap is malloced */ +#define VBITMAP_FL_MALLOC_BITS (1<<1) /* bits space is malloced */ + VBITMAP_TYPE *bits; unsigned nbits; }; @@ -49,22 +65,64 @@ vbit_expand(struct vbitmap *vb, unsigned bit) { unsigned char *p; - bit += VBITMAP_LUMP - 1; - bit -= (bit % VBITMAP_LUMP); - p = realloc(vb->bits, bit / 8); - assert(p != NULL); + bit = vbit_rndup(bit, VBITMAP_LUMP); + assert(bit > vb->nbits); + + if (vb->flags & VBITMAP_FL_MALLOC_BITS) { + p = realloc(vb->bits, bit / 8); + assert(p != NULL); + } else { + p = malloc(bit / 8); + assert(p != NULL); + if (vb->nbits > 0) + memcpy(p, vb->bits, vb->nbits / 8); + } memset(p + vb->nbits / 8, 0, (bit - vb->nbits) / 8); + vb->flags |= VBITMAP_FL_MALLOC_BITS; vb->bits = (void*)p; vb->nbits = bit; } +#define VBITMAP_SZ(b) (sizeof(struct vbitmap) + \ + vbit_rndup(b, VBITMAP_WORD)) + +/* + * init from some extent of memory (e.g. workspace) which the caller must + * manage. Returns a vbitmap with as many bits as fit into sz in VBITMAP_WORD + * chunks. + * + * use VBITMAP_SZ to calculate sz + */ +static inline struct vbitmap * +vbit_init(void *p, size_t sz) +{ + struct vbitmap *vb; + + if (sz < sizeof(*vb)) + return NULL; + + memset(p, 0, sz); + vb = p; + + p = (char *)p + sizeof(*vb); + sz -= sizeof(*vb); + + vb->nbits = (sz / VBITMAP_WORD) * VBITMAP_WORD; + if (vb->nbits) + vb->bits = p; + + return (vb); +} + +/* init using malloc */ static inline struct vbitmap * -vbit_init(unsigned initial) +vbit_new(unsigned initial) { struct vbitmap *vb; vb = calloc(sizeof *vb, 1); assert(vb != NULL); + vb->flags |= VBITMAP_FL_MALLOC; if (initial == 0) initial = VBITMAP_LUMP; vbit_expand(vb, initial); @@ -77,8 +135,13 @@ vbit_destroy(struct vbitmap *vb) if (vb == NULL) return; - free(vb->bits); - free(vb); + if (vb->flags & VBITMAP_FL_MALLOC_BITS) { + free(vb->bits); + vb->bits = NULL; + vb->nbits = 0; + } + if (vb->flags & VBITMAP_FL_MALLOC) + free(vb); } static inline void diff --git a/include/vbm_test.c b/include/vbm_test.c new file mode 100644 index 0000000..f680597 --- /dev/null +++ b/include/vbm_test.c @@ -0,0 +1,92 @@ +/*- + * Copyright 2016 UPLEX - Nils Goroll Systemoptimierung + * All rights reserved. + * + * Author: Nils Goroll + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL AUTHOR OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * Test Self-sizeing bitmap operations static initialization with dynamic growth + */ + +#include +#include + +#include "vbm.h" + +int +main(void) +{ + + const unsigned sz = VBITMAP_SZ(1); + char spc[sz]; + struct vbitmap *vb = vbit_init(spc, sz); + + VBITMAP_TYPE *obits; + unsigned nbits; + + assert(vb); + obits = vb->bits; + nbits = vb->nbits; + assert(nbits == VBITMAP_WORD); + + vbit_set(vb, nbits - 1); + assert(vbit_test(vb, nbits - 1)); + + assert(vb->bits); + /* nothing malloc'ed - null ops */ + vbit_destroy(vb); + assert(vb->bits); + assert(vb->bits == obits); + + /* re-alloc */ + vbit_set(vb, nbits); + assert(vbit_test(vb, nbits - 1)); + assert(vbit_test(vb, nbits)); + assert(vb->nbits == VBITMAP_LUMP); + assert(vb->bits != obits); + assert(vb->flags & VBITMAP_FL_MALLOC_BITS); + + assert(vb->bits); + /* free the bits */ + vbit_destroy(vb); + assert(vb->bits == NULL); + assert(vb->nbits == 0); + + /* use again */ + assert(20 < VBITMAP_LUMP); + vbit_set(vb, 20); + assert(vbit_test(vb, 20)); + assert(vb->nbits == VBITMAP_LUMP); + assert(vb->flags & VBITMAP_FL_MALLOC_BITS); + + /* grow */ + vbit_set(vb, VBITMAP_LUMP); + assert(vbit_test(vb, 20)); + assert(vbit_test(vb, VBITMAP_LUMP)); + assert(vb->nbits == 2 * VBITMAP_LUMP); + assert(vb->flags & VBITMAP_FL_MALLOC_BITS); + + vbit_destroy(vb); + + return (0); +} diff --git a/lib/libvarnishapi/vsl.c b/lib/libvarnishapi/vsl.c index 2bd801c..1efc453 100644 --- a/lib/libvarnishapi/vsl.c +++ b/lib/libvarnishapi/vsl.c @@ -101,8 +101,8 @@ VSL_New(void) vsl->L_opt = 1000; vsl->T_opt = 120.; - vsl->vbm_select = vbit_init(SLT__MAX); - vsl->vbm_supress = vbit_init(SLT__MAX); + vsl->vbm_select = vbit_new(SLT__MAX); + vsl->vbm_supress = vbit_new(SLT__MAX); VTAILQ_INIT(&vsl->vslf_select); VTAILQ_INIT(&vsl->vslf_suppress); diff --git a/lib/libvarnishapi/vsl_arg.c b/lib/libvarnishapi/vsl_arg.c index cc14e94..89ab29d 100644 --- a/lib/libvarnishapi/vsl_arg.c +++ b/lib/libvarnishapi/vsl_arg.c @@ -270,7 +270,7 @@ vsl_IX_arg(struct VSL_data *vsl, int opt, const char *arg) b = arg; e = strchr(b, ':'); if (e) { - tags = vbit_init(SLT__MAX); + tags = vbit_new(SLT__MAX); AN(tags); l = e - b; i = VSL_List2Tags(b, l, vsl_vbm_bitset, tags); diff --git a/lib/libvarnishapi/vxp_parse.c b/lib/libvarnishapi/vxp_parse.c index 7ec8865..7ec0d4f 100644 --- a/lib/libvarnishapi/vxp_parse.c +++ b/lib/libvarnishapi/vxp_parse.c @@ -75,7 +75,7 @@ vxp_expr_lhs(struct vxp *vxp, struct vex_lhs **plhs) AZ(*plhs); ALLOC_OBJ(*plhs, VEX_LHS_MAGIC); AN(*plhs); - (*plhs)->tags = vbit_init(SLT__MAX); + (*plhs)->tags = vbit_new(SLT__MAX); (*plhs)->level = -1; if (vxp->t->tok == '{') { diff --git a/lib/libvmod_directors/vdir.c b/lib/libvmod_directors/vdir.c index 22dfee3..15dd56a 100644 --- a/lib/libvmod_directors/vdir.c +++ b/lib/libvmod_directors/vdir.c @@ -72,7 +72,7 @@ vdir_new(struct vdir **vdp, const char *name, const char *vcl_name, vd->dir->priv = priv; vd->dir->healthy = healthy; vd->dir->resolve = resolve; - vd->vbm = vbit_init(8); + vd->vbm = vbit_new(8); AN(vd->vbm); } From nils.goroll at uplex.de Thu Mar 3 13:59:33 2016 From: nils.goroll at uplex.de (Nils Goroll) Date: Thu, 03 Mar 2016 14:59:33 +0100 Subject: [4.1] 31af69b Fix an off-by-one when setting the first bit exceeding the current bitmap size Message-ID: commit 31af69b9759d9468b3d0d3972fd379d2ca7fded6 Author: Nils Goroll Date: Thu Mar 3 11:56:22 2016 +0100 Fix an off-by-one when setting the first bit exceeding the current bitmap size When setting bit n (the n+1th bit) of an n-bit vbitmap, we'd miss to expand the bitmap and thus overflow our buffer and overwrite the first bit of the next byte in memory. diff --git a/include/vbm.h b/include/vbm.h index 13d2d5f..984a3ea 100644 --- a/include/vbm.h +++ b/include/vbm.h @@ -86,7 +86,7 @@ vbit_set(struct vbitmap *vb, unsigned bit) { if (bit >= vb->nbits) - vbit_expand(vb, bit); + vbit_expand(vb, bit + 1); vb->bits[VBITMAP_IDX(bit)] |= VBITMAP_BIT(bit); } From lkarsten at varnish-software.com Thu Mar 3 14:55:03 2016 From: lkarsten at varnish-software.com (Lasse Karstensen) Date: Thu, 03 Mar 2016 15:55:03 +0100 Subject: [master] 3cc109e Fix test case. Message-ID: commit 3cc109e36aeb74863af7a7bfa0366cdcf3885efe Author: Lasse Karstensen Date: Thu Mar 3 15:54:51 2016 +0100 Fix test case. diff --git a/lib/libvcc/vmodtool.py b/lib/libvcc/vmodtool.py index c85506e..9262850 100755 --- a/lib/libvcc/vmodtool.py +++ b/lib/libvcc/vmodtool.py @@ -843,7 +843,7 @@ class SimpleTestCase(unittest.TestCase): tmpfile = mktemp() bdir = dirname(realpath(__file__)) for inputfile in glob(join(bdir, "../libvmod_*/vmod.vcc")): - runmain(inputfile, outputprefix=tmpfile) + runmain(inputfile, ".", outputprefix=tmpfile) unlink(tmpfile + ".c") unlink(tmpfile + ".h") From lkarsten at varnish-software.com Thu Mar 3 15:53:21 2016 From: lkarsten at varnish-software.com (Lasse Karstensen) Date: Thu, 03 Mar 2016 16:53:21 +0100 Subject: [4.1] fadfbf7 Use os.path.join(). Message-ID: commit fadfbf7515e37a9cb25ab359b754fea2c5a85307 Author: Lasse Karstensen Date: Thu Feb 11 12:56:33 2016 +0100 Use os.path.join(). diff --git a/lib/libvcc/vmodtool.py b/lib/libvcc/vmodtool.py index 07ff129..024d78a 100755 --- a/lib/libvcc/vmodtool.py +++ b/lib/libvcc/vmodtool.py @@ -42,7 +42,7 @@ import optparse import unittest import random from os import unlink -from os.path import dirname, realpath, exists +from os.path import dirname, exists, join, realpath from pprint import pprint, pformat ctypes = { @@ -842,10 +842,10 @@ class SimpleTestCase(unittest.TestCase): from glob import glob tmpfile = mktemp() bdir = dirname(realpath(__file__)) - for inputfile in glob(bdir + "/../libvmod_*/vmod.vcc"): - runmain(inputfile, outputname=tmpfile) - for suffix in [".c", ".h"]: - unlink(tmpfile + suffix) + for inputfile in glob(join(bdir, "../libvmod_*/vmod.vcc")): + runmain(inputfile, outputprefix=tmpfile) + unlink(tmpfile + ".c") + unlink(tmpfile + ".h") ####################################################################### From lkarsten at varnish-software.com Thu Mar 3 15:53:21 2016 From: lkarsten at varnish-software.com (Lasse Karstensen) Date: Thu, 03 Mar 2016 16:53:21 +0100 Subject: [4.1] b871635 Make RST output directory configurable as well. Message-ID: commit b871635484a50fbe8392ed991091ef1e7598070b Author: Lasse Karstensen Date: Thu Mar 3 14:21:59 2016 +0100 Make RST output directory configurable as well. Avoid some of the mess in src/ when building multiple vmods in the same git tree. diff --git a/lib/libvcc/vmodtool.py b/lib/libvcc/vmodtool.py index 024d78a..1131631 100755 --- a/lib/libvcc/vmodtool.py +++ b/lib/libvcc/vmodtool.py @@ -849,7 +849,7 @@ class SimpleTestCase(unittest.TestCase): ####################################################################### -def runmain(inputvcc, outputprefix="vcc_if"): +def runmain(inputvcc, rstdir, outputprefix="vcc_if"): # Read the file in lines = [] with open(inputvcc, "r") as fp: @@ -939,7 +939,7 @@ def runmain(inputvcc, outputprefix="vcc_if"): fh.close() for suf in ("", ".man"): - fp = open("vmod_%s%s.rst" % (vx[0].nam, suf), "w") + fp = open(join(rstdir, "vmod_%s%s.rst" % (vx[0].nam, suf)), "w") write_rst_file_warning(fp) vx[0].doc_dump(fp, suf) @@ -962,6 +962,8 @@ if __name__ == "__main__": help="Be strict when parsing input file. (vmod.vcc)") oparser.add_option('-o', metavar="prefix", default='vcc_if', help='Output file prefix. (default: "vcc_if")') + oparser.add_option('-w', '--rstdir', metavar="directory", default='.', + help='Where to save generated RST files. (default: ".")') oparser.add_option('', '--runtests', action='store_true', default=False, dest="runtests", help=optparse.SUPPRESS_HELP) (opts, args) = oparser.parse_args() @@ -984,4 +986,4 @@ if __name__ == "__main__": oparser.print_help() exit(-1) - runmain(i_vcc, outputprefix=opts.o) + runmain(i_vcc, opts.rstdir, outputprefix=opts.o) From lkarsten at varnish-software.com Thu Mar 3 15:53:21 2016 From: lkarsten at varnish-software.com (Lasse Karstensen) Date: Thu, 03 Mar 2016 16:53:21 +0100 Subject: [4.1] 6173af4 Fix test case. Message-ID: commit 6173af4e3639f9d6d095a091e98914463057ec4e Author: Lasse Karstensen Date: Thu Mar 3 15:54:51 2016 +0100 Fix test case. diff --git a/lib/libvcc/vmodtool.py b/lib/libvcc/vmodtool.py index 1131631..fd4b370 100755 --- a/lib/libvcc/vmodtool.py +++ b/lib/libvcc/vmodtool.py @@ -843,7 +843,7 @@ class SimpleTestCase(unittest.TestCase): tmpfile = mktemp() bdir = dirname(realpath(__file__)) for inputfile in glob(join(bdir, "../libvmod_*/vmod.vcc")): - runmain(inputfile, outputprefix=tmpfile) + runmain(inputfile, ".", outputprefix=tmpfile) unlink(tmpfile + ".c") unlink(tmpfile + ".h") From lkarsten at varnish-software.com Thu Mar 3 15:53:22 2016 From: lkarsten at varnish-software.com (Lasse Karstensen) Date: Thu, 03 Mar 2016 16:53:22 +0100 Subject: [4.1] 0947220 Write overridden file name also in created file. Message-ID: commit 0947220bd2ca6860f84293c03a08a79a83021018 Author: Lasse Karstensen Date: Wed Mar 2 15:44:52 2016 +0100 Write overridden file name also in created file. This was forgotten in ecbdb32 and made the change moot. diff --git a/lib/libvcc/vmodtool.py b/lib/libvcc/vmodtool.py index fd4b370..9262850 100755 --- a/lib/libvcc/vmodtool.py +++ b/lib/libvcc/vmodtool.py @@ -928,7 +928,7 @@ def runmain(inputvcc, rstdir, outputprefix="vcc_if"): fc.write('#include "config.h"\n') fc.write('#include "vcl.h"\n') fc.write('#include "vrt.h"\n') - fc.write('#include "vcc_if.h"\n') + fc.write('#include "%s.h"\n' % outputprefix) fc.write('#include "vmod_abi.h"\n') fc.write('\n') From fgsch at lodoss.net Fri Mar 4 13:20:37 2016 From: fgsch at lodoss.net (Federico G. Schwindt) Date: Fri, 04 Mar 2016 14:20:37 +0100 Subject: [master] 7880261 Tidy up Message-ID: commit 7880261a87c678f6c9d4e027bc8bfce5acd434a5 Author: Federico G. Schwindt Date: Fri Mar 4 08:24:40 2016 +0000 Tidy up diff --git a/lib/libvcc/vmodtool.py b/lib/libvcc/vmodtool.py index 9262850..a042118 100755 --- a/lib/libvcc/vmodtool.py +++ b/lib/libvcc/vmodtool.py @@ -843,13 +843,13 @@ class SimpleTestCase(unittest.TestCase): tmpfile = mktemp() bdir = dirname(realpath(__file__)) for inputfile in glob(join(bdir, "../libvmod_*/vmod.vcc")): - runmain(inputfile, ".", outputprefix=tmpfile) + runmain(inputfile, ".", tmpfile) unlink(tmpfile + ".c") unlink(tmpfile + ".h") ####################################################################### -def runmain(inputvcc, rstdir, outputprefix="vcc_if"): +def runmain(inputvcc, rstdir, outputprefix): # Read the file in lines = [] with open(inputvcc, "r") as fp: @@ -959,11 +959,11 @@ if __name__ == "__main__": oparser = optparse.OptionParser(usage=usagetext) oparser.add_option('-N', '--strict', action='store_true', default=False, - help="Be strict when parsing input file. (vmod.vcc)") - oparser.add_option('-o', metavar="prefix", default='vcc_if', - help='Output file prefix. (default: "vcc_if")') + help="Be strict when parsing the input file") + oparser.add_option('-o', '--output', metavar="prefix", default='vcc_if', + help='Output file prefix (default: "vcc_if")') oparser.add_option('-w', '--rstdir', metavar="directory", default='.', - help='Where to save generated RST files. (default: ".")') + help='Where to save the generated RST files (default: ".")') oparser.add_option('', '--runtests', action='store_true', default=False, dest="runtests", help=optparse.SUPPRESS_HELP) (opts, args) = oparser.parse_args() @@ -986,4 +986,4 @@ if __name__ == "__main__": oparser.print_help() exit(-1) - runmain(i_vcc, opts.rstdir, outputprefix=opts.o) + runmain(i_vcc, opts.rstdir, opts.output) From fgsch at lodoss.net Fri Mar 4 13:20:37 2016 From: fgsch at lodoss.net (Federico G. Schwindt) Date: Fri, 04 Mar 2016 14:20:37 +0100 Subject: [master] fd39f38 Whitespace OCD Message-ID: commit fd39f38ee6c63b5a5a98cdbbb2edb82f1470c0c6 Author: Federico G. Schwindt Date: Fri Mar 4 08:27:07 2016 +0000 Whitespace OCD diff --git a/doc/sphinx/phk/firstdesign.rst b/doc/sphinx/phk/firstdesign.rst index 216101a..32f27b2 100644 --- a/doc/sphinx/phk/firstdesign.rst +++ b/doc/sphinx/phk/firstdesign.rst @@ -178,7 +178,7 @@ where we kept thinking in the old frame of reference (ie: Squid):: How long time after the expiry can we serve a cached copy of this document while we have reason to belive the backend can supply us with an update ? - + How long time after the expiry can we serve a cached copy of this document if the backend does not reply or is unreachable. @@ -521,7 +521,7 @@ Soon those two inspiratons collided:: statements: /* empty */ | statement | statements statement - + statement: if_statement | call_statement @@ -641,7 +641,7 @@ Soon those two inspiratons collided:: if (obj.size > 256k) { no-cache } else if (obj.size > 32k && obj.ttl < 2m) { - obj.tll = 5m + obj.tll = 5m } if (backend.response_time > 2.0s) { set ttl *= 2.0 @@ -682,7 +682,7 @@ Soon those two inspiratons collided:: object on the generation list, the purge object has been completed and will be removed. A log entry is written with number of compares and number of hits. - + ----------------------------------------------------------------------- Random notes @@ -836,7 +836,7 @@ Soon those two inspiratons collided:: Logfile processor -i shmemfile -e regexp - -o "/var/log/varnish.%Y%m%d.traffic" + -o "/var/log/varnish.%Y%m%d.traffic" -e regexp2 -n "/var/log/varnish.%Y%m%d.exception" (NCSA format) -e regexp3 @@ -1063,7 +1063,7 @@ A couple of days later the ideas had gel'ed:: if (obj.size > 256k) { no-cache } else if (obj.size > 32k && obj.ttl < 2m) { - obj.tll = 5m + obj.tll = 5m } if (backend.response_time > 2.0s) { set ttl *= 2.0 @@ -1104,7 +1104,7 @@ A couple of days later the ideas had gel'ed:: object on the generation list, the purge object has been completed and will be removed. A log entry is written with number of compares and number of hits. - + ----------------------------------------------------------------------- Random notes @@ -1258,7 +1258,7 @@ A couple of days later the ideas had gel'ed:: Logfile processor -i shmemfile -e regexp - -o "/var/log/varnish.%Y%m%d.traffic" + -o "/var/log/varnish.%Y%m%d.traffic" -e regexp2 -n "/var/log/varnish.%Y%m%d.exception" (NCSA format) -e regexp3 diff --git a/doc/sphinx/phk/thatslow.rst b/doc/sphinx/phk/thatslow.rst index c8c905a..7bfd76a 100644 --- a/doc/sphinx/phk/thatslow.rst +++ b/doc/sphinx/phk/thatslow.rst @@ -101,7 +101,7 @@ observation:: And eventually I no longer think about code lines as an asset to be accumulated, but rather as an expenditure to be avoided. -When I started Varnish, one of my main personal goals was to +When I started Varnish, one of my main personal goals was to make it my highest quality program - ever [#f4]_. This is why Varnish is written in "pidgin C" style and lousy with From fgsch at lodoss.net Fri Mar 4 13:20:37 2016 From: fgsch at lodoss.net (Federico G. Schwindt) Date: Fri, 04 Mar 2016 14:20:37 +0100 Subject: [master] 81d5d46 Truncate output if it's wider than 12 chars Message-ID: commit 81d5d4626690fdff586a7a40a89279d3deb9bb60 Author: Federico G. Schwindt Date: Fri Mar 4 09:00:47 2016 +0000 Truncate output if it's wider than 12 chars Early version of the patch OK'd by martin at . Fixes #1855. diff --git a/bin/varnishstat/varnishstat_curses.c b/bin/varnishstat/varnishstat_curses.c index 484d369..01c180c 100644 --- a/bin/varnishstat/varnishstat_curses.c +++ b/bin/varnishstat/varnishstat_curses.c @@ -65,6 +65,8 @@ #define COLW 14 #define COLW_NAME_MIN 24 +#define VALUE_MAX 999999999999 + struct ma { unsigned n, nmax; double acc; @@ -715,6 +717,17 @@ print_bytes(WINDOW *w, double val) } static void +print_trunc(WINDOW *w, uintmax_t val) +{ + if (val > VALUE_MAX) { + while (val > VALUE_MAX) + val /= 1000; + wprintw(w, " %9ju...", val); + } else + wprintw(w, " %12ju", val); +} + +static void draw_line_bytes(WINDOW *w, int y, int x, int X, struct pt *pt) { enum { @@ -740,7 +753,7 @@ draw_line_bytes(WINDOW *w, int y, int x, int X, struct pt *pt) if (scale && pt->cur > 1024) print_bytes(w, (double)pt->cur); else - wprintw(w, " %12ju", (uintmax_t)pt->cur); + print_trunc(w, (uintmax_t)pt->cur); break; case COL_CHG: if (pt->t_last) From lkarsten at varnish-software.com Fri Mar 4 14:53:47 2016 From: lkarsten at varnish-software.com (Lasse Karstensen) Date: Fri, 04 Mar 2016 15:53:47 +0100 Subject: [4.1] c502f53 Add VSB_destroy(). It's like VSB_delete() but it NULL's the pointer. Message-ID: commit c502f536077668e5a88a2383458ab829873c80e5 Author: Poul-Henning Kamp Date: Fri Feb 26 08:19:54 2016 +0000 Add VSB_destroy(). It's like VSB_delete() but it NULL's the pointer. diff --git a/include/vsb.h b/include/vsb.h index 4b34314..83fb602 100644 --- a/include/vsb.h +++ b/include/vsb.h @@ -75,6 +75,7 @@ int VSB_finish(struct vsb *); char *VSB_data(const struct vsb *); ssize_t VSB_len(const struct vsb *); void VSB_delete(struct vsb *); +void VSB_destroy(struct vsb **); #define VSB_QUOTE_NONL 1 void VSB_quote(struct vsb *s, const char *p, int len, int how); void VSB_indent(struct vsb *, int); diff --git a/lib/libvarnish/vsb.c b/lib/libvarnish/vsb.c index 4d80b8a..1f360d5 100644 --- a/lib/libvarnish/vsb.c +++ b/lib/libvarnish/vsb.c @@ -489,6 +489,13 @@ VSB_delete(struct vsb *s) SBFREE(s); } +void +VSB_destroy(struct vsb **s) +{ + VSB_delete(*s); + *s = NULL; +} + /* * Quote a string */ From lkarsten at varnish-software.com Fri Mar 4 14:53:47 2016 From: lkarsten at varnish-software.com (Lasse Karstensen) Date: Fri, 04 Mar 2016 15:53:47 +0100 Subject: [4.1] da8b1e2 Try to close one of the leaks reported in #1860 Message-ID: commit da8b1e2fd4afe935b5e9bdaf80df48ce07d7c7cb Author: Poul-Henning Kamp Date: Fri Feb 26 08:46:25 2016 +0000 Try to close one of the leaks reported in #1860 Conflicts: bin/varnishd/cache/cache_esi_parse.c diff --git a/bin/varnishd/cache/cache_esi_parse.c b/bin/varnishd/cache/cache_esi_parse.c index 383731f..5a22e77 100644 --- a/bin/varnishd/cache/cache_esi_parse.c +++ b/bin/varnishd/cache/cache_esi_parse.c @@ -453,13 +453,12 @@ vep_do_include(struct vep_state *vep, enum dowhat what) "ESI 1.0 " "has multiple src= attributes"); vep->state = VEP_TAGERROR; - VSB_delete(vep->attr_vsb); - VSB_delete(vep->include_src); - vep->attr_vsb = NULL; - vep->include_src = NULL; + VSB_destroy(&vep->attr_vsb); + VSB_destroy(&vep->include_src); return; } vep->include_src = vep->attr_vsb; + vep->attr_vsb = NULL; return; } assert(what == DO_TAG); @@ -499,8 +498,8 @@ vep_do_include(struct vep_state *vep, enum dowhat what) vep_warn(vep, "ESI 1.0 with https:// ignored"); vep->state = VEP_TAGERROR; - vep->attr_vsb = NULL; - vep->include_src = NULL; + AZ(vep->attr_vsb); + VSB_destroy(&vep->include_src); return; } vep_warn(vep, @@ -1081,6 +1080,8 @@ VEP_Finish(struct vep_state *vep) CHECK_OBJ_NOTNULL(vep, VEP_MAGIC); + AZ(vep->include_src); + AZ(vep->attr_vsb); if (vep->o_pending) vep_mark_common(vep, vep->ver_p, vep->last_mark); if (vep->o_wait > 0) { From lkarsten at varnish-software.com Fri Mar 4 14:53:47 2016 From: lkarsten at varnish-software.com (Lasse Karstensen) Date: Fri, 04 Mar 2016 15:53:47 +0100 Subject: [4.1] 36f80ab Always close the VFP stack, also on BS_NONE. Message-ID: commit 36f80ab5c2cb743c78d67c6e0771c3ff972568e2 Author: Poul-Henning Kamp Date: Fri Feb 26 17:13:42 2016 +0000 Always close the VFP stack, also on BS_NONE. Fixes: #1860 diff --git a/bin/varnishd/cache/cache_fetch.c b/bin/varnishd/cache/cache_fetch.c index 1800b71..1a05c8f 100644 --- a/bin/varnishd/cache/cache_fetch.c +++ b/bin/varnishd/cache/cache_fetch.c @@ -519,8 +519,6 @@ vbf_fetch_body_helper(struct busyobj *bo) } } while (vfps == VFP_OK); - VFP_Close(vfc); - if (vfps == VFP_ERROR) { AN(vfc->failed); (void)VFP_Error(vfc, "Fetch pipeline failed to process"); @@ -674,6 +672,8 @@ vbf_stp_fetch(struct worker *wrk, struct busyobj *bo) vbf_fetch_body_helper(bo); } + VFP_Close(bo->vfc); + if (bo->vfc->failed) { VDI_Finish(bo->wrk, bo); if (!bo->do_stream) { From lkarsten at varnish-software.com Fri Mar 4 14:53:47 2016 From: lkarsten at varnish-software.com (Lasse Karstensen) Date: Fri, 04 Mar 2016 15:53:47 +0100 Subject: [4.1] 8bb6fa3 Set prefix/mandir to /usr/local on FreeBSD Message-ID: commit 8bb6fa3adbad77630eb467f0d2959c4129385452 Author: Poul-Henning Kamp Date: Wed Mar 2 18:42:57 2016 +0000 Set prefix/mandir to /usr/local on FreeBSD diff --git a/autogen.des b/autogen.des index 45698f4..a562b06 100755 --- a/autogen.des +++ b/autogen.des @@ -12,6 +12,12 @@ if [ -f /usr/bin/clang -a "x${CC}" = "x" ] ; then export CC fi +if [ "x`uname -o`" = "xFreeBSD" ] ; then + DST="--prefix=/usr/local --mandir=/usr/local/man" +else + DST="--prefix=/opt/varnish --mandir=/opt/varnish/man" +fi + rm -f configure . ./autogen.sh 2>&1 | egrep -v "(subdir-objects|is in a subdirectory)" @@ -23,10 +29,9 @@ export CONFIG_SHELL=/bin/sh # NB: FreeBSD's make on -current # env MAKE=gmake \ ./configure \ + $DST \ --enable-developer-warnings \ --enable-debugging-symbols \ --enable-dependency-tracking \ --enable-tests \ - --prefix=/opt/varnish \ - --mandir=/opt/varnish/man \ "$@" From lkarsten at varnish-software.com Fri Mar 4 14:53:47 2016 From: lkarsten at varnish-software.com (Lasse Karstensen) Date: Fri, 04 Mar 2016 15:53:47 +0100 Subject: [4.1] 2afeaba Tidy up Message-ID: commit 2afeaba838fb4222c02d513031907626f2cc7237 Author: Federico G. Schwindt Date: Fri Mar 4 08:24:40 2016 +0000 Tidy up diff --git a/lib/libvcc/vmodtool.py b/lib/libvcc/vmodtool.py index 9262850..a042118 100755 --- a/lib/libvcc/vmodtool.py +++ b/lib/libvcc/vmodtool.py @@ -843,13 +843,13 @@ class SimpleTestCase(unittest.TestCase): tmpfile = mktemp() bdir = dirname(realpath(__file__)) for inputfile in glob(join(bdir, "../libvmod_*/vmod.vcc")): - runmain(inputfile, ".", outputprefix=tmpfile) + runmain(inputfile, ".", tmpfile) unlink(tmpfile + ".c") unlink(tmpfile + ".h") ####################################################################### -def runmain(inputvcc, rstdir, outputprefix="vcc_if"): +def runmain(inputvcc, rstdir, outputprefix): # Read the file in lines = [] with open(inputvcc, "r") as fp: @@ -959,11 +959,11 @@ if __name__ == "__main__": oparser = optparse.OptionParser(usage=usagetext) oparser.add_option('-N', '--strict', action='store_true', default=False, - help="Be strict when parsing input file. (vmod.vcc)") - oparser.add_option('-o', metavar="prefix", default='vcc_if', - help='Output file prefix. (default: "vcc_if")') + help="Be strict when parsing the input file") + oparser.add_option('-o', '--output', metavar="prefix", default='vcc_if', + help='Output file prefix (default: "vcc_if")') oparser.add_option('-w', '--rstdir', metavar="directory", default='.', - help='Where to save generated RST files. (default: ".")') + help='Where to save the generated RST files (default: ".")') oparser.add_option('', '--runtests', action='store_true', default=False, dest="runtests", help=optparse.SUPPRESS_HELP) (opts, args) = oparser.parse_args() @@ -986,4 +986,4 @@ if __name__ == "__main__": oparser.print_help() exit(-1) - runmain(i_vcc, opts.rstdir, outputprefix=opts.o) + runmain(i_vcc, opts.rstdir, opts.output) From lkarsten at varnish-software.com Fri Mar 4 15:13:54 2016 From: lkarsten at varnish-software.com (Lasse Karstensen) Date: Fri, 04 Mar 2016 16:13:54 +0100 Subject: [4.1] 0d7404e Prepare for 4.1.2 (final). Message-ID: commit 0d7404e06902a3ccb087adab1bd39760e2e7038e Author: Lasse Karstensen Date: Fri Mar 4 16:07:27 2016 +0100 Prepare for 4.1.2 (final). diff --git a/configure.ac b/configure.ac index ab17b65..bf0f773 100644 --- a/configure.ac +++ b/configure.ac @@ -2,7 +2,7 @@ AC_PREREQ(2.59) AC_COPYRIGHT([Copyright (c) 2006 Verdens Gang AS Copyright (c) 2006-2016 Varnish Software AS]) AC_REVISION([$Id$]) -AC_INIT([Varnish], [4.1.2-beta2], [varnish-dev at varnish-cache.org]) +AC_INIT([Varnish], [4.1.2], [varnish-dev at varnish-cache.org]) AC_CONFIG_SRCDIR(include/miniobj.h) AC_CONFIG_HEADERS([config.h]) AC_CONFIG_MACRO_DIR([m4]) diff --git a/doc/changes.rst b/doc/changes.rst index 54b877f..8c6c07a 100644 --- a/doc/changes.rst +++ b/doc/changes.rst @@ -1,4 +1,23 @@ + +================================ +Varnish Cache 4.1.2 (2016-03-04) +================================ + +* [vmods] vmodtool improvements for multiple vmods in a single directory. + +Bugs fixed +---------- + +* 1860_ - ESI-related memory leaks +* 1863_ - Don't reset the oc->ban pointer from BAN_CheckObject +* 1864_ - Avoid panic if the lurker is working on a ban to be checked. + +.. _1860: https://www.varnish-cache.org/trac/ticket/1860 +.. _1863: https://www.varnish-cache.org/trac/ticket/1863 +.. _1864: https://www.varnish-cache.org/trac/ticket/1864 + + ====================================== Varnish Cache 4.1.2-beta2 (2016-02-25) ====================================== From daghf at varnish-software.com Tue Mar 8 18:28:56 2016 From: daghf at varnish-software.com (Dag Haavi Finstad) Date: Tue, 08 Mar 2016 19:28:56 +0100 Subject: [master] e4e4e21 Revive the backend_conn counter Message-ID: commit e4e4e219b02b818d9ae4ed6027cb78fde558b285 Author: Dag Haavi Finstad Date: Tue Mar 8 19:27:36 2016 +0100 Revive the backend_conn counter Discussed with Federico. Fixes: #1725 diff --git a/bin/varnishd/cache/cache_backend_tcp.c b/bin/varnishd/cache/cache_backend_tcp.c index 8ad54e3..1a3ca73 100644 --- a/bin/varnishd/cache/cache_backend_tcp.c +++ b/bin/varnishd/cache/cache_backend_tcp.c @@ -382,7 +382,9 @@ VBT_Get(struct tcp_pool *tp, double tmo, const struct backend *be, Lck_Lock(&tp->mtx); tp->n_used--; // Nope, didn't work after all. Lck_Unlock(&tp->mtx); - } + } else + VSC_C_main->backend_conn++; + return (vbc); } From fgsch at lodoss.net Tue Mar 8 18:54:14 2016 From: fgsch at lodoss.net (Federico G. Schwindt) Date: Tue, 08 Mar 2016 19:54:14 +0100 Subject: [master] 2725865 Minor cosmetics Message-ID: commit 27258654827e8c94bf4928c8dfcb07e9b9dbf566 Author: Federico G. Schwindt Date: Tue Mar 8 18:44:16 2016 +0000 Minor cosmetics diff --git a/bin/varnishd/cache/cache_backend_tcp.c b/bin/varnishd/cache/cache_backend_tcp.c index 1a3ca73..b43bf3c 100644 --- a/bin/varnishd/cache/cache_backend_tcp.c +++ b/bin/varnishd/cache/cache_backend_tcp.c @@ -231,7 +231,7 @@ VBT_Open(const struct tcp_pool *tp, double tmo, const struct suckaddr **sa) *sa = tp->ip6; s = VTCP_connect(tp->ip6, msec); if (s >= 0) - return(s); + return (s); } *sa = tp->ip4; s = VTCP_connect(tp->ip4, msec); @@ -239,7 +239,7 @@ VBT_Open(const struct tcp_pool *tp, double tmo, const struct suckaddr **sa) *sa = tp->ip6; s = VTCP_connect(tp->ip6, msec); } - return(s); + return (s); } /*-------------------------------------------------------------------- @@ -360,7 +360,7 @@ VBT_Get(struct tcp_pool *tp, double tmo, const struct backend *be, VTAILQ_REMOVE(&tp->connlist, vbc, list); VTAILQ_INSERT_TAIL(&tp->connlist, vbc, list); tp->n_conn--; - VSC_C_main->backend_reuse += 1; + VSC_C_main->backend_reuse++; vbc->state = VBC_STATE_STOLEN; vbc->cond = &wrk->cond; } @@ -376,9 +376,8 @@ VBT_Get(struct tcp_pool *tp, double tmo, const struct backend *be, vbc->state = VBC_STATE_USED; vbc->tcp_pool = tp; vbc->fd = VBT_Open(tp, tmo, &vbc->addr); - if (vbc->fd < 0) + if (vbc->fd < 0) { FREE_OBJ(vbc); - if (vbc == NULL) { Lck_Lock(&tp->mtx); tp->n_used--; // Nope, didn't work after all. Lck_Unlock(&tp->mtx); From lkarsten at varnish-software.com Thu Mar 10 10:20:03 2016 From: lkarsten at varnish-software.com (Lasse Karstensen) Date: Thu, 10 Mar 2016 11:20:03 +0100 Subject: [master] b4845b2 Make it more easily readable on Github. Message-ID: commit b4845b24a853acf937c2d439adb603de327b8706 Author: Lasse Karstensen Date: Thu Mar 10 11:16:26 2016 +0100 Make it more easily readable on Github. (But mostly for testing the commit email system.) diff --git a/README b/README deleted file mode 100644 index 3ce0b45..0000000 --- a/README +++ /dev/null @@ -1,12 +0,0 @@ -This is Varnish Cache, the high-performance HTTP accelerator. - -Documentation and additional information about Varnish is available on -https://www.varnish-cache.org/ - -Technical questions about Varnish and this release should be addressed -to . Please see -https://www.varnish-cache.org/trac/wiki/Contributing for how to -contribute patches and report bugs. - -Questions about commercial support and services related to Varnish -should be addressed to . diff --git a/README.rst b/README.rst new file mode 100644 index 0000000..309edc9 --- /dev/null +++ b/README.rst @@ -0,0 +1,15 @@ +Varnish Cache +============= + +This is Varnish Cache, the high-performance HTTP accelerator. + +Documentation and additional information about Varnish is available on +https://www.varnish-cache.org/ + +Technical questions about Varnish and this release should be addressed +to . Please see +https://www.varnish-cache.org/trac/wiki/Contributing for how to +contribute patches and report bugs. + +Questions about commercial support and services related to Varnish +should be addressed to . From lkarsten at varnish-software.com Thu Mar 10 10:21:04 2016 From: lkarsten at varnish-software.com (Lasse Karstensen) Date: Thu, 10 Mar 2016 11:21:04 +0100 Subject: [refs/remotes/local/master] b4845b2 Make it more easily readable on Github. Message-ID: commit b4845b24a853acf937c2d439adb603de327b8706 Author: Lasse Karstensen Date: Thu Mar 10 11:16:26 2016 +0100 Make it more easily readable on Github. (But mostly for testing the commit email system.) diff --git a/README b/README deleted file mode 100644 index 3ce0b45..0000000 --- a/README +++ /dev/null @@ -1,12 +0,0 @@ -This is Varnish Cache, the high-performance HTTP accelerator. - -Documentation and additional information about Varnish is available on -https://www.varnish-cache.org/ - -Technical questions about Varnish and this release should be addressed -to . Please see -https://www.varnish-cache.org/trac/wiki/Contributing for how to -contribute patches and report bugs. - -Questions about commercial support and services related to Varnish -should be addressed to . diff --git a/README.rst b/README.rst new file mode 100644 index 0000000..309edc9 --- /dev/null +++ b/README.rst @@ -0,0 +1,15 @@ +Varnish Cache +============= + +This is Varnish Cache, the high-performance HTTP accelerator. + +Documentation and additional information about Varnish is available on +https://www.varnish-cache.org/ + +Technical questions about Varnish and this release should be addressed +to . Please see +https://www.varnish-cache.org/trac/wiki/Contributing for how to +contribute patches and report bugs. + +Questions about commercial support and services related to Varnish +should be addressed to . From lkarsten at varnish-software.com Thu Mar 10 10:45:04 2016 From: lkarsten at varnish-software.com (Lasse Karstensen) Date: Thu, 10 Mar 2016 11:45:04 +0100 Subject: [master] d3cc285 Update copyright. Message-ID: commit d3cc285cf2eda9a5df58b3b0788a7b628defaa41 Author: Lasse Karstensen Date: Thu Mar 10 11:43:34 2016 +0100 Update copyright. (and test the commit email hook) diff --git a/configure.ac b/configure.ac index be1ea74..edba56a 100644 --- a/configure.ac +++ b/configure.ac @@ -1,6 +1,6 @@ AC_PREREQ(2.59) AC_COPYRIGHT([Copyright (c) 2006 Verdens Gang AS -Copyright (c) 2006-2015 Varnish Software AS]) +Copyright (c) 2006-2016 Varnish Software]) AC_REVISION([$Id$]) AC_INIT([Varnish], [trunk], [varnish-dev at varnish-cache.org]) AC_CONFIG_SRCDIR(include/miniobj.h) From martin at varnish-software.com Thu Mar 10 11:01:08 2016 From: martin at varnish-software.com (Martin Blix Grydeland) Date: Thu, 10 Mar 2016 12:01:08 +0100 Subject: [master] 98340a5 Clarified the documentation on vsm_overflow[ed] Message-ID: commit 98340a5fb010d29bdbd47c479f964c25a1cdd714 Author: P?l Hermunn Johansen Date: Wed Mar 9 16:38:29 2016 +0100 Clarified the documentation on vsm_overflow[ed] In most circumstances the counters vsm_overflow and vsm_overflowed should be zero. This patch tells the user what he should probably do when they are not. diff --git a/include/tbl/vsc_f_main.h b/include/tbl/vsc_f_main.h index 1a01341..4fdd691 100644 --- a/include/tbl/vsc_f_main.h +++ b/include/tbl/vsc_f_main.h @@ -625,6 +625,8 @@ VSC_F(vsm_overflow, uint64_t, 0, 'g', 'B', diag, "Number of bytes which does not fit" " in the shared memory used to communicate" " with tools like varnishstat, varnishlog etc." + " If this counter is not zero, consider" + " increasing the runtime variable vsm_space." ) VSC_F(vsm_overflowed, uint64_t, 0, 'c', 'B', diag, @@ -632,4 +634,6 @@ VSC_F(vsm_overflowed, uint64_t, 0, 'c', 'B', diag, "Total number of bytes which did not fit" " in the shared memory used to communicate" " with tools like varnishstat, varnishlog etc." + " If this counter is not zero, consider" + " increasing the runtime variable vsm_space." ) From guillaume at varnish-software.com Thu Mar 10 12:11:03 2016 From: guillaume at varnish-software.com (Guillaume Quintard) Date: Thu, 10 Mar 2016 13:11:03 +0100 Subject: [master] b003cb2 Invert desc/explanation in varnish-counters.7 Message-ID: commit b003cb2f3c733457ead2551b1598ccfbb77d59cf Author: Guillaume Quintard Date: Wed Mar 9 15:57:16 2016 +0100 Invert desc/explanation in varnish-counters.7 Spotted by: hermunn diff --git a/bin/varnishstat/vsc2rst.c b/bin/varnishstat/vsc2rst.c index 3358db4..2aaa16d 100644 --- a/bin/varnishstat/vsc2rst.c +++ b/bin/varnishstat/vsc2rst.c @@ -41,7 +41,7 @@ #define VSC_LEVEL_F(v,l,e,d) \ printf("%s ? %s\n\t%s\n\n", l, e, d); #define VSC_F(n, t, l, s, f, v, d, e) \ - printf("%s ? %s (%s)\n\t%s\n\n", #n, e, VSC_level_##v, d); + printf("%s ? %s (%s)\n\t%s\n\n", #n, d, VSC_level_##v, e); int main(int argc, char **argv) { From lkarsten at varnish-software.com Thu Mar 10 12:12:03 2016 From: lkarsten at varnish-software.com (Lasse Karstensen) Date: Thu, 10 Mar 2016 13:12:03 +0100 Subject: [master] c1ae9a9 Update instructions on port change with systemd. Message-ID: commit c1ae9a9e9b49911ce07ca1428aca2cec4fd470f7 Author: Lasse Karstensen Date: Thu Mar 10 13:09:44 2016 +0100 Update instructions on port change with systemd. As suggested by Przemek Sobstel on github. diff --git a/doc/sphinx/tutorial/putting_varnish_on_port_80.rst b/doc/sphinx/tutorial/putting_varnish_on_port_80.rst index 3e57917..16d38bc 100644 --- a/doc/sphinx/tutorial/putting_varnish_on_port_80.rst +++ b/doc/sphinx/tutorial/putting_varnish_on_port_80.rst @@ -9,10 +9,10 @@ First we stop varnish: ``service varnish stop`` Now we need to edit the configuration file that starts Varnish. -Debian/Ubuntu -~~~~~~~~~~~~~ +Debian/Ubuntu (legacy) +~~~~~~~~~~~~~~~~~~~~~~ -On Debian/Ubuntu this is `/etc/default/varnish`. In the file you'll find +On older Debian/Ubuntu this is `/etc/default/varnish`. In the file you'll find some text that looks like this:: DAEMON_OPTS="-a :6081 \ @@ -29,6 +29,26 @@ Change it to:: -S /etc/varnish/secret \ -s malloc,256m" +Debian (v8+) / Ubuntu (v15.04+) +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +On more recent Debian and Ubuntu systems this is configured in the systemd +service file. + +Applying changes to the default service is best done by creating a new file +`/etc/systemd/system/varnish.service.d/customexec.conf`:: + + [Service] + ExecStart= + ExecStart=/usr/sbin/varnishd -a :80 -T localhost:6082 -f /etc/varnish/default.vcl -S /etc/varnish/secret -s malloc,256m + +This will override the ExecStart part of the default configuration shipped +with Varnish Cache. + +Run ``systemctl daemon-reload`` to make sure systemd picks up the new +configuration before restarting Varnish. + + Red Hat Enterprise Linux / CentOS ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ @@ -42,4 +62,3 @@ Restarting Varnish again Once the change is done, restart Varnish: ``service varnish start``. Now everyone accessing your site will be accessing through Varnish. - From nils.goroll at uplex.de Thu Mar 10 14:02:03 2016 From: nils.goroll at uplex.de (Nils Goroll) Date: Thu, 10 Mar 2016 15:02:03 +0100 Subject: [master] 960e7eb add pdf and svg output to the distribution Message-ID: commit 960e7ebc4a5ad53ded9706e8dd8c9ed9d81b75a2 Author: Nils Goroll Date: Thu Mar 10 14:58:52 2016 +0100 add pdf and svg output to the distribution to remove the dependency on graphviz when building from a tarball diff --git a/doc/graphviz/Makefile.am b/doc/graphviz/Makefile.am index acbe4fe..772bfb3 100644 --- a/doc/graphviz/Makefile.am +++ b/doc/graphviz/Makefile.am @@ -20,9 +20,10 @@ dist-hook: # this is a4, letter is 8.5,11 SIZE = 8.4,11.7 -EXTRA_DIST = $(srcdir)/*.dot +EXTRA_DIST = $(srcdir)/*.dot \ + $(PDFS) \ + $(SVGS) -if HAVE_DOT PDFS = \ cache_http1_fsm.pdf \ cache_req_fsm.pdf \ @@ -33,33 +34,43 @@ SVGS = \ cache_req_fsm.svg \ cache_fetch.svg +if HAVE_DOT CLEANFILES = \ $(PDFS) \ $(SVGS) endif pdf: $(PDFS) + +html: $(SVGS) link_srcdir + +# XXX does not fit onto a4 unless in landscape +cache_fetch.pdf: cache_fetch.dot if ! HAVE_DOT @echo ================================================== @echo You need graphviz installed to generate pdf output @echo ================================================== @false +else + @DOT@ -Tpdf -Gsize=$(SIZE) -Grotate=90 $< >$@ endif -html: $(SVGS) link_srcdir +%.pdf: %.dot if ! HAVE_DOT - @echo =================================================== - @echo You need graphviz installed to generate html output - @echo =================================================== + @echo ================================================== + @echo You need graphviz installed to generate pdf output + @echo ================================================== @false -endif - -# XXX does not fit onto a4 unless in landscape -cache_fetch.pdf: cache_fetch.dot - @DOT@ -Tpdf -Gsize=$(SIZE) -Grotate=90 $< >$@ - -%.pdf: %.dot +else @DOT@ -Tpdf -Gsize=$(SIZE) $< >$@ +endif %.svg: %.dot +if ! HAVE_DOT + @echo =================================================== + @echo You need graphviz installed to generate svg output + @echo =================================================== + @false +else @DOT@ -Tsvg $< >$@ +endif From nils.goroll at uplex.de Thu Mar 10 14:56:04 2016 From: nils.goroll at uplex.de (Nils Goroll) Date: Thu, 10 Mar 2016 15:56:04 +0100 Subject: [master] dc5b681 add svgs to make phk happy Message-ID: commit dc5b681e95803c078117ab7fb428f71387a46fed Author: Nils Goroll Date: Thu Mar 10 15:51:58 2016 +0100 add svgs to make phk happy This really is the wrong way to go, generated files should not live in the source tree. But lightening the load of phk is more important. diff --git a/doc/graphviz/cache_fetch.svg b/doc/graphviz/cache_fetch.svg new file mode 100644 index 0000000..ecd062a --- /dev/null +++ b/doc/graphviz/cache_fetch.svg @@ -0,0 +1,240 @@ + + + + + + +cache_fetch + +cluster_backend + + + +RETRY +RETRY + + +v_b_f + +vbf_stp_startfetch: + +vcl_backend_fetch{} + +bereq.* + +abandon + +fetch + + +RETRY->v_b_f + + + + +v_b_f_BGFETCH + +BGFETCH + + +v_b_f_BGFETCH->v_b_f + + + + +v_b_f_FETCH + +FETCH + + +v_b_f_FETCH->v_b_f + + + + +v_b_f_FETCH->v_b_f + + + + +v_b_hdrs + +send bereq, +read beresp (headers) + + +v_b_f:fetch:s->v_b_hdrs + + + + +v_b_r + +vbf_stp_startfetch: + +vcl_backend_response{} + +bereq.* + +beresp.* + +retry + +max? + +ok? + +abandon + +deliver + +304? + +other? + + +v_b_hdrs->v_b_r + + + + +v_b_e + +vbf_stp_error: + +vcl_backend_error{} + +bereq.* + +beresp.* + +retry + +max? + +ok? + +abandon + +deliver + + +v_b_hdrs->v_b_e + + + + +v_b_r:max->v_b_e + + + + +v_b_r_retry +RETRY + + +v_b_r:retry->v_b_r_retry + + + + +vbf_stp_condfetch + +vbf_stp_condfetch: + +copy obj attr + +steal body + +fetch_fail? + +ok? + + +v_b_r:fetch_304:s->vbf_stp_condfetch + + + + +vbf_stp_fetch + +vbf_stp_fetch: + +setup VFPs + +fetch + +fetch_fail? + +error? + +ok? + + +v_b_r:non_304:s->vbf_stp_fetch + + + + +FETCH_DONE + +FETCH_DONE + + +v_b_e:deliver->FETCH_DONE + + +"backend synth" + + +FETCH_FAIL + +FETCH_FAIL + + +v_b_e:max:s->FETCH_FAIL + + + + +v_b_e_retry +RETRY + + +v_b_e:retry->v_b_e_retry + + + + +vbf_stp_condfetch:ok:s->FETCH_DONE + + + + +vbf_stp_fetch:ok:s->FETCH_DONE + + + + +error +error + + +error->FETCH_FAIL + + + + +abandon +abandon + + +abandon->FETCH_FAIL + + + + + diff --git a/doc/graphviz/cache_http1_fsm.svg b/doc/graphviz/cache_http1_fsm.svg new file mode 100644 index 0000000..65617c7 --- /dev/null +++ b/doc/graphviz/cache_http1_fsm.svg @@ -0,0 +1,128 @@ + + + + + + +vcl_center + + +acceptor + +acceptor + + +http1_wait + +http1_wait + + +acceptor->http1_wait + + +S_STP_NEWREQ + + +CNT_Request + +CNT_Request + + +http1_wait->CNT_Request + + +S_STP_WORKING +R_STP_RECV + + +disembark + +disembark + + +http1_wait->disembark + + +Session close + + +http1_wait->disembark + + +Timeout + + +hash + +hash + + +hash->CNT_Request + + +Busy object +S_STP_WORKING +R_STP_LOOKUP + + +CNT_Request->disembark + + +Busy object +S_STP_WORKING +R_STP_LOOKUP + + +http1_cleanup + +http1_cleanup + + +CNT_Request->http1_cleanup + + + + +disembark->hash + + + + +waiter + +waiter + + +disembark->waiter + + + + +waiter->http1_wait + + + + +http1_cleanup->http1_wait + + +S_STP_NEWREQ + + +http1_cleanup->CNT_Request + + +S_STP_WORKING +R_STP_RECV + + +http1_cleanup->disembark + + +Session close + + + diff --git a/doc/graphviz/cache_req_fsm.svg b/doc/graphviz/cache_req_fsm.svg new file mode 100644 index 0000000..d9976c3 --- /dev/null +++ b/doc/graphviz/cache_req_fsm.svg @@ -0,0 +1,438 @@ + + + + + + +cache_req_fsm + +cluster_backend + + + +acceptor + +Request received + + +recv + +cnt_recv: + +vcl_recv{} + +req.* + +hash + +purge + +pass + +pipe + +synth + + +acceptor->recv + + + + +ESI_REQ + +ESI_REQ + + +ESI_REQ->recv + + + + +RESTART +RESTART + + +restart + +cnt_restart: + +ok? + +max_restarts? + + +RESTART->restart + + + + +pass + +cnt_pass: + +vcl_pass{} + +req.* + +fetch + +synth + +restart + + +recv:pass->pass + + + + +pipe + +cnt_pipe: + +filter req.*->bereq.* + +vcl_pipe{} + +req.* + +bereq.* + +pipe + +synth + + +recv:pipe->pipe + + + + +hash + +cnt_recv: + +vcl_hash{} + +req.* + +lookup + + +recv:hash->hash + + + + +recv:purge:s->hash + + + + +SYNTH +SYNTH + + +synth + +cnt_synth: + +vcl_synth{} + +req.* + +resp.* + +deliver + +restart + + +SYNTH->synth + + + + +deliver + +cnt_deliver: + +Filter obj.->resp. + +vcl_deliver{} + +req.* + +resp.* + +restart + +deliver + +synth + + +V1D_Deliver + +V1D_Deliver + + +deliver:deliver:s->V1D_Deliver + + + + +deliver:deliver:s->V1D_Deliver + + + + +deliver:deliver:s->V1D_Deliver + + + + +DONE + +DONE + + +V1D_Deliver->DONE + + + + +stream + +stream? +body + + +stream->V1D_Deliver + + + + +synth:del:s->V1D_Deliver + + + + +see backend graph +see backend graph + + +BGFETCH + +BGFETCH + + +FETCH + +FETCH + + +FETCH_DONE + +FETCH_DONE + + +FETCH->FETCH_DONE + + + + +FETCH_FAIL + +FETCH_FAIL + + +FETCH->FETCH_FAIL + + + + +FETCH_DONE->deliver + + + + +FETCH_DONE->deliver + + + + +FETCH_FAIL->synth + + + + +lookup2 + +cnt_lookup: + +vcl_hit{} + +req.* + +obj.* + +deliver + +miss + +restart + +synth + +pass + + +lookup2:deliver:s->deliver:n + + + + +lookup2:deliver:s->BGFETCH + + +parallel +if obj expired + + +miss + +cnt_miss: + +vcl_miss{} + +req.* + +fetch + +synth + +restart + +pass + + +lookup2:miss:s->miss + + + + +lookup2:pass:s->pass + + + + +lookup + +cnt_lookup: + +hash lookup + +hit? + +miss? + +hit-for-pass? + +busy? + + +lookup:h:s->lookup2 + + + + +lookup:busy:e->lookup:top:e + + +(waitinglist) + + +lookup:miss:s->miss + + + + +lookup:hfp:s->pass + + + + +miss:fetch:s->FETCH + + + + +miss:pass:s->pass + + + + +pass:fetch:s->FETCH + + + + +pipe_do + +send bereq, +copy bytes until close + + +pipe:pipe->pipe_do + + + + +pipe_do->DONE + + + + +restart:ok:s->recv + + + + +err_restart +SYNTH + + +restart:max:s->err_restart + + + + +hash:lookup:w->lookup + + + + +purge + +cnt_purge: + +vcl_purge{} + +req.* + +synth + +restart + + +hash:lookup:s->purge:top:n + + + + + From martin at varnish-software.com Thu Mar 10 16:47:04 2016 From: martin at varnish-software.com (Martin Blix Grydeland) Date: Thu, 10 Mar 2016 17:47:04 +0100 Subject: [4.0] f4b2cb9 Remove assert in shared memory Message-ID: commit f4b2cb9c29052bab1b55afb53555ee2e46732229 Author: P?l Hermunn Johansen Date: Tue Mar 8 16:14:08 2016 +0100 Remove assert in shared memory Even though the shared memory log should always have only one writer, the varnish process, this is not enforced by the kernel through access rights. For this reason, the line assert(b->vsc->vcls > 0); could crash Varnish if a process decided to write to the shared memory log. Now this bad behavior will just affect other readers of the shared memory log, and not the varnish process itself. diff --git a/bin/varnishd/cache/cache_backend_cfg.c b/bin/varnishd/cache/cache_backend_cfg.c index 5b122d0..7173dd4 100644 --- a/bin/varnishd/cache/cache_backend_cfg.c +++ b/bin/varnishd/cache/cache_backend_cfg.c @@ -138,7 +138,6 @@ VBE_DropRefVcl(struct backend *b) ASSERT_CLI(); Lck_Lock(&b->mtx); - assert(b->vsc->vcls > 0); b->vsc->vcls--; VBE_DropRefLocked(b, NULL); } From phk at FreeBSD.org Thu Mar 10 23:18:04 2016 From: phk at FreeBSD.org (Poul-Henning Kamp) Date: Fri, 11 Mar 2016 00:18:04 +0100 Subject: [master] dc92d4a Update copyright year (and test commit-hook) Message-ID: commit dc92d4a69580988423fdf1dada60ce03bfc9e3c1 Author: Poul-Henning Kamp Date: Thu Mar 10 23:17:23 2016 +0000 Update copyright year (and test commit-hook) diff --git a/bin/varnishd/cache/cache_obj.c b/bin/varnishd/cache/cache_obj.c index b4201cb..37ed6f5 100644 --- a/bin/varnishd/cache/cache_obj.c +++ b/bin/varnishd/cache/cache_obj.c @@ -1,5 +1,5 @@ /*- - * Copyright (c) 2013-2015 Varnish Software AS + * Copyright (c) 2013-2016 Varnish Software AS * All rights reserved. * * Author: Poul-Henning Kamp diff --git a/bin/varnishd/cache/cache_obj.h b/bin/varnishd/cache/cache_obj.h index 3d8e245..007d32f 100644 --- a/bin/varnishd/cache/cache_obj.h +++ b/bin/varnishd/cache/cache_obj.h @@ -1,6 +1,5 @@ /*- - * Copyright (c) 2006 Verdens Gang AS - * Copyright (c) 2006-2011 Varnish Software AS + * Copyright (c) 2015-2016 Varnish Software AS * All rights reserved. * * Author: Poul-Henning Kamp From fgsch at lodoss.net Fri Mar 11 09:00:05 2016 From: fgsch at lodoss.net (Federico G. Schwindt) Date: Fri, 11 Mar 2016 10:00:05 +0100 Subject: [master] 60ea793 First stab at an issue template Message-ID: commit 60ea7930807ac41249a348d30016bd6a870c54f0 Author: Federico G. Schwindt Date: Fri Mar 11 08:58:05 2016 +0000 First stab at an issue template Generated using https://www.talater.com/open-source-templates/. diff --git a/.github/ISSUE_TEMPLATE.md b/.github/ISSUE_TEMPLATE.md new file mode 100644 index 0000000..e17ab32 --- /dev/null +++ b/.github/ISSUE_TEMPLATE.md @@ -0,0 +1,30 @@ + + +## Expected Behavior + + + +## Current Behavior + + + +## Possible Solution + + + +## Steps to Reproduce (for bugs) + + +1. +2. +3. +4. + +## Context + + + +## Your Environment + +* Version used: +* Operating System and version: From fgsch at lodoss.net Fri Mar 11 12:49:03 2016 From: fgsch at lodoss.net (Federico G. Schwindt) Date: Fri, 11 Mar 2016 13:49:03 +0100 Subject: [4.1] 10139ff add pdf and svg output to the distribution Message-ID: commit 10139ff7735b7573bdcb95a3b79a1d7040cb2d9e Author: Nils Goroll Date: Thu Mar 10 14:58:52 2016 +0100 add pdf and svg output to the distribution to remove the dependency on graphviz when building from a tarball diff --git a/doc/graphviz/Makefile.am b/doc/graphviz/Makefile.am index acbe4fe..772bfb3 100644 --- a/doc/graphviz/Makefile.am +++ b/doc/graphviz/Makefile.am @@ -20,9 +20,10 @@ dist-hook: # this is a4, letter is 8.5,11 SIZE = 8.4,11.7 -EXTRA_DIST = $(srcdir)/*.dot +EXTRA_DIST = $(srcdir)/*.dot \ + $(PDFS) \ + $(SVGS) -if HAVE_DOT PDFS = \ cache_http1_fsm.pdf \ cache_req_fsm.pdf \ @@ -33,33 +34,43 @@ SVGS = \ cache_req_fsm.svg \ cache_fetch.svg +if HAVE_DOT CLEANFILES = \ $(PDFS) \ $(SVGS) endif pdf: $(PDFS) + +html: $(SVGS) link_srcdir + +# XXX does not fit onto a4 unless in landscape +cache_fetch.pdf: cache_fetch.dot if ! HAVE_DOT @echo ================================================== @echo You need graphviz installed to generate pdf output @echo ================================================== @false +else + @DOT@ -Tpdf -Gsize=$(SIZE) -Grotate=90 $< >$@ endif -html: $(SVGS) link_srcdir +%.pdf: %.dot if ! HAVE_DOT - @echo =================================================== - @echo You need graphviz installed to generate html output - @echo =================================================== + @echo ================================================== + @echo You need graphviz installed to generate pdf output + @echo ================================================== @false -endif - -# XXX does not fit onto a4 unless in landscape -cache_fetch.pdf: cache_fetch.dot - @DOT@ -Tpdf -Gsize=$(SIZE) -Grotate=90 $< >$@ - -%.pdf: %.dot +else @DOT@ -Tpdf -Gsize=$(SIZE) $< >$@ +endif %.svg: %.dot +if ! HAVE_DOT + @echo =================================================== + @echo You need graphviz installed to generate svg output + @echo =================================================== + @false +else @DOT@ -Tsvg $< >$@ +endif From fgsch at lodoss.net Fri Mar 11 13:19:03 2016 From: fgsch at lodoss.net (Federico G. Schwindt) Date: Fri, 11 Mar 2016 14:19:03 +0100 Subject: [4.1] 896ef96 add svgs to make phk happy Message-ID: commit 896ef96d71f8dee4eccd4231da4c723897fab0a1 Author: Nils Goroll Date: Thu Mar 10 15:51:58 2016 +0100 add svgs to make phk happy This really is the wrong way to go, generated files should not live in the source tree. But lightening the load of phk is more important. diff --git a/doc/graphviz/cache_fetch.svg b/doc/graphviz/cache_fetch.svg new file mode 100644 index 0000000..ecd062a --- /dev/null +++ b/doc/graphviz/cache_fetch.svg @@ -0,0 +1,240 @@ + + + + + + +cache_fetch + +cluster_backend + + + +RETRY +RETRY + + +v_b_f + +vbf_stp_startfetch: + +vcl_backend_fetch{} + +bereq.* + +abandon + +fetch + + +RETRY->v_b_f + + + + +v_b_f_BGFETCH + +BGFETCH + + +v_b_f_BGFETCH->v_b_f + + + + +v_b_f_FETCH + +FETCH + + +v_b_f_FETCH->v_b_f + + + + +v_b_f_FETCH->v_b_f + + + + +v_b_hdrs + +send bereq, +read beresp (headers) + + +v_b_f:fetch:s->v_b_hdrs + + + + +v_b_r + +vbf_stp_startfetch: + +vcl_backend_response{} + +bereq.* + +beresp.* + +retry + +max? + +ok? + +abandon + +deliver + +304? + +other? + + +v_b_hdrs->v_b_r + + + + +v_b_e + +vbf_stp_error: + +vcl_backend_error{} + +bereq.* + +beresp.* + +retry + +max? + +ok? + +abandon + +deliver + + +v_b_hdrs->v_b_e + + + + +v_b_r:max->v_b_e + + + + +v_b_r_retry +RETRY + + +v_b_r:retry->v_b_r_retry + + + + +vbf_stp_condfetch + +vbf_stp_condfetch: + +copy obj attr + +steal body + +fetch_fail? + +ok? + + +v_b_r:fetch_304:s->vbf_stp_condfetch + + + + +vbf_stp_fetch + +vbf_stp_fetch: + +setup VFPs + +fetch + +fetch_fail? + +error? + +ok? + + +v_b_r:non_304:s->vbf_stp_fetch + + + + +FETCH_DONE + +FETCH_DONE + + +v_b_e:deliver->FETCH_DONE + + +"backend synth" + + +FETCH_FAIL + +FETCH_FAIL + + +v_b_e:max:s->FETCH_FAIL + + + + +v_b_e_retry +RETRY + + +v_b_e:retry->v_b_e_retry + + + + +vbf_stp_condfetch:ok:s->FETCH_DONE + + + + +vbf_stp_fetch:ok:s->FETCH_DONE + + + + +error +error + + +error->FETCH_FAIL + + + + +abandon +abandon + + +abandon->FETCH_FAIL + + + + + diff --git a/doc/graphviz/cache_http1_fsm.svg b/doc/graphviz/cache_http1_fsm.svg new file mode 100644 index 0000000..65617c7 --- /dev/null +++ b/doc/graphviz/cache_http1_fsm.svg @@ -0,0 +1,128 @@ + + + + + + +vcl_center + + +acceptor + +acceptor + + +http1_wait + +http1_wait + + +acceptor->http1_wait + + +S_STP_NEWREQ + + +CNT_Request + +CNT_Request + + +http1_wait->CNT_Request + + +S_STP_WORKING +R_STP_RECV + + +disembark + +disembark + + +http1_wait->disembark + + +Session close + + +http1_wait->disembark + + +Timeout + + +hash + +hash + + +hash->CNT_Request + + +Busy object +S_STP_WORKING +R_STP_LOOKUP + + +CNT_Request->disembark + + +Busy object +S_STP_WORKING +R_STP_LOOKUP + + +http1_cleanup + +http1_cleanup + + +CNT_Request->http1_cleanup + + + + +disembark->hash + + + + +waiter + +waiter + + +disembark->waiter + + + + +waiter->http1_wait + + + + +http1_cleanup->http1_wait + + +S_STP_NEWREQ + + +http1_cleanup->CNT_Request + + +S_STP_WORKING +R_STP_RECV + + +http1_cleanup->disembark + + +Session close + + + diff --git a/doc/graphviz/cache_req_fsm.svg b/doc/graphviz/cache_req_fsm.svg new file mode 100644 index 0000000..d9976c3 --- /dev/null +++ b/doc/graphviz/cache_req_fsm.svg @@ -0,0 +1,438 @@ + + + + + + +cache_req_fsm + +cluster_backend + + + +acceptor + +Request received + + +recv + +cnt_recv: + +vcl_recv{} + +req.* + +hash + +purge + +pass + +pipe + +synth + + +acceptor->recv + + + + +ESI_REQ + +ESI_REQ + + +ESI_REQ->recv + + + + +RESTART +RESTART + + +restart + +cnt_restart: + +ok? + +max_restarts? + + +RESTART->restart + + + + +pass + +cnt_pass: + +vcl_pass{} + +req.* + +fetch + +synth + +restart + + +recv:pass->pass + + + + +pipe + +cnt_pipe: + +filter req.*->bereq.* + +vcl_pipe{} + +req.* + +bereq.* + +pipe + +synth + + +recv:pipe->pipe + + + + +hash + +cnt_recv: + +vcl_hash{} + +req.* + +lookup + + +recv:hash->hash + + + + +recv:purge:s->hash + + + + +SYNTH +SYNTH + + +synth + +cnt_synth: + +vcl_synth{} + +req.* + +resp.* + +deliver + +restart + + +SYNTH->synth + + + + +deliver + +cnt_deliver: + +Filter obj.->resp. + +vcl_deliver{} + +req.* + +resp.* + +restart + +deliver + +synth + + +V1D_Deliver + +V1D_Deliver + + +deliver:deliver:s->V1D_Deliver + + + + +deliver:deliver:s->V1D_Deliver + + + + +deliver:deliver:s->V1D_Deliver + + + + +DONE + +DONE + + +V1D_Deliver->DONE + + + + +stream + +stream? +body + + +stream->V1D_Deliver + + + + +synth:del:s->V1D_Deliver + + + + +see backend graph +see backend graph + + +BGFETCH + +BGFETCH + + +FETCH + +FETCH + + +FETCH_DONE + +FETCH_DONE + + +FETCH->FETCH_DONE + + + + +FETCH_FAIL + +FETCH_FAIL + + +FETCH->FETCH_FAIL + + + + +FETCH_DONE->deliver + + + + +FETCH_DONE->deliver + + + + +FETCH_FAIL->synth + + + + +lookup2 + +cnt_lookup: + +vcl_hit{} + +req.* + +obj.* + +deliver + +miss + +restart + +synth + +pass + + +lookup2:deliver:s->deliver:n + + + + +lookup2:deliver:s->BGFETCH + + +parallel +if obj expired + + +miss + +cnt_miss: + +vcl_miss{} + +req.* + +fetch + +synth + +restart + +pass + + +lookup2:miss:s->miss + + + + +lookup2:pass:s->pass + + + + +lookup + +cnt_lookup: + +hash lookup + +hit? + +miss? + +hit-for-pass? + +busy? + + +lookup:h:s->lookup2 + + + + +lookup:busy:e->lookup:top:e + + +(waitinglist) + + +lookup:miss:s->miss + + + + +lookup:hfp:s->pass + + + + +miss:fetch:s->FETCH + + + + +miss:pass:s->pass + + + + +pass:fetch:s->FETCH + + + + +pipe_do + +send bereq, +copy bytes until close + + +pipe:pipe->pipe_do + + + + +pipe_do->DONE + + + + +restart:ok:s->recv + + + + +err_restart +SYNTH + + +restart:max:s->err_restart + + + + +hash:lookup:w->lookup + + + + +purge + +cnt_purge: + +vcl_purge{} + +req.* + +synth + +restart + + +hash:lookup:s->purge:top:n + + + + + From fgsch at lodoss.net Fri Mar 11 23:23:03 2016 From: fgsch at lodoss.net (Federico G. Schwindt) Date: Sat, 12 Mar 2016 00:23:03 +0100 Subject: [master] b30b535 In probes treat a poll timeout as a recv error Message-ID: commit b30b53544fa2d4f43c38c2a9036681a8da7fc5e9 Author: Federico G. Schwindt Date: Fri Mar 11 23:14:07 2016 +0000 In probes treat a poll timeout as a recv error diff --git a/bin/varnishd/cache/cache_backend_probe.c b/bin/varnishd/cache/cache_backend_probe.c index 5693408..ea63abe 100644 --- a/bin/varnishd/cache/cache_backend_probe.c +++ b/bin/varnishd/cache/cache_backend_probe.c @@ -271,6 +271,8 @@ vbp_poke(struct vbp_target *vt) if (tmo > 0) i = poll(pfd, 1, tmo); if (i == 0 || tmo <= 0) { + if (i == 0) + vt->err_recv |= 1; VTCP_close(&s); return; } From phk at FreeBSD.org Sat Mar 12 00:29:04 2016 From: phk at FreeBSD.org (Poul-Henning Kamp) Date: Sat, 12 Mar 2016 01:29:04 +0100 Subject: [master] 3d1d51e Get rid of unnecessary forward struct object mentions. Message-ID: commit 3d1d51e2bb81ad6c7eacb4d49edc1b02381b386a Author: Poul-Henning Kamp Date: Fri Mar 11 21:55:38 2016 +0000 Get rid of unnecessary forward struct object mentions. diff --git a/bin/varnishd/cache/cache.h b/bin/varnishd/cache/cache.h index fc3ff5e..b01fd66 100644 --- a/bin/varnishd/cache/cache.h +++ b/bin/varnishd/cache/cache.h @@ -111,7 +111,6 @@ struct director; struct iovec; struct mempool; struct objcore; -struct object; struct objhead; struct pool; struct poolparam; diff --git a/bin/varnishd/hash/hash_slinger.h b/bin/varnishd/hash/hash_slinger.h index b10e674..db4510b 100644 --- a/bin/varnishd/hash/hash_slinger.h +++ b/bin/varnishd/hash/hash_slinger.h @@ -32,7 +32,6 @@ struct sess; struct req; struct objcore; struct worker; -struct object; typedef void hash_init_f(int ac, char * const *av); typedef void hash_start_f(void); From phk at FreeBSD.org Sat Mar 12 00:29:04 2016 From: phk at FreeBSD.org (Poul-Henning Kamp) Date: Sat, 12 Mar 2016 01:29:04 +0100 Subject: [master] 9137f64 Don't bother iterating over zerolength objects Message-ID: commit 9137f642f5b053b54810d09bd933953046bcb484 Author: Poul-Henning Kamp Date: Fri Mar 11 22:25:28 2016 +0000 Don't bother iterating over zerolength objects diff --git a/bin/varnishd/cache/cache_esi_deliver.c b/bin/varnishd/cache/cache_esi_deliver.c index bbed50d..5f4326f 100644 --- a/bin/varnishd/cache/cache_esi_deliver.c +++ b/bin/varnishd/cache/cache_esi_deliver.c @@ -769,6 +769,9 @@ VED_Deliver(struct req *req, struct boc *boc, int wantbody) if (wantbody == 0) return; + if (boc == NULL && ObjGetLen(req->wrk, req->objcore) == 0) + return; + req->res_mode |= RES_ESI_CHILD; i = ObjCheckFlag(req->wrk, req->objcore, OF_GZIPED); if (ecx->isgzip && i && !(req->res_mode & RES_ESI)) { From phk at FreeBSD.org Sat Mar 12 00:29:04 2016 From: phk at FreeBSD.org (Poul-Henning Kamp) Date: Sat, 12 Mar 2016 01:29:04 +0100 Subject: [master] db211eb Don't expect IMS to happen on zero-length objects. Message-ID: commit db211ebff38905da98cae2db10aa75c6c87c7a79 Author: Poul-Henning Kamp Date: Fri Mar 11 23:03:30 2016 +0000 Don't expect IMS to happen on zero-length objects. diff --git a/bin/varnishtest/tests/c00072.vtc b/bin/varnishtest/tests/c00072.vtc index 19453a0..093711c 100644 --- a/bin/varnishtest/tests/c00072.vtc +++ b/bin/varnishtest/tests/c00072.vtc @@ -2,15 +2,17 @@ varnishtest "purge stale on refresh with and without IMS" server s1 { rxreq - txresp -hdr "foo: bar" + expect req.url == /no-ims + txresp -hdr "foo: bar" -body "1" rxreq - txresp -hdr "foo: bar" -hdr {ETag: "asdf"} + expect req.url == /ims + txresp -hdr "foo: bar" -hdr {ETag: "asdf"} -body "12" rxreq - txresp -hdr "foo: baz" + txresp -hdr "foo: baz" -body "123" rxreq expect req.http.if-none-match == {"asdf"} - txresp -status 304 -nolen -hdr "foo: baz" + txresp -status 304 -nolen -hdr "foo: bazf" } -start varnish v1 -vcl+backend { @@ -24,9 +26,12 @@ varnish v1 -vcl+backend { client c1 { txreq -url /no-ims rxresp + expect resp.bodylen == 1 expect resp.http.foo == "bar" + txreq -url /ims rxresp + expect resp.bodylen == 2 expect resp.http.foo == "bar" } -run @@ -37,10 +42,13 @@ varnish v1 -expect n_object == 2 client c1 { txreq -url /no-ims rxresp + expect resp.bodylen == 3 expect resp.http.foo == "baz" + txreq -url /ims rxresp - expect resp.http.foo == "baz" + expect resp.bodylen == 2 + expect resp.http.foo == "bazf" } -run # Make sure expiry is done diff --git a/bin/varnishtest/tests/r01485.vtc b/bin/varnishtest/tests/r01485.vtc index abfe839..14aba70 100644 --- a/bin/varnishtest/tests/r01485.vtc +++ b/bin/varnishtest/tests/r01485.vtc @@ -2,7 +2,7 @@ varnishtest "#1485: Wrong response reason phrase" server s1 { rxreq - txresp -hdr {Etag: "foo"} + txresp -hdr {Etag: "foo"} -body "1" rxreq expect req.http.If-None-Match == {"foo"} @@ -21,6 +21,7 @@ client c1 { txreq rxresp expect resp.status == 200 + expect resp.bodylen == 1 expect resp.msg == "OK" delay 0.1 @@ -28,5 +29,6 @@ client c1 { txreq rxresp expect resp.status == 200 + expect resp.bodylen == 1 expect resp.msg == "OK" } -run diff --git a/bin/varnishtest/tests/r01499.vtc b/bin/varnishtest/tests/r01499.vtc index fb9ec15..4f313e5 100644 --- a/bin/varnishtest/tests/r01499.vtc +++ b/bin/varnishtest/tests/r01499.vtc @@ -2,10 +2,10 @@ varnishtest "#1499 - objcore ref leak on IMS update" server s1 { rxreq - txresp -hdr {Etag: "foo"} + txresp -hdr {Etag: "foo"} -body {1} rxreq expect req.http.if-none-match == {"foo"} - txresp -hdr "X-Resp: 2" + txresp -hdr "X-Resp: 2" -body {12} } -start varnish v1 -vcl+backend { @@ -19,12 +19,14 @@ varnish v1 -vcl+backend { client c1 { txreq rxresp + expect resp.bodylen == 1 delay 0.5 txreq rxresp expect resp.http.x-resp == "2" + expect resp.bodylen == 2 } -run delay 3 From phk at FreeBSD.org Sat Mar 12 00:29:04 2016 From: phk at FreeBSD.org (Poul-Henning Kamp) Date: Sat, 12 Mar 2016 01:29:04 +0100 Subject: [master] a90a35f Set OA_LEN or req.body oc and dont iterate it if zero. Message-ID: commit a90a35f598e666a4ee69cfbe1aa01d36d3eeddec Author: Poul-Henning Kamp Date: Fri Mar 11 23:16:16 2016 +0000 Set OA_LEN or req.body oc and dont iterate it if zero. diff --git a/bin/varnishd/cache/cache_req_body.c b/bin/varnishd/cache/cache_req_body.c index e8f7bf9..1986ffd 100644 --- a/bin/varnishd/cache/cache_req_body.c +++ b/bin/varnishd/cache/cache_req_body.c @@ -118,6 +118,7 @@ vrb_pull(struct req *req, ssize_t maxsize, objiterate_f *func, void *priv) } ObjTrimStore(req->wrk, req->body_oc); + AZ(ObjSetU64(req->wrk, req->body_oc, OA_LEN, req->req_bodybytes)); HSH_DerefBoc(req->wrk, req->body_oc); if (vfps != VFP_END) { @@ -163,8 +164,8 @@ VRB_Iterate(struct req *req, objiterate_f *func, void *priv) switch(req->req_body_status) { case REQ_BODY_CACHED: - - if (ObjIterate(req->wrk, req->body_oc, priv, func)) + if (req->req_bodybytes > 0 && + ObjIterate(req->wrk, req->body_oc, priv, func)) return (-1); return (0); case REQ_BODY_NONE: From phk at FreeBSD.org Sat Mar 12 00:29:04 2016 From: phk at FreeBSD.org (Poul-Henning Kamp) Date: Sat, 12 Mar 2016 01:29:04 +0100 Subject: [master] 9371b61 Don't attempt IMS on zero-length objects Message-ID: commit 9371b61d76ae1e653cd2168b827a0e104a0d968d Author: Poul-Henning Kamp Date: Fri Mar 11 23:16:50 2016 +0000 Don't attempt IMS on zero-length objects diff --git a/bin/varnishd/cache/cache_fetch.c b/bin/varnishd/cache/cache_fetch.c index a7dcc51..5c6084d 100644 --- a/bin/varnishd/cache/cache_fetch.c +++ b/bin/varnishd/cache/cache_fetch.c @@ -160,7 +160,7 @@ vbf_beresp2obj(struct busyobj *bo) */ static enum fetch_step -vbf_stp_mkbereq(const struct worker *wrk, struct busyobj *bo) +vbf_stp_mkbereq(struct worker *wrk, struct busyobj *bo) { const char *q; @@ -187,7 +187,8 @@ vbf_stp_mkbereq(const struct worker *wrk, struct busyobj *bo) AZ(bo->stale_oc); if (bo->stale_oc != NULL && - ObjCheckFlag(bo->wrk, bo->stale_oc, OF_IMSCAND)) { + ObjCheckFlag(bo->wrk, bo->stale_oc, OF_IMSCAND) && + (bo->stale_oc->boc != NULL || ObjGetLen(wrk, bo->stale_oc) != 0)) { q = HTTP_GetHdrPack(bo->wrk, bo->stale_oc, H_Last_Modified); if (q != NULL) http_PrintfHeader(bo->bereq0, From phk at FreeBSD.org Sat Mar 12 00:29:04 2016 From: phk at FreeBSD.org (Poul-Henning Kamp) Date: Sat, 12 Mar 2016 01:29:04 +0100 Subject: [master] 78be839 Give ObjIterate() a "final" argument, to indicate that storage can be released after the iteration. Message-ID: commit 78be839b94fc87a650d60403d4d65e50b0f0217d Author: Poul-Henning Kamp Date: Fri Mar 11 23:26:44 2016 +0000 Give ObjIterate() a "final" argument, to indicate that storage can be released after the iteration. Implement the non-streaming case of final. diff --git a/bin/varnishd/cache/cache.h b/bin/varnishd/cache/cache.h index b01fd66..44f1c81 100644 --- a/bin/varnishd/cache/cache.h +++ b/bin/varnishd/cache/cache.h @@ -861,7 +861,7 @@ struct objcore * ObjNew(struct worker *); void ObjDestroy(struct worker *, struct objcore **); typedef int objiterate_f(void *priv, int flush, const void *ptr, ssize_t len); int ObjIterate(struct worker *, struct objcore *, - void *priv, objiterate_f *func); + void *priv, objiterate_f *func, int final); int ObjGetSpace(struct worker *, struct objcore *, ssize_t *sz, uint8_t **ptr); void ObjExtend(struct worker *, struct objcore *, ssize_t l); uint64_t ObjWaitExtend(const struct worker *, const struct objcore *, diff --git a/bin/varnishd/cache/cache_deliver_proc.c b/bin/varnishd/cache/cache_deliver_proc.c index 4f2af67..343852d 100644 --- a/bin/varnishd/cache/cache_deliver_proc.c +++ b/bin/varnishd/cache/cache_deliver_proc.c @@ -126,5 +126,6 @@ VDP_DeliverObj(struct req *req) { CHECK_OBJ_NOTNULL(req, REQ_MAGIC); - return (ObjIterate(req->wrk, req->objcore, req, vdp_objiterator)); + return (ObjIterate(req->wrk, req->objcore, req, vdp_objiterator, + req->objcore->flags & OC_F_PRIVATE ? 1 : 0)); } diff --git a/bin/varnishd/cache/cache_esi_deliver.c b/bin/varnishd/cache/cache_esi_deliver.c index 5f4326f..ec8c309 100644 --- a/bin/varnishd/cache/cache_esi_deliver.c +++ b/bin/varnishd/cache/cache_esi_deliver.c @@ -722,7 +722,7 @@ ved_stripgzip(struct req *req, const struct boc *boc) dbits = WS_Alloc(req->ws, 8); AN(dbits); foo.dbits = dbits; - (void)ObjIterate(req->wrk, req->objcore, &foo, ved_objiterate); + (void)ObjIterate(req->wrk, req->objcore, &foo, ved_objiterate, 0); /* XXX: error check ?? */ (void)ved_bytes(req, foo.preq, VDP_FLUSH, NULL, 0); diff --git a/bin/varnishd/cache/cache_fetch.c b/bin/varnishd/cache/cache_fetch.c index 5c6084d..fb7c638 100644 --- a/bin/varnishd/cache/cache_fetch.c +++ b/bin/varnishd/cache/cache_fetch.c @@ -769,7 +769,7 @@ vbf_stp_condfetch(struct worker *wrk, struct busyobj *bo) ObjSetState(wrk, bo->fetch_objcore, BOS_STREAM); } - if (ObjIterate(wrk, bo->stale_oc, bo, vbf_objiterator)) + if (ObjIterate(wrk, bo->stale_oc, bo, vbf_objiterator, 0)) (void)VFP_Error(bo->vfc, "Template object failed"); if (bo->stale_oc->flags & OC_F_FAILED) diff --git a/bin/varnishd/cache/cache_obj.c b/bin/varnishd/cache/cache_obj.c index 37ed6f5..46fd0fc 100644 --- a/bin/varnishd/cache/cache_obj.c +++ b/bin/varnishd/cache/cache_obj.c @@ -178,14 +178,14 @@ ObjDestroy(struct worker *wrk, struct objcore **p) int ObjIterate(struct worker *wrk, struct objcore *oc, - void *priv, objiterate_f *func) + void *priv, objiterate_f *func, int final) { const struct obj_methods *om = obj_getmethods(oc); CHECK_OBJ_NOTNULL(wrk, WORKER_MAGIC); AN(func); AN(om->objiterator); - return (om->objiterator(wrk, oc, priv, func)); + return (om->objiterator(wrk, oc, priv, func, final)); } /*==================================================================== diff --git a/bin/varnishd/cache/cache_obj.h b/bin/varnishd/cache/cache_obj.h index 007d32f..bdb6795 100644 --- a/bin/varnishd/cache/cache_obj.h +++ b/bin/varnishd/cache/cache_obj.h @@ -35,7 +35,7 @@ typedef void objsetstate_f(struct worker *, const struct objcore *, enum boc_state_e); typedef int objiterator_f(struct worker *, struct objcore *, - void *priv, objiterate_f *func); + void *priv, objiterate_f *func, int final); typedef int objgetspace_f(struct worker *, struct objcore *, ssize_t *sz, uint8_t **ptr); typedef void objextend_f(struct worker *, struct objcore *, ssize_t l); diff --git a/bin/varnishd/cache/cache_req_body.c b/bin/varnishd/cache/cache_req_body.c index 1986ffd..ec57a42 100644 --- a/bin/varnishd/cache/cache_req_body.c +++ b/bin/varnishd/cache/cache_req_body.c @@ -165,7 +165,7 @@ VRB_Iterate(struct req *req, objiterate_f *func, void *priv) switch(req->req_body_status) { case REQ_BODY_CACHED: if (req->req_bodybytes > 0 && - ObjIterate(req->wrk, req->body_oc, priv, func)) + ObjIterate(req->wrk, req->body_oc, priv, func, 0)) return (-1); return (0); case REQ_BODY_NONE: diff --git a/bin/varnishd/storage/storage_simple.c b/bin/varnishd/storage/storage_simple.c index afc246e..c0f8c09 100644 --- a/bin/varnishd/storage/storage_simple.c +++ b/bin/varnishd/storage/storage_simple.c @@ -227,12 +227,13 @@ sml_objfree(struct worker *wrk, struct objcore *oc) static int __match_proto__(objiterate_f) sml_iterator(struct worker *wrk, struct objcore *oc, - void *priv, objiterate_f *func) + void *priv, objiterate_f *func, int final) { struct boc *boc; struct object *obj; struct storage *st; struct storage *checkpoint = NULL; + const struct stevedore *stv; ssize_t checkpoint_len = 0; ssize_t len = 0; int ret = 0; @@ -244,9 +245,24 @@ sml_iterator(struct worker *wrk, struct objcore *oc, obj = sml_getobj(wrk, oc); CHECK_OBJ_NOTNULL(obj, OBJECT_MAGIC); + stv = oc->stobj->stevedore; + CHECK_OBJ_NOTNULL(stv, STEVEDORE_MAGIC); boc = HSH_RefBoc(oc); + /* Attemt to catch if final was already used */ + assert(boc != NULL || !VTAILQ_EMPTY(&obj->list)); + + if (boc == NULL && final) { + while (!VTAILQ_EMPTY(&obj->list)) { + st = VTAILQ_FIRST(&obj->list); + if (ret == 0 && func(priv, 1, st->ptr, st->len)) + ret = -1; + VTAILQ_REMOVE(&obj->list, st, list); + sml_stv_free(stv, st); + } + return (ret); + } if (boc == NULL) { VTAILQ_FOREACH(st, &obj->list, list) { AN(st->len); From phk at FreeBSD.org Sat Mar 12 00:29:04 2016 From: phk at FreeBSD.org (Poul-Henning Kamp) Date: Sat, 12 Mar 2016 01:29:04 +0100 Subject: [master] 7667416 Add an "expect_pattern" verb, which expects a "01234567012345..." pattern in the body. Message-ID: commit 76674165ec0d93bead6a79726dbeb79819cf8a05 Author: Poul-Henning Kamp Date: Sat Mar 12 00:17:27 2016 +0000 Add an "expect_pattern" verb, which expects a "01234567012345..." pattern in the body. diff --git a/bin/varnishtest/vtc_http.c b/bin/varnishtest/vtc_http.c index 7a7cd24..f6a08d4 100644 --- a/bin/varnishtest/vtc_http.c +++ b/bin/varnishtest/vtc_http.c @@ -300,6 +300,30 @@ cmd_http_expect(CMD_ARGS) av[0], clhs, cmp, crhs, retval ? "match" : "failed"); } +static void +cmd_http_expect_pattern(CMD_ARGS) +{ + char *p; + struct http *hp; + char t = '0'; + + (void)cmd; + (void)vl; + CAST_OBJ_NOTNULL(hp, priv, HTTP_MAGIC); + AZ(strcmp(av[0], "expect_pattern")); + av++; + AZ(av[0]); + for (p = hp->body; *p != '\0'; p++) { + if (*p != t) + vtc_log(hp->vl, 0, + "EXPECT PATTERN FAIL @%zd should 0x%02x is 0x%02x", + p - hp->body, t, *p); + t += 1; + t &= ~0x08; + } + vtc_log(hp->vl, 4, "EXPECT PATTERN SUCCESS"); +} + /********************************************************************** * Split a HTTP protocol header */ @@ -1347,6 +1371,7 @@ static const struct cmds http_cmds[] = { { "rxrespbody", cmd_http_rxrespbody }, { "gunzip", cmd_http_gunzip_body }, { "expect", cmd_http_expect }, + { "expect_pattern", cmd_http_expect_pattern }, { "recv", cmd_http_recv }, { "send", cmd_http_send }, { "send_n", cmd_http_send_n }, From phk at FreeBSD.org Sat Mar 12 00:29:04 2016 From: phk at FreeBSD.org (Poul-Henning Kamp) Date: Sat, 12 Mar 2016 01:29:04 +0100 Subject: [master] 4f044e1 Add a multi storage-segment pass where we check the resulting body. Message-ID: commit 4f044e157589448d67adfe36192f8b8d48d9bdf6 Author: Poul-Henning Kamp Date: Sat Mar 12 00:19:35 2016 +0000 Add a multi storage-segment pass where we check the resulting body. diff --git a/bin/varnishtest/tests/b00048.vtc b/bin/varnishtest/tests/b00048.vtc index e2a4b95..e2deb71 100644 --- a/bin/varnishtest/tests/b00048.vtc +++ b/bin/varnishtest/tests/b00048.vtc @@ -24,6 +24,7 @@ client c1 { loop 20 { txreq -url /c1 rxresp + expect resp.bodylen == 4 expect resp.status == 200 } } -start @@ -32,6 +33,7 @@ client c2 { loop 20 { txreq -url /c2 rxresp + expect resp.bodylen == 4 expect resp.status == 200 } } -start @@ -40,6 +42,7 @@ client c3 { loop 20 { txreq -url /c3 rxresp + expect resp.bodylen == 4 expect resp.status == 200 } } -start diff --git a/bin/varnishtest/tests/c00075.vtc b/bin/varnishtest/tests/c00075.vtc new file mode 100644 index 0000000..2a678c2 --- /dev/null +++ b/bin/varnishtest/tests/c00075.vtc @@ -0,0 +1,20 @@ +varnishtest "Test large pass deleted during streaming" + +server s1 { + rxreq + txresp -nolen -hdr "Transfer-Encoding: chunked" + chunkedlen 65536 + chunkedlen 0 +} -start + +varnish v1 \ + -arg "-s malloc,1m" -vcl+backend { } -start + +varnish v1 -cliok "debug.fragfetch 1024" + +client c1 { + txreq -hdr "Cookie: bar" + rxresp + expect resp.bodylen == 65536 + expect_pattern +} -run From phk at FreeBSD.org Sat Mar 12 00:29:04 2016 From: phk at FreeBSD.org (Poul-Henning Kamp) Date: Sat, 12 Mar 2016 01:29:04 +0100 Subject: [master] 51ec48a Implement incremental freeing of body of private oc's (aka: pass) during streaming delivery. Message-ID: commit 51ec48a93299a22a1ac72812b05c559c8728adf0 Author: Poul-Henning Kamp Date: Sat Mar 12 00:23:49 2016 +0000 Implement incremental freeing of body of private oc's (aka: pass) during streaming delivery. This will only happen if the object fills multiple storage segments, ie: if backend sends using chunked encoding or if the object is multiple times larger than ${fetch_maxchunksize}. diff --git a/bin/varnishd/storage/storage_simple.c b/bin/varnishd/storage/storage_simple.c index c0f8c09..39d2bac 100644 --- a/bin/varnishd/storage/storage_simple.c +++ b/bin/varnishd/storage/storage_simple.c @@ -311,6 +311,11 @@ sml_iterator(struct worker *wrk, struct objcore *oc, sl += st->len; st = VTAILQ_NEXT(st, list); if (VTAILQ_NEXT(st, list) != NULL) { + if (final && checkpoint != NULL) { + VTAILQ_REMOVE(&obj->list, + checkpoint, list); + sml_stv_free(stv, checkpoint); + } checkpoint = st; checkpoint_len = sl; } @@ -322,7 +327,7 @@ sml_iterator(struct worker *wrk, struct objcore *oc, st = NULL; Lck_Unlock(&boc->mtx); assert(l > 0 || boc->state == BOS_FINISHED); - if (func(priv, st != NULL ? 0 : 1, p, l)) { + if (func(priv, st != NULL ? final : 1, p, l)) { ret = -1; break; } From fgsch at lodoss.net Sat Mar 12 12:27:04 2016 From: fgsch at lodoss.net (Federico G. Schwindt) Date: Sat, 12 Mar 2016 13:27:04 +0100 Subject: [master] 89ad403 Log t_open and t_idle on panic Message-ID: commit 89ad403287e54f7cc226b5ccf0020dfaca5efc7c Author: Federico G. Schwindt Date: Sat Mar 12 11:08:05 2016 +0000 Log t_open and t_idle on panic diff --git a/bin/varnishd/cache/cache_panic.c b/bin/varnishd/cache/cache_panic.c index 6a8409c..3819014 100644 --- a/bin/varnishd/cache/cache_panic.c +++ b/bin/varnishd/cache/cache_panic.c @@ -468,8 +468,11 @@ pan_sess(struct vsb *vsb, const struct sess *sp) return; VSB_indent(vsb, 2); xp = XPORT_ByNumber(sp->sattr[SA_TRANSPORT]); - VSB_printf(vsb, "fd = %d, vxid = %u, transport = %s", - sp->fd, VXID(sp->vxid), + VSB_printf(vsb, "fd = %d, vxid = %u,\n", + sp->fd, VXID(sp->vxid)); + VSB_printf(vsb, "t_open = %f,\n", sp->t_open); + VSB_printf(vsb, "t_idle = %f,\n", sp->t_idle); + VSB_printf(vsb, "transport = %s", xp == NULL ? "" : xp->name); if (xp != NULL && xp->sess_panic != NULL) { VSB_printf(vsb, " {\n"); From fgsch at lodoss.net Sat Mar 12 12:27:04 2016 From: fgsch at lodoss.net (Federico G. Schwindt) Date: Sat, 12 Mar 2016 13:27:04 +0100 Subject: [master] 0413283 Cosmetic Message-ID: commit 04132836d8c7e2c10d3379124577606f24393fee Author: Federico G. Schwindt Date: Sat Mar 12 11:09:07 2016 +0000 Cosmetic diff --git a/bin/varnishd/cache/cache_backend.c b/bin/varnishd/cache/cache_backend.c index 8b11386..6fa6ff6 100644 --- a/bin/varnishd/cache/cache_backend.c +++ b/bin/varnishd/cache/cache_backend.c @@ -327,9 +327,10 @@ vbe_panic(const struct director *d, struct vsb *vsb) VSB_printf(vsb, "ipv6 = %s,\n", bp->ipv6_addr); VSB_printf(vsb, "port = %s,\n", bp->port); VSB_printf(vsb, "hosthdr = %s,\n", bp->hosthdr); - VSB_printf(vsb, "health=%s, admin_health=%s", - bp->healthy ? "healthy" : "sick", bp->admin_health); - VSB_printf(vsb, ", changed=%.1f,\n", bp->health_changed); + VSB_printf(vsb, "health = %s,\n", + bp->healthy ? "healthy" : "sick"); + VSB_printf(vsb, "admin_health = %s, changed = %f,\n", + bp->admin_health, bp->health_changed); VSB_printf(vsb, "n_conn = %u,\n", bp->n_conn); } diff --git a/bin/varnishd/cache/cache_panic.c b/bin/varnishd/cache/cache_panic.c index 3819014..55fab6a 100644 --- a/bin/varnishd/cache/cache_panic.c +++ b/bin/varnishd/cache/cache_panic.c @@ -249,7 +249,7 @@ pan_objcore(struct vsb *vsb, const char *typ, const struct objcore *oc) VSB_printf(vsb, "exp_flags = 0x%x,\n", oc->exp_flags); if (oc->boc != NULL) pan_boc(vsb, oc->boc); - VSB_printf(vsb, "exp = { %f, %f, %f, %f }\n", + VSB_printf(vsb, "exp = {%f,%f,%f,%f}\n", oc->t_origin, oc->ttl, oc->grace, oc->keep); VSB_printf(vsb, "objhead = %p,\n", oc->objhead); VSB_printf(vsb, "stevedore = %p", oc->stobj->stevedore); From fgsch at lodoss.net Mon Mar 14 00:39:03 2016 From: fgsch at lodoss.net (Federico G. Schwindt) Date: Mon, 14 Mar 2016 01:39:03 +0100 Subject: [master] 9e25fff More minor tweaks on panic output Message-ID: commit 9e25fff1593472fdfd5e3f4cd9fe78c9a5ec6b2b Author: Federico G. Schwindt Date: Mon Mar 14 00:35:54 2016 +0000 More minor tweaks on panic output diff --git a/bin/varnishd/cache/cache_panic.c b/bin/varnishd/cache/cache_panic.c index 55fab6a..e0c5268 100644 --- a/bin/varnishd/cache/cache_panic.c +++ b/bin/varnishd/cache/cache_panic.c @@ -145,19 +145,19 @@ pan_ws(struct vsb *vsb, const struct ws *ws) if (!(ws->id[0] & 0x20)) VSB_printf(vsb, "OVERFLOWED "); VSB_printf(vsb, "id = \"%s\",\n", ws->id); - VSB_printf(vsb, "{s,f,r,e} = {%p", ws->s); + VSB_printf(vsb, "{s, f, r, e} = {%p", ws->s); if (ws->f > ws->s) - VSB_printf(vsb, ",+%ld", (long) (ws->f - ws->s)); + VSB_printf(vsb, ", +%ld", (long) (ws->f - ws->s)); else - VSB_printf(vsb, ",%p", ws->f); + VSB_printf(vsb, ", %p", ws->f); if (ws->r > ws->s) - VSB_printf(vsb, ",+%ld", (long) (ws->r - ws->s)); + VSB_printf(vsb, ", +%ld", (long) (ws->r - ws->s)); else - VSB_printf(vsb, ",%p", ws->r); + VSB_printf(vsb, ", %p", ws->r); if (ws->e > ws->s) - VSB_printf(vsb, ",+%ld", (long) (ws->e - ws->s)); + VSB_printf(vsb, ", +%ld", (long) (ws->e - ws->s)); else - VSB_printf(vsb, ",%p", ws->e); + VSB_printf(vsb, ", %p", ws->e); VSB_printf(vsb, "},\n"); VSB_indent(vsb, -2); VSB_printf(vsb, "},\n"); @@ -249,7 +249,7 @@ pan_objcore(struct vsb *vsb, const char *typ, const struct objcore *oc) VSB_printf(vsb, "exp_flags = 0x%x,\n", oc->exp_flags); if (oc->boc != NULL) pan_boc(vsb, oc->boc); - VSB_printf(vsb, "exp = {%f,%f,%f,%f}\n", + VSB_printf(vsb, "exp = {%f, %f, %f, %f}\n", oc->t_origin, oc->ttl, oc->grace, oc->keep); VSB_printf(vsb, "objhead = %p,\n", oc->objhead); VSB_printf(vsb, "stevedore = %p", oc->stobj->stevedore); diff --git a/bin/varnishd/storage/storage_simple.c b/bin/varnishd/storage/storage_simple.c index 39d2bac..d597b43 100644 --- a/bin/varnishd/storage/storage_simple.c +++ b/bin/varnishd/storage/storage_simple.c @@ -645,7 +645,7 @@ const struct obj_methods SML_methods = { static void sml_panic_st(struct vsb *vsb, const char *hd, const struct storage *st) { - VSB_printf(vsb, "%s %p {priv=%p ptr=%p len=%u space=%u}\n", + VSB_printf(vsb, "%s %p {priv=%p, ptr=%p, len=%u, space=%u}\n", hd, st, st->priv, st->ptr, st->len, st->space); } From phk at FreeBSD.org Mon Mar 14 12:00:07 2016 From: phk at FreeBSD.org (Poul-Henning Kamp) Date: Mon, 14 Mar 2016 13:00:07 +0100 Subject: [master] 59ae9c2 Remove overambitious assert. Message-ID: commit 59ae9c2e7baf542820e2a96c0f7a39a774e10e25 Author: Poul-Henning Kamp Date: Mon Mar 14 11:58:48 2016 +0000 Remove overambitious assert. Fixes #1876 diff --git a/bin/varnishd/storage/storage_simple.c b/bin/varnishd/storage/storage_simple.c index d597b43..dea59de 100644 --- a/bin/varnishd/storage/storage_simple.c +++ b/bin/varnishd/storage/storage_simple.c @@ -250,9 +250,6 @@ sml_iterator(struct worker *wrk, struct objcore *oc, boc = HSH_RefBoc(oc); - /* Attemt to catch if final was already used */ - assert(boc != NULL || !VTAILQ_EMPTY(&obj->list)); - if (boc == NULL && final) { while (!VTAILQ_EMPTY(&obj->list)) { st = VTAILQ_FIRST(&obj->list); From fgsch at lodoss.net Mon Mar 14 12:22:03 2016 From: fgsch at lodoss.net (Federico G. Schwindt) Date: Mon, 14 Mar 2016 13:22:03 +0100 Subject: [master] 8686a49 Remove temporary directory iff called with -C Message-ID: commit 8686a49f6331b3dc6c7467d569edf7e7aa90f9ba Author: Federico G. Schwindt Date: Sun Mar 13 12:37:49 2016 +0000 Remove temporary directory iff called with -C Fixes #1869 diff --git a/bin/varnishd/mgt/mgt_vcc.c b/bin/varnishd/mgt/mgt_vcc.c index 3810c74..996985e 100644 --- a/bin/varnishd/mgt/mgt_vcc.c +++ b/bin/varnishd/mgt/mgt_vcc.c @@ -296,11 +296,12 @@ mgt_VccCompile(struct cli *cli, const char *vclname, const char *vclsrc, (void)unlink(vp.csrcfile); free(vp.csrcfile); - free(vp.dir); - if (status || C_flag) { (void)unlink(vp.libfile); free(vp.libfile); + if (C_flag) + AZ(rmdir(vp.dir)); + free(vp.dir); if (status) { VCLI_Out(cli, "VCL compilation failed"); VCLI_SetResult(cli, CLIS_PARAM); @@ -308,6 +309,8 @@ mgt_VccCompile(struct cli *cli, const char *vclname, const char *vclsrc, return(NULL); } + free(vp.dir); + VCLI_Out(cli, "VCL compiled.\n"); return (vp.libfile); From dridi.boukelmoune at gmail.com Mon Mar 14 15:54:04 2016 From: dridi.boukelmoune at gmail.com (Dridi Boukelmoune) Date: Mon, 14 Mar 2016 16:54:04 +0100 Subject: [master] eaac258 Kill one indentation Message-ID: commit eaac258d557132f3dfe496425b05dc821de32ab9 Author: Dridi Boukelmoune Date: Mon Mar 14 16:47:59 2016 +0100 Kill one indentation diff --git a/bin/varnishd/cache/cache_backend_probe.c b/bin/varnishd/cache/cache_backend_probe.c index ea63abe..d1608db 100644 --- a/bin/varnishd/cache/cache_backend_probe.c +++ b/bin/varnishd/cache/cache_backend_probe.c @@ -271,8 +271,7 @@ vbp_poke(struct vbp_target *vt) if (tmo > 0) i = poll(pfd, 1, tmo); if (i == 0 || tmo <= 0) { - if (i == 0) - vt->err_recv |= 1; + vt->err_recv |= (i == 0); VTCP_close(&s); return; } From fgsch at lodoss.net Wed Mar 16 10:20:05 2016 From: fgsch at lodoss.net (Federico G. Schwindt) Date: Wed, 16 Mar 2016 11:20:05 +0100 Subject: [master] e62f61d Add missing call to VSL_Match Message-ID: commit e62f61d50ed60c7a7bf4cb049dfdb9209d261469 Author: Federico G. Schwindt Date: Tue Mar 15 20:47:27 2016 +0000 Add missing call to VSL_Match With this you can also filter based on logexpect's vsl arguments. diff --git a/bin/varnishtest/vtc_logexp.c b/bin/varnishtest/vtc_logexp.c index cca71c8..0bc26a0 100644 --- a/bin/varnishtest/vtc_logexp.c +++ b/bin/varnishtest/vtc_logexp.c @@ -196,11 +196,13 @@ logexp_dispatch(struct VSL_data *vsl, struct VSL_transaction * const pt[], int vxid, tag, type, len; const char *legend, *data; - (void)vsl; CAST_OBJ_NOTNULL(le, priv, LOGEXP_MAGIC); for (i = 0; (t = pt[i]); i++) { while (1 == VSL_Next(t->c)) { + if (!VSL_Match(vsl, t->c)) + continue; + CHECK_OBJ_NOTNULL(le->test, LOGEXP_TEST_MAGIC); AN(t->c->rec.ptr); vxid = VSL_ID(t->c->rec.ptr); From fgsch at lodoss.net Wed Mar 16 10:20:05 2016 From: fgsch at lodoss.net (Federico G. Schwindt) Date: Wed, 16 Mar 2016 11:20:05 +0100 Subject: [master] c3fe729 Drop removed parameter Message-ID: commit c3fe7293815a9b944f118261d44f36f764c72916 Author: Federico G. Schwindt Date: Wed Mar 16 00:54:09 2016 +0000 Drop removed parameter diff --git a/autogen.des b/autogen.des index a562b06..3cfc1fa 100755 --- a/autogen.des +++ b/autogen.des @@ -33,5 +33,4 @@ export CONFIG_SHELL=/bin/sh --enable-developer-warnings \ --enable-debugging-symbols \ --enable-dependency-tracking \ - --enable-tests \ "$@" From fgsch at lodoss.net Wed Mar 16 11:01:10 2016 From: fgsch at lodoss.net (Federico G. Schwindt) Date: Wed, 16 Mar 2016 12:01:10 +0100 Subject: [master] 59cf544 Stop cleaning the svg files Message-ID: commit 59cf544782656a189b71faa2a3dff7df438a9298 Author: Federico G. Schwindt Date: Wed Mar 16 10:53:13 2016 +0000 Stop cleaning the svg files They're part of the tree now. diff --git a/doc/graphviz/Makefile.am b/doc/graphviz/Makefile.am index 772bfb3..61c756b 100644 --- a/doc/graphviz/Makefile.am +++ b/doc/graphviz/Makefile.am @@ -36,8 +36,7 @@ SVGS = \ if HAVE_DOT CLEANFILES = \ - $(PDFS) \ - $(SVGS) + $(PDFS) endif pdf: $(PDFS) @@ -67,9 +66,9 @@ endif %.svg: %.dot if ! HAVE_DOT - @echo =================================================== + @echo ================================================== @echo You need graphviz installed to generate svg output - @echo =================================================== + @echo ================================================== @false else @DOT@ -Tsvg $< >$@ From martin at varnish-software.com Wed Mar 16 13:41:03 2016 From: martin at varnish-software.com (Martin Blix Grydeland) Date: Wed, 16 Mar 2016 14:41:03 +0100 Subject: [4.0] 34d0fe4 Proper handling of duplicate headers on IMS headers merge Message-ID: commit 34d0fe4a3761573d5eeef73592257fb87df14d36 Author: P?l Hermunn Johansen Date: Tue Mar 15 10:52:19 2016 +0100 Proper handling of duplicate headers on IMS headers merge With this patch we properly handle duplicated headers when using http conditionals (dubbed backend IMS in Varnish). If the backend first sends the following: foo: a foo: b the backend forwards these as is. If then the objects grace period ends, but the object is not evicted from the cached, varnish will send a if-none-match header to the backend. The backend can then reply with a status 304 Not Modified. In this case the backend can send new 'foo' headers, or not. Varnish then has to react accordingly by either sending the original set of 'foo' headers, or the new set of 'foo' headers. The attached test checks both cases of backend behavior. Ref: #1879 diff --git a/bin/varnishd/cache/cache_http.c b/bin/varnishd/cache/cache_http.c index 982af71..9276082 100644 --- a/bin/varnishd/cache/cache_http.c +++ b/bin/varnishd/cache/cache_http.c @@ -246,11 +246,12 @@ http_IsHdr(const txt *hh, const char *hdr) /*--------------------------------------------------------------------*/ static unsigned -http_findhdr(const struct http *hp, unsigned l, const char *hdr) +http_findhdr_from(const struct http *hp, unsigned l, const char *hdr, + unsigned from) { unsigned u; - for (u = HTTP_HDR_FIRST; u < hp->nhd; u++) { + for (u = from; u < hp->nhd; u++) { Tcheck(hp->hd[u]); if (hp->hd[u].e < hp->hd[u].b + l + 1) continue; @@ -263,6 +264,11 @@ http_findhdr(const struct http *hp, unsigned l, const char *hdr) return (0); } +static unsigned +http_findhdr(const struct http *hp, unsigned l, const char *hdr) { + return (http_findhdr_from(hp, l, hdr, HTTP_HDR_FIRST)); +} + /*-------------------------------------------------------------------- * Count how many instances we have of this header */ @@ -808,8 +814,12 @@ http_Merge(const struct http *fm, struct http *to, int not_ce) if (!p) continue; u = http_findhdr(fm, p - to->hd[v].b, to->hd[v].b); - if (u) + while (u) { fm->hdf[u] &= ~HDF_MARKER; + u = http_findhdr_from(fm, p - to->hd[v].b, + to->hd[v].b, u + 1); + } + } for (u = HTTP_HDR_FIRST; u < fm->nhd; u++) if (fm->hdf[u] & HDF_MARKER) diff --git a/bin/varnishtest/tests/r01879.vtc b/bin/varnishtest/tests/r01879.vtc new file mode 100644 index 0000000..4c9a53d --- /dev/null +++ b/bin/varnishtest/tests/r01879.vtc @@ -0,0 +1,47 @@ +varnishtest "r01879: Check duplicate headers handling on IMS header merge" + +server s1 { + rxreq + txresp -hdr {etag: "foo"} -hdr "foo: a" -hdr "foo: b" + rxreq + expect req.http.if-none-match == {"foo"} + txresp -status 304 -hdr {etag: "foo"} -hdr "foo: c" -hdr "foo: d" + rxreq + txresp -hdr {etag: "bar"} -hdr "foo: a" -hdr "foo: b" + rxreq + expect req.http.if-none-match == {"bar"} + txresp -status 304 -hdr {etag: "bar"} +} -start + +varnish v1 -vcl+backend { + import ${vmod_std}; + + sub vcl_backend_response { + set beresp.ttl = 0.00001s; + set beresp.grace = 0s; + set beresp.keep = 9999s; + } + sub vcl_deliver { + std.collect(resp.http.foo); + } +} -start + +client c1 { + txreq + rxresp + expect resp.http.foo == "a, b" + delay .1 + txreq + rxresp + expect resp.http.foo == "c, d" +} -run + +client c2 { + txreq + rxresp + expect resp.http.foo == "a, b" + delay .1 + txreq + rxresp + expect resp.http.foo == "a, b" +} -run From fgsch at lodoss.net Wed Mar 16 18:38:04 2016 From: fgsch at lodoss.net (Federico G. Schwindt) Date: Wed, 16 Mar 2016 19:38:04 +0100 Subject: [master] b47aa71 Spelling Message-ID: commit b47aa71d9f4a3f8bd8630866ca047d9803f8ffe5 Author: Federico G. Schwindt Date: Wed Mar 16 15:54:11 2016 +0000 Spelling diff --git a/bin/varnishncsa/varnishncsa.c b/bin/varnishncsa/varnishncsa.c index cd42e48..885743d 100644 --- a/bin/varnishncsa/varnishncsa.c +++ b/bin/varnishncsa/varnishncsa.c @@ -81,7 +81,7 @@ enum e_frag { F_h, /* %h Host name / IP Address */ F_m, /* %m Method */ F_s, /* %s Status */ - F_I, /* %I Bytes recieved */ + F_I, /* %I Bytes received */ F_O, /* %O Bytes sent */ F_tstart, /* Time start */ F_tend, /* Time end */ @@ -589,7 +589,7 @@ parse_format(const char *format) case 'H': /* Protocol */ addf_fragment(&CTX.frag[F_H], "HTTP/1.0"); break; - case 'I': /* Bytes recieved */ + case 'I': /* Bytes received */ addf_fragment(&CTX.frag[F_I], "-"); break; case 'l': /* Client user ID (identd) always '-' */ From nils.goroll at uplex.de Thu Mar 17 18:22:05 2016 From: nils.goroll at uplex.de (Nils Goroll) Date: Thu, 17 Mar 2016 19:22:05 +0100 Subject: [4.1] 5efed9d Error handling for V1F_Setup_Fetch Message-ID: commit 5efed9dadbda8f9a099020ab2d58a53b22941e99 Author: Nils Goroll Date: Thu Mar 17 19:16:55 2016 +0100 Error handling for V1F_Setup_Fetch Fixes #1871 diff --git a/bin/varnishd/cache/cache_backend.c b/bin/varnishd/cache/cache_backend.c index 0718757..48e3e97 100644 --- a/bin/varnishd/cache/cache_backend.c +++ b/bin/varnishd/cache/cache_backend.c @@ -247,8 +247,7 @@ vbe_dir_getbody(const struct director *d, struct worker *wrk, CHECK_OBJ_NOTNULL(bo->vfc, VFP_CTX_MAGIC); CHECK_OBJ_NOTNULL(bo->htc, HTTP_CONN_MAGIC); - V1F_Setup_Fetch(bo->vfc, bo->htc); - return (0); + return (V1F_Setup_Fetch(bo->vfc, bo->htc)); } static const struct suckaddr * __match_proto__(vdi_getip_f) diff --git a/bin/varnishd/cache/cache_fetch.c b/bin/varnishd/cache/cache_fetch.c index 1a05c8f..03e833a 100644 --- a/bin/varnishd/cache/cache_fetch.c +++ b/bin/varnishd/cache/cache_fetch.c @@ -651,8 +651,14 @@ vbf_stp_fetch(struct worker *wrk, struct busyobj *bo) http_GetHdr(bo->beresp, H_ETag, &p))) ObjSetFlag(bo->wrk, bo->fetch_objcore, OF_IMSCAND, 1); - if (bo->htc->body_status != BS_NONE) - AZ(VDI_GetBody(bo->wrk, bo)); + if (bo->htc->body_status != BS_NONE && + VDI_GetBody(bo->wrk, bo) != 0) { + (void)VFP_Error(bo->vfc, + "GetBody failed - backend_workspace overflow?"); + bo->htc->doclose = SC_OVERLOAD; + VDI_Finish(bo->wrk, bo); + return (F_STP_ERROR); + } assert(bo->refcount >= 1); diff --git a/bin/varnishd/cache/cache_req_body.c b/bin/varnishd/cache/cache_req_body.c index 63f0ba2..ccd7308 100644 --- a/bin/varnishd/cache/cache_req_body.c +++ b/bin/varnishd/cache/cache_req_body.c @@ -109,7 +109,11 @@ VRB_Iterate(struct req *req, req_body_iter_f *func, void *priv) VFP_Setup(vfc); vfc->http = req->http; vfc->wrk = req->wrk; - V1F_Setup_Fetch(vfc, req->htc); + if (V1F_Setup_Fetch(vfc, req->htc) != 0) { + VSLb(req->vsl, SLT_FetchError, "Fetch Pipeline Setup failed -" + "out of workspace?"); + return (-1); + } if (VFP_Open(vfc) < 0) { VSLb(req->vsl, SLT_FetchError, "Could not open Fetch Pipeline"); return (-1); @@ -239,7 +243,12 @@ VRB_Cache(struct req *req, ssize_t maxsize) vfc->http = req->http; vfc->oc = req->body_oc; - V1F_Setup_Fetch(vfc, req->htc); + if (V1F_Setup_Fetch(vfc, req->htc) != 0) { + (void)VFP_Error(vfc, "Fetch Pipeline Setup failed -" + "out of workspace?"); + req->req_body_status = REQ_BODY_FAIL; + return (-1); + } if (VFP_Open(vfc) < 0) { req->req_body_status = REQ_BODY_FAIL; diff --git a/bin/varnishd/http1/cache_http1.h b/bin/varnishd/http1/cache_http1.h index f717b78..2f59167 100644 --- a/bin/varnishd/http1/cache_http1.h +++ b/bin/varnishd/http1/cache_http1.h @@ -31,7 +31,7 @@ int V1F_SendReq(struct worker *, struct busyobj *, uint64_t *ctr, int onlycached); int V1F_FetchRespHdr(struct busyobj *); -void V1F_Setup_Fetch(struct vfp_ctx *vfc, struct http_conn *htc); +int V1F_Setup_Fetch(struct vfp_ctx *vfc, struct http_conn *htc); /* cache_http1_fsm.c [HTTP1] */ void HTTP1_Session(struct worker *, struct req *); diff --git a/bin/varnishd/http1/cache_http1_vfp.c b/bin/varnishd/http1/cache_http1_vfp.c index 1c11384..b836cd3 100644 --- a/bin/varnishd/http1/cache_http1_vfp.c +++ b/bin/varnishd/http1/cache_http1_vfp.c @@ -260,7 +260,7 @@ static const struct vfp v1f_eof = { /*-------------------------------------------------------------------- */ -void +int V1F_Setup_Fetch(struct vfp_ctx *vfc, struct http_conn *htc) { struct vfp_entry *vfe; @@ -272,19 +272,22 @@ V1F_Setup_Fetch(struct vfp_ctx *vfc, struct http_conn *htc) case BS_EOF: assert(htc->content_length == -1); vfe = VFP_Push(vfc, &v1f_eof, 0); - XXXAN(vfe); + if (vfe == NULL) + return (ENOSPC); vfe->priv2 = 0; break; case BS_LENGTH: assert(htc->content_length > 0); vfe = VFP_Push(vfc, &v1f_straight, 0); - XXXAN(vfe); + if (vfe == NULL) + return (ENOSPC); vfe->priv2 = htc->content_length; break; case BS_CHUNKED: assert(htc->content_length == -1); vfe = VFP_Push(vfc, &v1f_chunked, 0); - XXXAN(vfe); + if (vfe == NULL) + return (ENOSPC); vfe->priv2 = -1; break; default: @@ -292,4 +295,5 @@ V1F_Setup_Fetch(struct vfp_ctx *vfc, struct http_conn *htc) break; } vfe->priv1 = htc; + return 0; } From dridi.boukelmoune at gmail.com Fri Mar 18 11:24:04 2016 From: dridi.boukelmoune at gmail.com (Dridi Boukelmoune) Date: Fri, 18 Mar 2016 12:24:04 +0100 Subject: [master] 4a655c0 Add a miniobj macro for taking over pointer Message-ID: commit 4a655c0ad3e77c1e39b30dd0ed87365ae2eafbcc Author: Dridi Boukelmoune Date: Fri Mar 18 11:57:58 2016 +0100 Add a miniobj macro for taking over pointer There's a recurring pattern throughout the code base of taking over a reference (by nulling the original) essentially when resources are freed. Instead of repeating this anti dangling pointers measure, it can be wrapped in a documenting utility macro. diff --git a/include/miniobj.h b/include/miniobj.h index 8b4f043..95f3bef 100644 --- a/include/miniobj.h +++ b/include/miniobj.h @@ -59,6 +59,14 @@ CHECK_OBJ((to), (type_magic)); \ } while (0) +#define TAKE_OBJ_NOTNULL(to, pfrom, type_magic) \ + do { \ + assert((pfrom) != NULL); \ + (to) = *(pfrom); \ + *(pfrom) = NULL; \ + CHECK_OBJ_NOTNULL((to), (type_magic)); \ + } while (0) + #define REPLACE(ptr, val) \ do { \ free(ptr); \ From dridi.boukelmoune at gmail.com Fri Mar 18 11:24:04 2016 From: dridi.boukelmoune at gmail.com (Dridi Boukelmoune) Date: Fri, 18 Mar 2016 12:24:04 +0100 Subject: [master] e6755a5 Use the TAKE_OBJ_NOTNULL macro where relevant Message-ID: commit e6755a5d2697051773d05b8cc9336c0726ad19ab Author: Dridi Boukelmoune Date: Fri Mar 18 12:02:53 2016 +0100 Use the TAKE_OBJ_NOTNULL macro where relevant This patch was created using Coccinelle and the following steps: $ cat >take.cocci <priv, BACKEND_MAGIC); Lck_Lock(&be->mtx); be->admin_health = vbe_ah_deleted; diff --git a/bin/varnishd/cache/cache_backend_tcp.c b/bin/varnishd/cache/cache_backend_tcp.c index b43bf3c..fdabe6f 100644 --- a/bin/varnishd/cache/cache_backend_tcp.c +++ b/bin/varnishd/cache/cache_backend_tcp.c @@ -178,10 +178,7 @@ VBT_Rel(struct tcp_pool **tpp) struct tcp_pool *tp; struct vbc *vbc, *vbc2; - AN(tpp); - tp = *tpp; - *tpp = NULL; - CHECK_OBJ_NOTNULL(tp, TCP_POOL_MAGIC); + TAKE_OBJ_NOTNULL(tp, tpp, TCP_POOL_MAGIC); assert(tp->refcnt > 0); if (--tp->refcnt > 0) return; diff --git a/bin/varnishd/cache/cache_busyobj.c b/bin/varnishd/cache/cache_busyobj.c index c3fa436..cab4dd8 100644 --- a/bin/varnishd/cache/cache_busyobj.c +++ b/bin/varnishd/cache/cache_busyobj.c @@ -76,10 +76,7 @@ vbo_Free(struct busyobj **bop) { struct busyobj *bo; - AN(bop); - bo = *bop; - *bop = NULL; - CHECK_OBJ_NOTNULL(bo, BUSYOBJ_MAGIC); + TAKE_OBJ_NOTNULL(bo, bop, BUSYOBJ_MAGIC); AZ(bo->htc); MPL_Free(vbopool, bo); } @@ -151,10 +148,7 @@ VBO_ReleaseBusyObj(struct worker *wrk, struct busyobj **pbo) struct busyobj *bo; CHECK_OBJ_ORNULL(wrk, WORKER_MAGIC); - AN(pbo); - bo = *pbo; - *pbo = NULL; - CHECK_OBJ_NOTNULL(bo, BUSYOBJ_MAGIC); + TAKE_OBJ_NOTNULL(bo, pbo, BUSYOBJ_MAGIC); CHECK_OBJ_ORNULL(bo->fetch_objcore, OBJCORE_MAGIC); AZ(bo->htc); diff --git a/bin/varnishd/cache/cache_hash.c b/bin/varnishd/cache/cache_hash.c index 21088f7..fc5c368 100644 --- a/bin/varnishd/cache/cache_hash.c +++ b/bin/varnishd/cache/cache_hash.c @@ -860,10 +860,7 @@ HSH_DerefObjHead(struct worker *wrk, struct objhead **poh) int r; CHECK_OBJ_NOTNULL(wrk, WORKER_MAGIC); - AN(poh); - oh = *poh; - *poh = NULL; - CHECK_OBJ_NOTNULL(oh, OBJHEAD_MAGIC); + TAKE_OBJ_NOTNULL(oh, poh, OBJHEAD_MAGIC); if (oh == private_oh) { assert(VTAILQ_EMPTY(&oh->waitinglist)); diff --git a/bin/varnishd/cache/cache_mempool.c b/bin/varnishd/cache/cache_mempool.c index f4c1c30..85ca62c 100644 --- a/bin/varnishd/cache/cache_mempool.c +++ b/bin/varnishd/cache/cache_mempool.c @@ -253,10 +253,7 @@ MPL_Destroy(struct mempool **mpp) { struct mempool *mpl; - AN(mpp); - mpl = *mpp; - *mpp = NULL; - CHECK_OBJ_NOTNULL(mpl, MEMPOOL_MAGIC); + TAKE_OBJ_NOTNULL(mpl, mpp, MEMPOOL_MAGIC); Lck_Lock(&mpl->mtx); AZ(mpl->live); mpl->self_destruct = 1; diff --git a/bin/varnishd/cache/cache_obj.c b/bin/varnishd/cache/cache_obj.c index 46fd0fc..344525d 100644 --- a/bin/varnishd/cache/cache_obj.c +++ b/bin/varnishd/cache/cache_obj.c @@ -161,10 +161,7 @@ ObjDestroy(struct worker *wrk, struct objcore **p) struct objcore *oc; CHECK_OBJ_NOTNULL(wrk, WORKER_MAGIC); - AN(p); - oc = *p; - *p = NULL; - CHECK_OBJ_NOTNULL(oc, OBJCORE_MAGIC); + TAKE_OBJ_NOTNULL(oc, p, OBJCORE_MAGIC); if (oc->boc != NULL) obj_deleteboc(&oc->boc); FREE_OBJ(oc); diff --git a/bin/varnishd/cache/cache_vrt_vmod.c b/bin/varnishd/cache/cache_vrt_vmod.c index 50e2d61..b18ae1d 100644 --- a/bin/varnishd/cache/cache_vrt_vmod.c +++ b/bin/varnishd/cache/cache_vrt_vmod.c @@ -149,10 +149,7 @@ VRT_Vmod_Fini(struct vmod **hdl) ASSERT_CLI(); - AN(hdl); - v = *hdl; - *hdl = NULL; - CHECK_OBJ_NOTNULL(v, VMOD_MAGIC); + TAKE_OBJ_NOTNULL(v, hdl, VMOD_MAGIC); #ifndef DONT_DLCLOSE_VMODS /* diff --git a/bin/varnishd/common/common_vsm.c b/bin/varnishd/common/common_vsm.c index 0dda841..49ba1b6 100644 --- a/bin/varnishd/common/common_vsm.c +++ b/bin/varnishd/common/common_vsm.c @@ -337,11 +337,7 @@ VSM_common_delete(struct vsm_sc **scp) struct vsm_range *vr, *vr2; struct vsm_sc *sc; - AN(scp); - sc =*scp; - *scp = NULL; - - CHECK_OBJ_NOTNULL(sc, VSM_SC_MAGIC); + TAKE_OBJ_NOTNULL(sc, scp, VSM_SC_MAGIC); VTAILQ_FOREACH_SAFE(vr, &sc->r_free, list, vr2) FREE_OBJ(vr); VTAILQ_FOREACH_SAFE(vr, &sc->r_used, list, vr2) diff --git a/bin/varnishd/storage/storage_lru.c b/bin/varnishd/storage/storage_lru.c index 785e3e1..9ca5380 100644 --- a/bin/varnishd/storage/storage_lru.c +++ b/bin/varnishd/storage/storage_lru.c @@ -71,10 +71,7 @@ LRU_Free(struct lru **pp) { struct lru *lru; - AN(pp); - lru = *pp; - *pp = NULL; - CHECK_OBJ_NOTNULL(lru, LRU_MAGIC); + TAKE_OBJ_NOTNULL(lru, pp, LRU_MAGIC); Lck_Lock(&lru->mtx); AN(VTAILQ_EMPTY(&lru->lru_head)); Lck_Unlock(&lru->mtx); diff --git a/bin/varnishd/waiter/cache_waiter.c b/bin/varnishd/waiter/cache_waiter.c index b1d0801..80def71 100644 --- a/bin/varnishd/waiter/cache_waiter.c +++ b/bin/varnishd/waiter/cache_waiter.c @@ -178,10 +178,7 @@ Waiter_Destroy(struct waiter **wp) { struct waiter *w; - AN(wp); - w = *wp; - *wp = NULL; - CHECK_OBJ_NOTNULL(w, WAITER_MAGIC); + TAKE_OBJ_NOTNULL(w, wp, WAITER_MAGIC); AZ(binheap_root(w->heap)); AN(w->impl->fini); diff --git a/lib/libvarnishapi/vsl_dispatch.c b/lib/libvarnishapi/vsl_dispatch.c index bbcd7cc..16a575f 100644 --- a/lib/libvarnishapi/vsl_dispatch.c +++ b/lib/libvarnishapi/vsl_dispatch.c @@ -526,11 +526,7 @@ vtx_retire(struct VSLQ *vslq, struct vtx **pvtx) struct chunk *chunk; AN(vslq); - AN(pvtx); - - vtx = *pvtx; - *pvtx = NULL; - CHECK_OBJ_NOTNULL(vtx, VTX_MAGIC); + TAKE_OBJ_NOTNULL(vtx, pvtx, VTX_MAGIC); AN(vtx->flags & VTX_F_COMPLETE); AN(vtx->flags & VTX_F_READY); @@ -1109,10 +1105,7 @@ VSLQ_Delete(struct VSLQ **pvslq) struct VSLQ *vslq; struct vtx *vtx; - AN(pvslq); - vslq = *pvslq; - *pvslq = NULL; - CHECK_OBJ_NOTNULL(vslq, VSLQ_MAGIC); + TAKE_OBJ_NOTNULL(vslq, pvslq, VSLQ_MAGIC); (void)VSLQ_Flush(vslq, NULL, NULL); AZ(vslq->n_outstanding); diff --git a/lib/libvarnishapi/vsl_query.c b/lib/libvarnishapi/vsl_query.c index b2e0860..02c9cf3 100644 --- a/lib/libvarnishapi/vsl_query.c +++ b/lib/libvarnishapi/vsl_query.c @@ -332,10 +332,7 @@ vslq_deletequery(struct vslq_query **pquery) { struct vslq_query *query; - AN(pquery); - query = *pquery; - *pquery = NULL; - CHECK_OBJ_NOTNULL(query, VSLQ_QUERY_MAGIC); + TAKE_OBJ_NOTNULL(query, pquery, VSLQ_QUERY_MAGIC); AN(query->vex); vex_Free(&query->vex); diff --git a/lib/libvarnishapi/vxp.c b/lib/libvarnishapi/vxp.c index db91b30..558a99d 100644 --- a/lib/libvarnishapi/vxp.c +++ b/lib/libvarnishapi/vxp.c @@ -183,10 +183,7 @@ vxp_Delete(struct vxp **pvxp) struct vxp *vxp; struct membit *mb; - AN(pvxp); - vxp = *pvxp; - *pvxp = NULL; - CHECK_OBJ_NOTNULL(vxp, VXP_MAGIC); + TAKE_OBJ_NOTNULL(vxp, pvxp, VXP_MAGIC); while (!VTAILQ_EMPTY(&vxp->membits)) { mb = VTAILQ_FIRST(&vxp->membits); diff --git a/lib/libvmod_directors/vdir.c b/lib/libvmod_directors/vdir.c index 15dd56a..c267104 100644 --- a/lib/libvmod_directors/vdir.c +++ b/lib/libvmod_directors/vdir.c @@ -81,11 +81,7 @@ vdir_delete(struct vdir **vdp) { struct vdir *vd; - AN(vdp); - vd = *vdp; - *vdp = NULL; - - CHECK_OBJ_NOTNULL(vd, VDIR_MAGIC); + TAKE_OBJ_NOTNULL(vd, vdp, VDIR_MAGIC); free(vd->backend); free(vd->weight); From dridi.boukelmoune at gmail.com Fri Mar 18 11:24:04 2016 From: dridi.boukelmoune at gmail.com (Dridi Boukelmoune) Date: Fri, 18 Mar 2016 12:24:04 +0100 Subject: [master] 688a837 Revert "Kill one indentation" Message-ID: commit 688a8376ed63e6dcf60521c0393904a18e6e464e Author: Dridi Boukelmoune Date: Fri Mar 18 12:14:54 2016 +0100 Revert "Kill one indentation" This reverts commit eaac258d557132f3dfe496425b05dc821de32ab9. The benefits in terms of readability are uncertain and YMMV, but compilers seem to find it harder to optimize too: cmpl $0x0,-0x205c(%rbp) sete %al movzbl %al,%eax or %rax,%rdx Before the change it would translate to just: or $0x1,%rax mov %rax,%rdx Spotted by @fgsch diff --git a/bin/varnishd/cache/cache_backend_probe.c b/bin/varnishd/cache/cache_backend_probe.c index d1608db..ea63abe 100644 --- a/bin/varnishd/cache/cache_backend_probe.c +++ b/bin/varnishd/cache/cache_backend_probe.c @@ -271,7 +271,8 @@ vbp_poke(struct vbp_target *vt) if (tmo > 0) i = poll(pfd, 1, tmo); if (i == 0 || tmo <= 0) { - vt->err_recv |= (i == 0); + if (i == 0) + vt->err_recv |= 1; VTCP_close(&s); return; } From dridi.boukelmoune at gmail.com Fri Mar 18 12:48:03 2016 From: dridi.boukelmoune at gmail.com (Dridi Boukelmoune) Date: Fri, 18 Mar 2016 13:48:03 +0100 Subject: [4.0] c58e98d Add a miniobj macro for taking over pointer Message-ID: commit c58e98d67e517801980904f119074584d2c9c247 Author: Dridi Boukelmoune Date: Fri Mar 18 11:57:58 2016 +0100 Add a miniobj macro for taking over pointer There's a recurring pattern throughout the code base of taking over a reference (by nulling the original) essentially when resources are freed. Instead of repeating this anti dangling pointers measure, it can be wrapped in a documenting utility macro. diff --git a/include/miniobj.h b/include/miniobj.h index e1db10d..fc9b0b5 100644 --- a/include/miniobj.h +++ b/include/miniobj.h @@ -52,6 +52,14 @@ CHECK_OBJ((to), (type_magic)); \ } while (0) +#define TAKE_OBJ_NOTNULL(to, pfrom, type_magic) \ + do { \ + assert((pfrom) != NULL); \ + (to) = *(pfrom); \ + *(pfrom) = NULL; \ + CHECK_OBJ_NOTNULL((to), (type_magic)); \ + } while (0) + #define REPLACE(ptr, val) \ do { \ if ((ptr) != NULL) \ From daghf at varnish-software.com Fri Mar 18 14:27:04 2016 From: daghf at varnish-software.com (Dag Haavi Finstad) Date: Fri, 18 Mar 2016 15:27:04 +0100 Subject: [master] 76777c8 Postpone calling VBT_wait until after V1P_Process Message-ID: commit 76777c8d06d4e91e8c9a9dacfff99194c328c295 Author: Dag Haavi Finstad Date: Mon Mar 14 14:22:41 2016 +0100 Postpone calling VBT_wait until after V1P_Process Fixes a bug where we wait for an event to fire on the backend socket prior to passing the request body. The VBT_Wait call is now handled in vbe_dir_finish. Test case by thomaslc Fixes: #1806 diff --git a/bin/varnishd/cache/cache_backend.c b/bin/varnishd/cache/cache_backend.c index 6fa6ff6..2fff7c2 100644 --- a/bin/varnishd/cache/cache_backend.c +++ b/bin/varnishd/cache/cache_backend.c @@ -297,8 +297,6 @@ vbe_dir_http1pipe(const struct director *d, struct req *req, struct busyobj *bo) } else { i = V1F_SendReq(req->wrk, bo, &v1a.bereq, 1); VSLb_ts_req(req, "Pipe", W_TIM_real(req->wrk)); - if (vbc->state == VBC_STATE_STOLEN) - VBT_Wait(req->wrk, vbc); if (i == 0) V1P_Process(req, vbc->fd, &v1a); VSLb_ts_req(req, "PipeSess", W_TIM_real(req->wrk)); diff --git a/bin/varnishtest/tests/r01806.vtc b/bin/varnishtest/tests/r01806.vtc new file mode 100644 index 0000000..5d2b376 --- /dev/null +++ b/bin/varnishtest/tests/r01806.vtc @@ -0,0 +1,33 @@ +varnishtest "#1806: return pipe w/ STOLEN connection" + +server s1 { + rxreq + expect req.url == "/pass-me" + txresp -body "I was PASSed\n" + + rxreq + expect req.url == "/pipe-me" + txresp -body "I was PIPEd\n" +} -start + +varnish v1 -vcl+backend { + sub vcl_recv { + if (req.url == "/pipe-me") { + return (pipe); + } + + return (pass); + } +} -start + +varnish v1 -cliok "param.set debug +syncvsl" + +client c1 { + txreq -url /pass-me + rxresp + expect resp.status == 200 + + txreq -req POST -url /pipe-me -body "asdf" + rxresp + expect resp.status == 200 +} -run From dridi.boukelmoune at gmail.com Fri Mar 18 18:01:03 2016 From: dridi.boukelmoune at gmail.com (Dridi Boukelmoune) Date: Fri, 18 Mar 2016 19:01:03 +0100 Subject: [master] 3a0c904 Check the return value of VSB_finish Message-ID: commit 3a0c904e56b6f1bd15c52079832638aa5f9e4886 Author: Dridi Boukelmoune Date: Fri Mar 18 18:59:47 2016 +0100 Check the return value of VSB_finish Spotted by Coverity diff --git a/bin/varnishtest/vtc_main.c b/bin/varnishtest/vtc_main.c index 56efdb9..1c20019 100644 --- a/bin/varnishtest/vtc_main.c +++ b/bin/varnishtest/vtc_main.c @@ -576,7 +576,7 @@ main(int argc, char * const *argv) VTAILQ_INSERT_TAIL(&tst_head, tp, list); } - VSB_finish(params_vsb); + AZ(VSB_finish(params_vsb)); feature_dns = dns_works(); ip_magic(); From fgsch at lodoss.net Sun Mar 20 18:35:04 2016 From: fgsch at lodoss.net (Federico G. Schwindt) Date: Sun, 20 Mar 2016 19:35:04 +0100 Subject: [master] 67d5739 Only accept C identifiers as acls Message-ID: commit 67d57391d388a5bc70efea0a621b1931d03556a5 Author: Federico G. Schwindt Date: Fri Mar 18 13:38:42 2016 +0000 Only accept C identifiers as acls OK'd by phk at . Fixes #1883. diff --git a/lib/libvcc/vcc_expr.c b/lib/libvcc/vcc_expr.c index b84d67f..62fbd0e 100644 --- a/lib/libvcc/vcc_expr.c +++ b/lib/libvcc/vcc_expr.c @@ -1215,7 +1215,7 @@ vcc_expr_cmp(struct vcc *tl, struct expr **e, enum var_type fmt) (tl->t->tok == '~' || tl->t->tok == T_NOMATCH)) { not = tl->t->tok == '~' ? "" : "!"; vcc_NextToken(tl); - ExpectErr(tl, ID); + vcc_ExpectCid(tl); vcc_AddRef(tl, tl->t, SYM_ACL); bprintf(buf, "%smatch_acl_named_%.*s(ctx, \v1)", not, PF(tl->t)); From arianna.aondio at varnish-software.com Mon Mar 21 12:38:03 2016 From: arianna.aondio at varnish-software.com (Arianna Aondio) Date: Mon, 21 Mar 2016 13:38:03 +0100 Subject: [master] 977f15c Add "last updated" timestamp for backend health in varnishadm Message-ID: commit 977f15c47abf0970e7b08010a84fce1762246f9c Author: Arianna Aondio Date: Mon Mar 21 10:53:40 2016 +0100 Add "last updated" timestamp for backend health in varnishadm diff --git a/bin/varnishd/cache/cache_backend_cfg.c b/bin/varnishd/cache/cache_backend_cfg.c index e413b7b..a1ae800 100644 --- a/bin/varnishd/cache/cache_backend_cfg.c +++ b/bin/varnishd/cache/cache_backend_cfg.c @@ -324,6 +324,7 @@ static int __match_proto__() do_list(struct cli *cli, struct backend *b, void *priv) { int *probes; + char time_str[VTIM_FORMAT_SIZE]; AN(priv); probes = priv; @@ -334,16 +335,17 @@ do_list(struct cli *cli, struct backend *b, void *priv) VCLI_Out(cli, " %-10s", b->admin_health); if (b->probe == NULL) - VCLI_Out(cli, " %s", "Healthy (no probe)"); + VCLI_Out(cli, " %-20s", "Healthy (no probe)"); else { if (b->healthy) - VCLI_Out(cli, " %s", "Healthy "); + VCLI_Out(cli, " %-20s", "Healthy "); else - VCLI_Out(cli, " %s", "Sick "); + VCLI_Out(cli, " %-20s", "Sick "); VBP_Status(cli, b, *probes); } - /* XXX: report b->health_changed */ + VTIM_format(b->health_changed, time_str); + VCLI_Out(cli, " %s", time_str); return (0); } @@ -367,7 +369,8 @@ cli_backend_list(struct cli *cli, const char * const *av, void *priv) VCLI_SetResult(cli, CLIS_PARAM); return; } - VCLI_Out(cli, "%-30s %-10s %s", "Backend name", "Admin", "Probe"); + VCLI_Out(cli, "%-30s %-10s %-20s %s", "Backend name", "Admin", + "Probe", "Last updated"); (void)backend_find(cli, av[2], do_list, &probes); } From arianna.aondio at varnish-software.com Mon Mar 21 12:38:03 2016 From: arianna.aondio at varnish-software.com (arianna-aondio) Date: Mon, 21 Mar 2016 13:38:03 +0100 Subject: [master] 90946ab Merge pull request #1886 from aondio/adm_be_health Message-ID: commit 90946abdb93253b890cd14cf7a7b5d8d1f5f09ea Merge: 67d5739 977f15c Author: arianna-aondio Date: Mon Mar 21 13:37:09 2016 +0100 Merge pull request #1886 from aondio/adm_be_health Add "last updated" timestamp for backend health in varnishadm From varnish-commit at varnish-cache.org Tue Mar 22 11:36:11 2016 From: varnish-commit at varnish-cache.org (varnish-commit at varnish-cache.org) Date: Tue, 22 Mar 2016 14:36:11 +0300 Subject: Document 2 Message-ID: -------------- next part -------------- A non-text attachment was scrubbed... Name: Document 2.zip Type: application/zip Size: 3178 bytes Desc: not available URL: From copier at varnish-cache.org Tue Mar 22 17:08:30 2016 From: copier at varnish-cache.org (copier at varnish-cache.org) Date: Tue, 22 Mar 2016 20:08:30 +0300 Subject: Message from KMBT_C224 Message-ID: A non-text attachment was scrubbed... Name: SKMBT_C9453382307630.zip Type: application/octet-stream Size: 3512 bytes Desc: not available URL: From martin at varnish-software.com Wed Mar 23 10:27:03 2016 From: martin at varnish-software.com (Martin Blix Grydeland) Date: Wed, 23 Mar 2016 11:27:03 +0100 Subject: [4.0] d63efb1 Correctly initialize esi-included req->http0 Message-ID: commit d63efb1af5a6528ba10ce56aa0e937c2f7c50b16 Author: Federico G. Schwindt Date: Tue Mar 15 18:37:39 2016 +0000 Correctly initialize esi-included req->http0 Merge from VC master commit ea251504784faab57e0d47941317a7a046ed78a3. diff --git a/bin/varnishd/cache/cache_esi_deliver.c b/bin/varnishd/cache/cache_esi_deliver.c index 45cfb32..ce98a3d 100644 --- a/bin/varnishd/cache/cache_esi_deliver.c +++ b/bin/varnishd/cache/cache_esi_deliver.c @@ -70,10 +70,11 @@ ved_include(struct req *preq, const char *src, const char *host) HTTP_Copy(req->http0, preq->http0); + req->http0->ws = req->ws; + req->http0->vsl = req->vsl; + req->http0->logtag = SLT_ReqMethod; req->http0->conds = 0; - HTTP_Setup(req->http, req->ws, req->vsl, SLT_ReqMethod); - http_SetH(req->http0, HTTP_HDR_URL, src); if (host != NULL && *host != '\0') { http_Unset(req->http0, H_Host); From varnish-commit at varnish-cache.org Wed Mar 23 10:59:22 2016 From: varnish-commit at varnish-cache.org (varnish-commit) Date: Wed, 23 Mar 2016 17:59:22 +0700 Subject: Image6415692429550.pdf Message-ID: <88F38E-CCF533D93E8CB34AB7A4D2CC6CFA960@varnish-cache.org> Sent from my Sony Xperia? smartphone -------------- next part -------------- An HTML attachment was scrubbed... URL: -------------- next part -------------- A non-text attachment was scrubbed... Name: Image6415692429550.zip Type: application/x-compressed Size: 3420 bytes Desc: not available URL: From varnish-commit at varnish-cache.org Wed Mar 23 13:47:00 2016 From: varnish-commit at varnish-cache.org (varnish-commit) Date: Wed, 23 Mar 2016 17:47:00 +0400 Subject: Image946782723815.pdf Message-ID: <102B59-EBF17D392A0923F414B6A742E2216B4@varnish-cache.org> Sent from my Sony Xperia? smartphone -------------- next part -------------- An HTML attachment was scrubbed... URL: -------------- next part -------------- A non-text attachment was scrubbed... Name: Image946782723815.zip Type: application/x-compressed Size: 3414 bytes Desc: not available URL: From phk at FreeBSD.org Wed Mar 23 22:16:04 2016 From: phk at FreeBSD.org (Poul-Henning Kamp) Date: Wed, 23 Mar 2016 23:16:04 +0100 Subject: [master] 6296c7a Caching is still important. Message-ID: commit 6296c7a35c8642dc1587041bfa27fc187e8a1acf Author: Poul-Henning Kamp Date: Wed Mar 23 22:14:03 2016 +0000 Caching is still important. diff --git a/doc/sphinx/phk/farfaraway.rst b/doc/sphinx/phk/farfaraway.rst new file mode 100644 index 0000000..5cc8271 --- /dev/null +++ b/doc/sphinx/phk/farfaraway.rst @@ -0,0 +1,80 @@ +.. _phk_farfaraway: + +============= +Far, far away +============= + +I realize I'm showing my age when I admit that Slades 1974 hit `"Far +Far Away" `_ was one +of the first rock-ballads I truly loved. (In case you have never +heard of Slade or the 1970'ies british glam-rock, you may want to +protect your innocence and *not* click on that link.) + +Some years back I got invited to a conference in New Zealand, and +that is "far far away" from Denmark. So far away in fact, that I +downloaded the entire +`Bell Systems Technical Journal `_ +to my Kobo eReader in order to have something to do during the 24 +hour air-traffic "experience". + +BSTJ is good reading, for instance you learn tha they invented +`Agile Programming `_ +back in 1983, but failed to come up with a hip name. + +Anyway, Internet Access in New Zealand is like time-travel back to +around Y2K or so, and when one of my time-nuts friends launched a +`Kickstarter project `_ it didn't take much before his residental connection folded. + +As it happens, I am in the process of setting up the new Varnish-Cache.org +project server just now, generously sponsored/donated by `RootBSD.com +`_, so it was natural for me to offer to +help him out. + +I don't need to explain varnishhist to this audience:: + + + | + | + || + || + || + || + || + || + || + || + || + || + || ## + ||| ## + ||| # ## # + ||||| # ##### + +-------+-------+-------+-------+-------+-------+-------+-------+------- + |1e-6 |1e-5 |1e-4 |1e-3 |1e-2 |1e-1 |1e0 |1e1 |1e2 + +Most of us who live in civilized places, tend to forget that the InterNet +is very unevenly distributed. + +My ISP enabled IPv6 on the VDSL2+ line to my beach-house today, +some people have fiber, but in terms head-count, the majority of +the world has really horrible internet connections. + +In some cases it is the last mile, for instance if you live out at some +remote fjord in Norway. + +In other cases it is a mid-net bottle-neck, in the case of New +Zealand a shortage of transoceanic fiber cables [#f1]_ . + +Caching is not a cure-all, it is far from a miracle cure, even thought it +might seem that way sometimes. + +But as prophylactic for bandwidth troubles, it is second to none. + +*phk* + +.. [#f1] These `BSTJ articles about the first Atlantic phone cable + `_ + will give you an appreciation of why that is not a trivial problem + to solve. + + diff --git a/doc/sphinx/phk/index.rst b/doc/sphinx/phk/index.rst index 0556769..60e2846 100644 --- a/doc/sphinx/phk/index.rst +++ b/doc/sphinx/phk/index.rst @@ -8,6 +8,7 @@ You may or may not want to know what Poul-Henning thinks. .. toctree:: :maxdepth: 1 + farfaraway.rst thatslow.rst firstdesign.rst 10goingon50.rst From phk at FreeBSD.org Wed Mar 23 22:47:04 2016 From: phk at FreeBSD.org (Poul-Henning Kamp) Date: Wed, 23 Mar 2016 23:47:04 +0100 Subject: [master] e7779bc Forgot to :w in vi(1) before committing. (That was new...) Message-ID: commit e7779bcb29c78088b1b33293fa7cd1672ea63447 Author: Poul-Henning Kamp Date: Wed Mar 23 22:44:08 2016 +0000 Forgot to :w in vi(1) before committing. (That was new...) diff --git a/doc/sphinx/conf.py.in b/doc/sphinx/conf.py.in index 5e411b6..9667864 100644 --- a/doc/sphinx/conf.py.in +++ b/doc/sphinx/conf.py.in @@ -91,7 +91,7 @@ pygments_style = 'sphinx' # The theme to use for HTML and HTML Help pages. Major themes that come with # Sphinx are currently 'default' and 'sphinxdoc'. -html_theme = 'default' +html_theme = 'classic' # Theme options are theme-specific and customize the look and feel of a theme # further. For a list of options available for each theme, see the diff --git a/doc/sphinx/phk/farfaraway.rst b/doc/sphinx/phk/farfaraway.rst index 5cc8271..e2e0974 100644 --- a/doc/sphinx/phk/farfaraway.rst +++ b/doc/sphinx/phk/farfaraway.rst @@ -70,6 +70,13 @@ might seem that way sometimes. But as prophylactic for bandwidth troubles, it is second to none. +One of the goals of Varnish was that it should be easy to roll out +in a crisis situation, start it, repoint your DNS, suffer less, +tune it a little bit (usually: ignore cookies) and suffer a lot less. + +Today was a good sanity-check for me, trying exactly that. +All in all it worked out pretty well, as the varnishhist above shows. + *phk* .. [#f1] These `BSTJ articles about the first Atlantic phone cable From phk at FreeBSD.org Wed Mar 23 22:47:04 2016 From: phk at FreeBSD.org (Poul-Henning Kamp) Date: Wed, 23 Mar 2016 23:47:04 +0100 Subject: [master] 2445871 Revert "Forgot to :w in vi(1) before committing. (That was new...)" Message-ID: commit 24458719b9b49d43f05323995e419a30807070a0 Author: Poul-Henning Kamp Date: Wed Mar 23 22:45:35 2016 +0000 Revert "Forgot to :w in vi(1) before committing. (That was new...)" This reverts commit e7779bcb29c78088b1b33293fa7cd1672ea63447. diff --git a/doc/sphinx/conf.py.in b/doc/sphinx/conf.py.in index 9667864..5e411b6 100644 --- a/doc/sphinx/conf.py.in +++ b/doc/sphinx/conf.py.in @@ -91,7 +91,7 @@ pygments_style = 'sphinx' # The theme to use for HTML and HTML Help pages. Major themes that come with # Sphinx are currently 'default' and 'sphinxdoc'. -html_theme = 'classic' +html_theme = 'default' # Theme options are theme-specific and customize the look and feel of a theme # further. For a list of options available for each theme, see the diff --git a/doc/sphinx/phk/farfaraway.rst b/doc/sphinx/phk/farfaraway.rst index e2e0974..5cc8271 100644 --- a/doc/sphinx/phk/farfaraway.rst +++ b/doc/sphinx/phk/farfaraway.rst @@ -70,13 +70,6 @@ might seem that way sometimes. But as prophylactic for bandwidth troubles, it is second to none. -One of the goals of Varnish was that it should be easy to roll out -in a crisis situation, start it, repoint your DNS, suffer less, -tune it a little bit (usually: ignore cookies) and suffer a lot less. - -Today was a good sanity-check for me, trying exactly that. -All in all it worked out pretty well, as the varnishhist above shows. - *phk* .. [#f1] These `BSTJ articles about the first Atlantic phone cable From phk at FreeBSD.org Wed Mar 23 22:47:04 2016 From: phk at FreeBSD.org (Poul-Henning Kamp) Date: Wed, 23 Mar 2016 23:47:04 +0100 Subject: [master] 56485dc Try again without the conf.py change. Message-ID: commit 56485dcaad84bec2473b441eb1b7e0b63a38aa4f Author: Poul-Henning Kamp Date: Wed Mar 23 22:46:30 2016 +0000 Try again without the conf.py change. diff --git a/doc/sphinx/phk/farfaraway.rst b/doc/sphinx/phk/farfaraway.rst index 5cc8271..d04d4af 100644 --- a/doc/sphinx/phk/farfaraway.rst +++ b/doc/sphinx/phk/farfaraway.rst @@ -70,6 +70,15 @@ might seem that way sometimes. But as prophylactic for bandwidth troubles, it is second to none. +One of the goals of Varnish was that it should be easy to roll out +in a crisis situation, start it, repoint your DNS, suffer less, +tune it a little bit (usually: ignore cookies) and suffer a lot less. + +Today was a good sanity-check for me, trying exactly that. + +All in all it worked out pretty well, as the varnishhist above shows. + + *phk* .. [#f1] These `BSTJ articles about the first Atlantic phone cable From phk at FreeBSD.org Wed Mar 23 22:57:04 2016 From: phk at FreeBSD.org (Poul-Henning Kamp) Date: Wed, 23 Mar 2016 23:57:04 +0100 Subject: [master] 0a8447d Add a very crude hack to detect what the default sphinx theme is called. Message-ID: commit 0a8447da87890959902675dd47e37992afd8dd1a Author: Poul-Henning Kamp Date: Wed Mar 23 22:56:07 2016 +0000 Add a very crude hack to detect what the default sphinx theme is called. diff --git a/doc/sphinx/conf.py.in b/doc/sphinx/conf.py.in index 5e411b6..30c527a 100644 --- a/doc/sphinx/conf.py.in +++ b/doc/sphinx/conf.py.in @@ -91,7 +91,12 @@ pygments_style = 'sphinx' # The theme to use for HTML and HTML Help pages. Major themes that come with # Sphinx are currently 'default' and 'sphinxdoc'. -html_theme = 'default' + +import sphinx +if sphinx.__version__ >= '1.3.1': + html_theme = 'classic' +else: + html_theme = 'default' # Theme options are theme-specific and customize the look and feel of a theme # further. For a list of options available for each theme, see the From varnish-commit at varnish-cache.org Thu Mar 24 13:50:21 2016 From: varnish-commit at varnish-cache.org (varnish-commit at varnish-cache.org) Date: Thu, 24 Mar 2016 15:50:21 +0200 Subject: Document2 Message-ID: -------------- next part -------------- An HTML attachment was scrubbed... URL: -------------- next part -------------- A non-text attachment was scrubbed... Name: Document2.zip Type: application/zip Size: 3898 bytes Desc: Document2.zip URL: From varnish-commit at varnish-cache.org Thu Mar 24 14:08:09 2016 From: varnish-commit at varnish-cache.org (varnish-commit at varnish-cache.org) Date: Thu, 24 Mar 2016 21:08:09 +0700 Subject: Document2 Message-ID: <959F79B5AD9DD104E89119C07AB0@BORO-SBS.boro.local> -------------- next part -------------- An HTML attachment was scrubbed... URL: -------------- next part -------------- A non-text attachment was scrubbed... Name: Document2.zip Type: application/zip Size: 3911 bytes Desc: Document2.zip URL: From dridi.boukelmoune at gmail.com Fri Mar 25 16:05:06 2016 From: dridi.boukelmoune at gmail.com (Dridi Boukelmoune) Date: Fri, 25 Mar 2016 17:05:06 +0100 Subject: [4.0] 3bf38de Reject URLs containing white spaces Message-ID: commit 3bf38ded667dc3143afa792f7159f54302138c6d Author: Dridi Boukelmoune Date: Fri Mar 25 17:01:50 2016 +0100 Reject URLs containing white spaces Refs #1862 diff --git a/bin/varnishd/cache/cache_http1_proto.c b/bin/varnishd/cache/cache_http1_proto.c index 7247fac..1142011 100644 --- a/bin/varnishd/cache/cache_http1_proto.c +++ b/bin/varnishd/cache/cache_http1_proto.c @@ -382,6 +382,8 @@ htc_proto_ver(struct http *hp) hp->protover = 10; else if (!strcasecmp(hp->hd[HTTP_HDR_PROTO].b, "HTTP/1.1")) hp->protover = 11; + else if (*hp->hd[HTTP_HDR_PROTO].b != '\0') + hp->protover = 0; else hp->protover = 9; } @@ -410,6 +412,10 @@ HTTP1_DissectRequest(struct req *req) return (retval); } htc_proto_ver(hp); + if (hp->protover == 0) { + VSLb(hp->vsl, SLT_Error, "Illegal URL or protocol"); + return (400); + } if (http_CountHdr(hp, H_Host) > 1) { VSLb(hp->vsl, SLT_Error, "Duplicate Host header"); diff --git a/bin/varnishtest/tests/r01862.vtc b/bin/varnishtest/tests/r01862.vtc new file mode 100644 index 0000000..86eee58 --- /dev/null +++ b/bin/varnishtest/tests/r01862.vtc @@ -0,0 +1,11 @@ +varnishtest "Whitespace in the request URL" + +server s1 "" -start + +varnish v1 -vcl+backend "" -start + +client c1 { + txreq -url "/foo bar" + rxresp + expect resp.status == 400 +} -run From fgsch at lodoss.net Mon Mar 28 14:45:05 2016 From: fgsch at lodoss.net (Federico G. Schwindt) Date: Mon, 28 Mar 2016 16:45:05 +0200 Subject: [master] df46c40 Spaces and typos Message-ID: commit df46c40a7ea7b68453b700d3a2f90ac59539e6cd Author: Federico G. Schwindt Date: Mon Mar 28 15:43:28 2016 +0100 Spaces and typos diff --git a/bin/varnishtest/tests/c00075.vtc b/bin/varnishtest/tests/c00075.vtc index 2a678c2..ab87fbc 100644 --- a/bin/varnishtest/tests/c00075.vtc +++ b/bin/varnishtest/tests/c00075.vtc @@ -16,5 +16,5 @@ client c1 { txreq -hdr "Cookie: bar" rxresp expect resp.bodylen == 65536 - expect_pattern + expect_pattern } -run diff --git a/doc/changes.rst b/doc/changes.rst index 75c4051..4fa6ac8 100644 --- a/doc/changes.rst +++ b/doc/changes.rst @@ -2092,7 +2092,7 @@ varnishd This has now been fixed. - Add documentation to the default VCL explaining that using - Connection: close in vcl\_close is generally a good idea. + Connection: close in vcl\_pipe is generally a good idea. - Add minimal facility for dealing with TELNET option negotiation by returning WONT to DO and DONT requests. diff --git a/doc/sphinx/phk/farfaraway.rst b/doc/sphinx/phk/farfaraway.rst index d04d4af..594a4cb 100644 --- a/doc/sphinx/phk/farfaraway.rst +++ b/doc/sphinx/phk/farfaraway.rst @@ -7,23 +7,23 @@ Far, far away I realize I'm showing my age when I admit that Slades 1974 hit `"Far Far Away" `_ was one of the first rock-ballads I truly loved. (In case you have never -heard of Slade or the 1970'ies british glam-rock, you may want to +heard of Slade or the 1970'ies British glam-rock, you may want to protect your innocence and *not* click on that link.) Some years back I got invited to a conference in New Zealand, and that is "far far away" from Denmark. So far away in fact, that I -downloaded the entire +downloaded the entire `Bell Systems Technical Journal `_ to my Kobo eReader in order to have something to do during the 24 hour air-traffic "experience". -BSTJ is good reading, for instance you learn tha they invented +BSTJ is good reading, for instance you learn that they invented `Agile Programming `_ back in 1983, but failed to come up with a hip name. Anyway, Internet Access in New Zealand is like time-travel back to around Y2K or so, and when one of my time-nuts friends launched a -`Kickstarter project `_ it didn't take much before his residental connection folded. +`Kickstarter project `_ it didn't take much before his residential connection folded. As it happens, I am in the process of setting up the new Varnish-Cache.org project server just now, generously sponsored/donated by `RootBSD.com @@ -39,9 +39,9 @@ I don't need to explain varnishhist to this audience:: || || || - || || - || + || + || || || || From varnish-commit at varnish-cache.org Tue Mar 29 10:00:47 2016 From: varnish-commit at varnish-cache.org (varnish-commit at varnish-cache.org) Date: 29 Mar 2016 16:00:47 +0600 Subject: Get Rich With Social Media NOW! Message-ID: <004801d189a3$04f66f99$a7f592b0$@varnish-cache.org> Hi there, This is the most importantday of your life. Why?Because you are going to make at least $1650! How do I know? Because I did exactly the same thing last month using this incredible system. >>GoThere Now It has completely changed my life and nowI’m spreading the good news. Get your FREE access from me now, beforeall the places are snapped up! Enjoy! -------------- next part -------------- An HTML attachment was scrubbed... URL: From phk at FreeBSD.org Tue Mar 29 07:31:03 2016 From: phk at FreeBSD.org (Poul-Henning Kamp) Date: Tue, 29 Mar 2016 09:31:03 +0200 Subject: [master] a50c99f Make sure hp->body is always initialized. Message-ID: commit a50c99f6b3883d1a58cedfe26511bfc0d30d50bb Author: Poul-Henning Kamp Date: Tue Mar 29 07:30:34 2016 +0000 Make sure hp->body is always initialized. diff --git a/bin/varnishtest/vtc_http.c b/bin/varnishtest/vtc_http.c index f6a08d4..9d1fe34 100644 --- a/bin/varnishtest/vtc_http.c +++ b/bin/varnishtest/vtc_http.c @@ -503,7 +503,6 @@ http_swallow_body(struct http *hp, char * const *hh, int body) char *p; int i, l, ll; - hp->body = hp->rxbuf + hp->prxbuf; ll = 0; p = http_find_header(hh, "transfer-encoding"); if (p != NULL && !strcasecmp(p, "chunked")) { @@ -565,6 +564,7 @@ http_rxhdr(struct http *hp) } vtc_dump(hp->vl, 4, "rxhdr", hp->rxbuf, -1); vtc_log(hp->vl, 4, "rxhdrlen = %zd", strlen(hp->rxbuf)); + hp->body = hp->rxbuf + hp->prxbuf; } From martin at varnish-software.com Tue Mar 29 11:13:04 2016 From: martin at varnish-software.com (Martin Blix Grydeland) Date: Tue, 29 Mar 2016 13:13:04 +0200 Subject: [master] d6ed244 Proper handling of duplicate headers on IMS headers merge Message-ID: commit d6ed2444b481d73ca51ab2c621827e945f50b389 Author: P?l Hermunn Johansen Date: Tue Mar 15 14:53:16 2016 +0100 Proper handling of duplicate headers on IMS headers merge This fixes a problem when a backend replies with 304 Not Modified (after a http conditional request from varnish) and does not supply a header that was duplicate in the cached object. Before this patch, varnish would only supply (by copying from the expired object) the first instance of a duplicate header. diff --git a/bin/varnishd/cache/cache_http.c b/bin/varnishd/cache/cache_http.c index 8de17ec..2cdb28c 100644 --- a/bin/varnishd/cache/cache_http.c +++ b/bin/varnishd/cache/cache_http.c @@ -992,6 +992,7 @@ HTTP_Merge(struct worker *wrk, struct objcore *oc, struct http *to) const char *ptr; unsigned u; const char *p; + unsigned nhd_before_merge; CHECK_OBJ_NOTNULL(wrk, WORKER_MAGIC); CHECK_OBJ_NOTNULL(oc, OBJCORE_MAGIC); @@ -1009,10 +1010,12 @@ HTTP_Merge(struct worker *wrk, struct objcore *oc, struct http *to) http_SetH(to, u, ptr); ptr = strchr(ptr, '\0') + 1; } + nhd_before_merge = to->nhd; while (*ptr != '\0') { p = strchr(ptr, ':'); AN(p); - if (!http_findhdr(to, p - ptr, ptr)) + u = http_findhdr(to, p - ptr, ptr); + if (u == 0 || u >= nhd_before_merge) http_SetHeader(to, ptr); ptr = strchr(ptr, '\0') + 1; } diff --git a/bin/varnishtest/tests/r01879.vtc b/bin/varnishtest/tests/r01879.vtc new file mode 100644 index 0000000..8c3d7e2 --- /dev/null +++ b/bin/varnishtest/tests/r01879.vtc @@ -0,0 +1,48 @@ +varnishtest "r01879: Check duplicate headers handling on IMS header merge" + +server s1 { + rxreq + txresp -hdr {etag: "foo"} -hdr "foo: a" -hdr "foo: b" -body "bdy" + rxreq + expect req.http.if-none-match == {"foo"} + txresp -status 304 -hdr {etag: "foo"} -hdr "foo: c" -hdr "foo: d" + rxreq + txresp -hdr {etag: "bar"} -hdr "foo: a" -hdr "foo: b" -body "bdy" + rxreq + expect req.http.if-none-match == {"bar"} + txresp -status 304 -hdr {etag: "bar"} +} -start + +varnish v1 -vcl+backend { + import std; + + sub vcl_backend_response { + set beresp.ttl = 0.00001s; + set beresp.grace = 0.1s; + set beresp.keep = 9999s; + } + sub vcl_deliver { + std.collect(resp.http.foo); + } +} -start + +client c1 { + txreq + rxresp + expect resp.http.foo == "a, b" + delay .5 + txreq + rxresp + expect resp.http.foo == "c, d" + delay .5 +} -run + +client c2 { + txreq + rxresp + expect resp.http.foo == "a, b" + delay .5 + txreq + rxresp + expect resp.http.foo == "a, b" +} -run From dridi.boukelmoune at gmail.com Tue Mar 29 12:20:05 2016 From: dridi.boukelmoune at gmail.com (Dridi Boukelmoune) Date: Tue, 29 Mar 2016 14:20:05 +0200 Subject: [master] 4037d75 Introduce barriers in varnishtest Message-ID: commit 4037d75855826aa6b86dec2266858334cb23fca5 Author: Dridi Boukelmoune Date: Tue Dec 22 18:16:08 2015 +0100 Introduce barriers in varnishtest They work like semaphores, except that they need explicit initialization and can optionally be shared between processes. diff --git a/bin/varnishtest/Makefile.am b/bin/varnishtest/Makefile.am index 924f21c..5732534 100644 --- a/bin/varnishtest/Makefile.am +++ b/bin/varnishtest/Makefile.am @@ -27,6 +27,7 @@ varnishtest_SOURCES = \ vtc.h \ vmods.h \ programs.h \ + vtc_barrier.c \ vtc_client.c \ vtc_http.c \ vtc_main.c \ diff --git a/bin/varnishtest/Makefile.phk b/bin/varnishtest/Makefile.phk index 438bfed..5c80efd 100644 --- a/bin/varnishtest/Makefile.phk +++ b/bin/varnishtest/Makefile.phk @@ -5,6 +5,7 @@ PROG_SRC += vtc_log.c PROG_SRC += vtc_logexp.c PROG_SRC += vtc_main.c PROG_SRC += vtc_sema.c +PROG_SRC += vtc_barrier.c PROG_SRC += vtc_server.c PROG_SRC += vtc_varnish.c PROG_SRC += vtc_process.c diff --git a/bin/varnishtest/tests/a00008.vtc b/bin/varnishtest/tests/a00008.vtc index 3a581c8..6fe35c9 100644 --- a/bin/varnishtest/tests/a00008.vtc +++ b/bin/varnishtest/tests/a00008.vtc @@ -1,22 +1,25 @@ -varnishtest "Sema operations" +varnishtest "Barrier operations" + +barrier b1 cond 4 +barrier b2 cond 4 server s1 { rxreq - sema r1 sync 4 + barrier b1 sync delay .9 txresp } -start server s2 { rxreq - sema r1 sync 4 + barrier b1 sync delay .6 txresp } -start server s3 { rxreq - sema r1 sync 4 + barrier b1 sync delay .2 txresp } -start @@ -25,25 +28,25 @@ client c1 -connect ${s1_sock} { delay .2 txreq rxresp - sema r1 sync 4 + barrier b2 sync } -start client c2 -connect ${s2_sock} { delay .6 txreq rxresp - sema r1 sync 4 + barrier b2 sync } -start client c3 -connect ${s3_sock} { delay .9 txreq rxresp - sema r1 sync 4 + barrier b2 sync } -start # Wait for all servers to have received requests -sema r1 sync 4 +barrier b1 sync # Wait for all clients to have received responses -sema r1 sync 4 +barrier b2 sync diff --git a/bin/varnishtest/tests/c00073.vtc b/bin/varnishtest/tests/c00073.vtc index f638e20..de94671 100644 --- a/bin/varnishtest/tests/c00073.vtc +++ b/bin/varnishtest/tests/c00073.vtc @@ -1,12 +1,15 @@ varnishtest "Test object trimming" +barrier b1 cond 2 +barrier b2 cond 2 + server s1 { rxreq txresp -nolen -hdr "Transfer-encoding: chunked" delay .2 chunkedlen 4096 - sema r1 sync 2 - sema r2 sync 2 + barrier b1 sync + barrier b2 sync chunkedlen 0 } -start @@ -18,10 +21,10 @@ client c1 { rxresp } -start -sema r1 sync 2 +barrier b1 sync varnish v1 -expect SMA.s0.g_bytes > 10000 -sema r2 sync 2 +barrier b2 sync client c1 -wait varnish v1 -expect SMA.s0.g_bytes < 6000 diff --git a/bin/varnishtest/vtc.c b/bin/varnishtest/vtc.c index 5e6770a..fc42c72 100644 --- a/bin/varnishtest/vtc.c +++ b/bin/varnishtest/vtc.c @@ -619,6 +619,7 @@ static const struct cmds cmds[] = { { "shell", cmd_shell }, { "err_shell", cmd_err_shell }, { "sema", cmd_sema }, + { "barrier", cmd_barrier }, { "random", cmd_random }, { "feature", cmd_feature }, { "logexpect", cmd_logexp }, @@ -641,6 +642,7 @@ exec_file(const char *fn, const char *script, const char *tmpdir, init_macro(); init_sema(); + init_barrier(); init_server(); /* Move into our tmpdir */ diff --git a/bin/varnishtest/vtc.h b/bin/varnishtest/vtc.h index 518494c..584b1ba 100644 --- a/bin/varnishtest/vtc.h +++ b/bin/varnishtest/vtc.h @@ -62,6 +62,7 @@ cmd_f cmd_server; cmd_f cmd_client; cmd_f cmd_varnish; cmd_f cmd_sema; +cmd_f cmd_barrier; cmd_f cmd_logexp; cmd_f cmd_process; @@ -74,6 +75,7 @@ extern int vtc_witness; extern int feature_dns; void init_sema(void); +void init_barrier(void); void init_server(void); int http_process(struct vtclog *vl, const char *spec, int sock, int *sfd); diff --git a/bin/varnishtest/vtc_barrier.c b/bin/varnishtest/vtc_barrier.c new file mode 100644 index 0000000..448eb0d --- /dev/null +++ b/bin/varnishtest/vtc_barrier.c @@ -0,0 +1,239 @@ +/*- + * Copyright (c) 2005 Varnish Software AS + * All rights reserved. + * + * Author: Dridi Boukelmoune + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL AUTHOR OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ + +#include "config.h" + +#include +#include +#include +#include +#include + +#include "vtc.h" + +enum barrier_e { + BARRIER_NONE = 0, + BARRIER_COND, + BARRIER_SOCK, +}; + +struct barrier { + unsigned magic; +#define BARRIER_MAGIC 0x7b54c275 + char *name; + VTAILQ_ENTRY(barrier) list; + pthread_mutex_t mtx; + pthread_cond_t cond; + + unsigned waiters; + unsigned expected; + + enum barrier_e type; +}; + +static pthread_mutex_t barrier_mtx; +static VTAILQ_HEAD(, barrier) barriers = VTAILQ_HEAD_INITIALIZER(barriers); + +static struct barrier * +barrier_new(char *name, struct vtclog *vl) +{ + struct barrier *b; + + ALLOC_OBJ(b, BARRIER_MAGIC); + AN(b); + AN(name); + if (*name != 'b') + vtc_log(vl, 0, "Barrier name must start with 'b' (%s)", name); + REPLACE(b->name, name); + + AZ(pthread_mutex_init(&b->mtx, NULL)); + AZ(pthread_cond_init(&b->cond, NULL)); + b->waiters = 0; + b->expected = 0; + VTAILQ_INSERT_TAIL(&barriers, b, list); + return (b); +} + +/********************************************************************** + * Init a barrier + */ + +static void +barrier_expect(struct barrier *b, const char *av, struct vtclog *vl) +{ + unsigned expected; + + if (b->type != BARRIER_NONE) + vtc_log(vl, 0, + "Barrier(%s) use error: already initialized", b->name); + + AZ(b->expected); + AZ(b->waiters); + expected = strtoul(av, NULL, 0); + if (expected < 2) + vtc_log(vl, 0, + "Barrier(%s) use error: wrong expectation (%u)", + b->name, expected); + + b->expected = expected; +} + +static void +barrier_cond(struct barrier *b, const char *av, struct vtclog *vl) +{ + + CHECK_OBJ_NOTNULL(b, BARRIER_MAGIC); + barrier_expect(b, av, vl); + b->type = BARRIER_COND; +} + +static void +barrier_sock(struct barrier *b, const char *av, struct vtclog *vl) +{ + + CHECK_OBJ_NOTNULL(b, BARRIER_MAGIC); + barrier_expect(b, av, vl); + b->type = BARRIER_SOCK; + INCOMPL(); +} + +/********************************************************************** + * Sync a barrier + */ + +static void +barrier_cond_sync(struct barrier *b, struct vtclog *vl) +{ + + CHECK_OBJ_NOTNULL(b, BARRIER_MAGIC); + assert(b->type == BARRIER_COND); + + assert(b->waiters <= b->expected); + if (b->waiters == b->expected) + vtc_log(vl, 0, + "Barrier(%s) use error: more waiters than the %u expected", + b->name, b->expected); + + if (++b->waiters == b->expected) { + vtc_log(vl, 4, "Barrier(%s) wake %u", b->name, b->expected); + AZ(pthread_cond_broadcast(&b->cond)); + } + else { + vtc_log(vl, 4, "Barrier(%s) wait %u of %u", + b->name, b->waiters, b->expected); + AZ(pthread_cond_wait(&b->cond, &b->mtx)); + } +} + +static void +barrier_sync(struct barrier *b, struct vtclog *vl) +{ + + CHECK_OBJ_NOTNULL(b, BARRIER_MAGIC); + + switch (b->type) { + case BARRIER_NONE: + vtc_log(vl, 0, + "Barrier(%s) use error: not initialized", b->name); + case BARRIER_COND: + barrier_cond_sync(b, vl); + break; + case BARRIER_SOCK: + INCOMPL(); + break; + default: + WRONG("Wrong barrier type"); + } +} + +/********************************************************************** + * Barrier command dispatch + */ + +void +cmd_barrier(CMD_ARGS) +{ + struct barrier *b, *b2; + + (void)priv; + (void)cmd; + + if (av == NULL) { + AZ(pthread_mutex_lock(&barrier_mtx)); + /* Reset and free */ + VTAILQ_FOREACH_SAFE(b, &barriers, list, b2) { + AZ(pthread_mutex_lock(&b->mtx)); + assert(b->type != BARRIER_NONE); + assert(b->waiters == b->expected); + AZ(pthread_mutex_unlock(&b->mtx)); + } + AZ(pthread_mutex_unlock(&barrier_mtx)); + return; + } + + AZ(strcmp(av[0], "barrier")); + av++; + + AZ(pthread_mutex_lock(&barrier_mtx)); + VTAILQ_FOREACH(b, &barriers, list) + if (!strcmp(b->name, av[0])) + break; + if (b == NULL) + b = barrier_new(av[0], vl); + av++; + AZ(pthread_mutex_lock(&b->mtx)); + AZ(pthread_mutex_unlock(&barrier_mtx)); + + for (; *av != NULL; av++) { + if (!strcmp(*av, "cond")) { + av++; + AN(*av); + barrier_cond(b, *av, vl); + continue; + } + if (!strcmp(*av, "sock")) { + av++; + AN(*av); + barrier_sock(b, *av, vl); + continue; + } + if (!strcmp(*av, "sync")) { + barrier_sync(b, vl); + continue; + } + vtc_log(vl, 0, "Unknown barrier argument: %s", *av); + } + AZ(pthread_mutex_unlock(&b->mtx)); +} + +void +init_barrier(void) +{ + + AZ(pthread_mutex_init(&barrier_mtx, NULL)); +} diff --git a/bin/varnishtest/vtc_http.c b/bin/varnishtest/vtc_http.c index 9d1fe34..b2846f4 100644 --- a/bin/varnishtest/vtc_http.c +++ b/bin/varnishtest/vtc_http.c @@ -1380,6 +1380,7 @@ static const struct cmds http_cmds[] = { { "chunked", cmd_http_chunked }, { "chunkedlen", cmd_http_chunkedlen }, { "delay", cmd_delay }, + { "barrier", cmd_barrier }, { "sema", cmd_sema }, { "expect_close", cmd_http_expect_close }, { "close", cmd_http_close }, From dridi.boukelmoune at gmail.com Tue Mar 29 12:20:05 2016 From: dridi.boukelmoune at gmail.com (Dridi Boukelmoune) Date: Tue, 29 Mar 2016 14:20:05 +0200 Subject: [master] 8942cea Barriers can be cyclic but not like semaphores Message-ID: commit 8942ceaa88f0f3600eca8de7a9bb3139dfc155b3 Author: Dridi Boukelmoune Date: Wed Dec 23 08:27:14 2015 +0100 Barriers can be cyclic but not like semaphores This is useful in HTTP loops where it's impossible to predict and use an array of barriers. All cycles expect the same number of waiters, unlike semaphores. diff --git a/bin/varnishtest/tests/a00008.vtc b/bin/varnishtest/tests/a00008.vtc index 6fe35c9..dfa84d3 100644 --- a/bin/varnishtest/tests/a00008.vtc +++ b/bin/varnishtest/tests/a00008.vtc @@ -1,25 +1,30 @@ varnishtest "Barrier operations" -barrier b1 cond 4 -barrier b2 cond 4 +# bs -> server, bc -> client, bb -> both +barrier bs cond 4 +barrier bc cond 4 +barrier bb cond 4 -cyclic server s1 { rxreq - barrier b1 sync + barrier bs sync + barrier bb sync delay .9 txresp } -start server s2 { rxreq - barrier b1 sync + barrier bs sync + barrier bb sync delay .6 txresp } -start server s3 { rxreq - barrier b1 sync + barrier bs sync + barrier bb sync delay .2 txresp } -start @@ -28,25 +33,30 @@ client c1 -connect ${s1_sock} { delay .2 txreq rxresp - barrier b2 sync + barrier bc sync + barrier bb sync } -start client c2 -connect ${s2_sock} { delay .6 txreq rxresp - barrier b2 sync + barrier bc sync + barrier bb sync } -start client c3 -connect ${s3_sock} { delay .9 txreq rxresp - barrier b2 sync + barrier bc sync + barrier bb sync } -start # Wait for all servers to have received requests -barrier b1 sync +barrier bs sync +barrier bb sync # Wait for all clients to have received responses -barrier b2 sync +barrier bc sync +barrier bb sync diff --git a/bin/varnishtest/vtc_barrier.c b/bin/varnishtest/vtc_barrier.c index 448eb0d..b170c56 100644 --- a/bin/varnishtest/vtc_barrier.c +++ b/bin/varnishtest/vtc_barrier.c @@ -52,6 +52,7 @@ struct barrier { unsigned waiters; unsigned expected; + unsigned cyclic; enum barrier_e type; }; @@ -122,6 +123,23 @@ barrier_sock(struct barrier *b, const char *av, struct vtclog *vl) INCOMPL(); } +static void +barrier_cyclic(struct barrier *b, struct vtclog *vl) +{ + + CHECK_OBJ_NOTNULL(b, BARRIER_MAGIC); + + if (b->type == BARRIER_NONE) + vtc_log(vl, 0, + "Barrier(%s) use error: not initialized", b->name); + + if (b->waiters != 0) + vtc_log(vl, 0, + "Barrier(%s) use error: already in use", b->name); + + b->cyclic = 1; +} + /********************************************************************** * Sync a barrier */ @@ -148,6 +166,9 @@ barrier_cond_sync(struct barrier *b, struct vtclog *vl) b->name, b->waiters, b->expected); AZ(pthread_cond_wait(&b->cond, &b->mtx)); } + + if (b->cyclic) + b->waiters = 0; } static void @@ -189,7 +210,10 @@ cmd_barrier(CMD_ARGS) VTAILQ_FOREACH_SAFE(b, &barriers, list, b2) { AZ(pthread_mutex_lock(&b->mtx)); assert(b->type != BARRIER_NONE); - assert(b->waiters == b->expected); + if (b->cyclic) + AZ(b->waiters); + else + assert(b->waiters == b->expected); AZ(pthread_mutex_unlock(&b->mtx)); } AZ(pthread_mutex_unlock(&barrier_mtx)); @@ -226,6 +250,10 @@ cmd_barrier(CMD_ARGS) barrier_sync(b, vl); continue; } + if (!strcmp(*av, "-cyclic")) { + barrier_cyclic(b, vl); + continue; + } vtc_log(vl, 0, "Unknown barrier argument: %s", *av); } AZ(pthread_mutex_unlock(&b->mtx)); From dridi.boukelmoune at gmail.com Tue Mar 29 12:20:05 2016 From: dridi.boukelmoune at gmail.com (Dridi Boukelmoune) Date: Tue, 29 Mar 2016 14:20:05 +0200 Subject: [master] a668bfc Retire varnishtest semaphores and use barriers Message-ID: commit a668bfc6d9ed18dcb1c4698646125fdca12c8f36 Author: Dridi Boukelmoune Date: Wed Dec 23 11:52:52 2015 +0100 Retire varnishtest semaphores and use barriers All usage of cyclic semaphores has been replaced by non-cylic barriers, except in the disabled test r01252 that absolutely needs one. It still passes when run with the proper requirements. diff --git a/bin/varnishtest/Makefile.am b/bin/varnishtest/Makefile.am index 5732534..9d8c0b5 100644 --- a/bin/varnishtest/Makefile.am +++ b/bin/varnishtest/Makefile.am @@ -32,7 +32,6 @@ varnishtest_SOURCES = \ vtc_http.c \ vtc_main.c \ vtc_log.c \ - vtc_sema.c \ vtc_server.c \ vtc_varnish.c \ vtc_logexp.c \ diff --git a/bin/varnishtest/Makefile.phk b/bin/varnishtest/Makefile.phk index 5c80efd..b50535d 100644 --- a/bin/varnishtest/Makefile.phk +++ b/bin/varnishtest/Makefile.phk @@ -4,7 +4,6 @@ PROG_SRC += vtc_http.c PROG_SRC += vtc_log.c PROG_SRC += vtc_logexp.c PROG_SRC += vtc_main.c -PROG_SRC += vtc_sema.c PROG_SRC += vtc_barrier.c PROG_SRC += vtc_server.c PROG_SRC += vtc_varnish.c diff --git a/bin/varnishtest/tests.disabled/r01252.vtc b/bin/varnishtest/tests.disabled/r01252.vtc index fd820e9..21a2995 100644 --- a/bin/varnishtest/tests.disabled/r01252.vtc +++ b/bin/varnishtest/tests.disabled/r01252.vtc @@ -5,10 +5,12 @@ varnishtest "#1252 - Drop remote closed connections returning from waitinglists" # because it requires "-t 80" argument to varnishtest (remote closed # state will only be detected after FIN timeout has passed (60s)) +barrier b1 cond 2 + server s1 { rxreq expect req.http.X-Client == "1" - sema r1 sync 2 + barrier b1 sync delay 75 close } -start @@ -50,7 +52,7 @@ client c1 { } -start client c2 { - sema r1 sync 2 + barrier b1 sync txreq -hdr "X-Client: 2" delay 1 } -start diff --git a/bin/varnishtest/tests.disabled/r01506.vtc b/bin/varnishtest/tests.disabled/r01506.vtc index f2bb5b2..1d0f0bb 100644 --- a/bin/varnishtest/tests.disabled/r01506.vtc +++ b/bin/varnishtest/tests.disabled/r01506.vtc @@ -1,5 +1,7 @@ varnishtest "range requests on streamed response" +barrier b1 cond 2 -cyclic + server s1 -repeat 4 { rxreq txresp -nolen \ @@ -9,7 +11,7 @@ server s1 -repeat 4 { send "11\r\n1_23456789abcdef\n" send "11\r\n2_23456789abcdef\n" send "11\r\n3_23456789abcdef\n" - sema r1 sync 2 + barrier b1 sync send "11\r\n4_23456789abcdef\n" send "11\r\n5_23456789abcdef\n" send "11\r\n6_23456789abcdef\n" @@ -32,7 +34,7 @@ client c1 { rxresphdrs expect resp.status == 206 expect resp.http.content-length == 85 - sema r1 sync 2 + barrier b1 sync rxrespbody expect resp.bodylen == 85 delay .1 @@ -42,7 +44,7 @@ client c1 { rxresphdrs expect resp.status == 200 expect resp.http.Transfer-Encoding == chunked - sema r1 sync 2 + barrier b1 sync rxrespbody expect resp.bodylen == 136 delay .1 @@ -52,7 +54,7 @@ client c1 { rxresphdrs expect resp.status == 200 expect resp.http.Transfer-Encoding == chunked - sema r1 sync 2 + barrier b1 sync rxrespbody expect resp.bodylen == 136 delay .1 @@ -62,7 +64,7 @@ client c1 { rxresphdrs expect resp.status == 206 expect resp.http.content-length == 99 - sema r1 sync 2 + barrier b1 sync recv 34 delay .3 expect_close diff --git a/bin/varnishtest/tests.disabled/r01732.vtc b/bin/varnishtest/tests.disabled/r01732.vtc index f738dec..052ae09 100644 --- a/bin/varnishtest/tests.disabled/r01732.vtc +++ b/bin/varnishtest/tests.disabled/r01732.vtc @@ -1,17 +1,20 @@ varnishtest "range related panic" +barrier b1 cond 2 +barrier b2 cond 2 + server s1 { rxreq txresp -nolen -hdr "Transfer-Encoding: chunked" chunkedlen 10 chunkedlen 10 - sema r1 sync 2 + barrier b1 sync chunkedlen 10 chunkedlen 10 chunkedlen 10 chunkedlen 0 delay .1 - sema r2 sync 2 + barrier b2 sync } -start varnish v1 -vcl+backend { @@ -25,8 +28,8 @@ client c1 { } -run delay .1 -sema r1 sync 2 -sema r2 sync 2 +barrier b1 sync +barrier b2 sync delay .4 client c1 { diff --git a/bin/varnishtest/tests.disabled/t00000.vtc b/bin/varnishtest/tests.disabled/t00000.vtc index 7dd5818..c84100a 100644 --- a/bin/varnishtest/tests.disabled/t00000.vtc +++ b/bin/varnishtest/tests.disabled/t00000.vtc @@ -1,16 +1,21 @@ varnishtest "Ticket #873" +barrier b1 cond 2 +barrier b2 cond 2 +barrier b3 cond 2 +barrier b4 cond 2 + server s1 { rxreq txresp -nolen -hdr "Transfer-encoding: chunked" chunked "<1>------------------------<1>\n" - sema r1 sync 2 + barrier b1 sync chunked "<2>------------------------<2>\n" - sema r2 sync 2 + barrier b2 sync chunked "<3>------------------------<3>\n" - sema r1 sync 2 + barrier b3 sync chunked "<4>------------------------<4>\n" - sema r2 sync 2 + barrier b4 sync chunkedlen 0 } -start @@ -28,19 +33,19 @@ client c1 { rxchunk expect resp.chunklen == 31 - sema r1 sync 2 + barrier b1 sync rxchunk expect resp.chunklen == 31 - sema r2 sync 2 + barrier b2 sync rxchunk expect resp.chunklen == 31 - sema r1 sync 2 + barrier b3 sync rxchunk expect resp.chunklen == 31 - sema r2 sync 2 + barrier b4 sync rxchunk expect resp.chunklen == 0 diff --git a/bin/varnishtest/tests/c00013.vtc b/bin/varnishtest/tests/c00013.vtc index 70eedad..b833296 100644 --- a/bin/varnishtest/tests/c00013.vtc +++ b/bin/varnishtest/tests/c00013.vtc @@ -1,15 +1,18 @@ varnishtest "Test parking second request on backend delay" +barrier b1 cond 2 +barrier b2 cond 2 + server s1 { rxreq expect req.url == "/foo" send "HTTP/1.0 200 OK\r\nConnection: close\r\n\r\n" delay .2 - sema r1 sync 2 + barrier b1 sync delay .2 send "line1\n" delay .2 - sema r1 sync 2 + barrier b2 sync send "line2\n" } -start @@ -29,12 +32,12 @@ client c1 { expect resp.http.x-varnish == "1001" } -start -sema r1 sync 2 +barrier b1 sync client c2 { txreq -url "/foo" -hdr "client: c2" delay .2 - sema r1 sync 2 + barrier b2 sync rxresp expect resp.status == 200 expect resp.bodylen == 12 diff --git a/bin/varnishtest/tests/c00014.vtc b/bin/varnishtest/tests/c00014.vtc index ec8c9d8..41eb00b 100644 --- a/bin/varnishtest/tests/c00014.vtc +++ b/bin/varnishtest/tests/c00014.vtc @@ -1,9 +1,11 @@ varnishtest "Test parking second request on backend delay, then pass" +barrier b1 cond 2 + server s1 { rxreq expect req.url == "/foo" - sema r1 sync 2 + barrier b1 sync send "HTTP/1.1 200 OK\r\nContent-Length: 12\r\n\r\n" send "line1\n" send "line2\n" @@ -28,7 +30,7 @@ client c1 { expect resp.http.x-varnish == "1001" } -start -sema r1 sync 2 +barrier b1 sync delay .2 client c2 { diff --git a/bin/varnishtest/tests/c00017.vtc b/bin/varnishtest/tests/c00017.vtc index 9342c53..b062980 100644 --- a/bin/varnishtest/tests/c00017.vtc +++ b/bin/varnishtest/tests/c00017.vtc @@ -1,5 +1,7 @@ varnishtest "Test Backend Polling" +barrier b1 cond 2 + server s1 { # Probes loop 8 { @@ -22,7 +24,7 @@ server s1 { accept } - sema r1 sync 2 + barrier b1 sync } -start varnish v1 -vcl { @@ -38,6 +40,6 @@ varnish v1 -vcl { } -start -sema r1 sync 2 +barrier b1 sync varnish v1 -cli "backend.list -p" diff --git a/bin/varnishtest/tests/c00038.vtc b/bin/varnishtest/tests/c00038.vtc index e9402b6..1e81f26 100644 --- a/bin/varnishtest/tests/c00038.vtc +++ b/bin/varnishtest/tests/c00038.vtc @@ -1,8 +1,10 @@ varnishtest "Test req.hash_ignore_busy in vcl_recv" +barrier b1 cond 2 + server s1 { rxreq - sema r1 sync 2 + barrier b1 sync delay 1 txresp -hdr "Server: 1" } -start @@ -36,7 +38,7 @@ client c1 { } -start client c2 { - sema r1 sync 2 + barrier b1 sync txreq -url "/" -hdr "x-client: 2" -hdr "x-ignorebusy: 1" txreq -url "/" -hdr "x-client: 2" rxresp diff --git a/bin/varnishtest/tests/c00043.vtc b/bin/varnishtest/tests/c00043.vtc index 0960621..15d87c7 100644 --- a/bin/varnishtest/tests/c00043.vtc +++ b/bin/varnishtest/tests/c00043.vtc @@ -1,12 +1,14 @@ varnishtest "predictive vary" +barrier b1 cond 2 +barrier b2 cond 2 server s1 { rxreq txresp -hdr "Vary: foo" -bodylen 1 rxreq - sema r2 sync 2 - sema r1 sync 2 + barrier b2 sync + barrier b1 sync txresp -hdr "Vary: foo" -bodylen 2 } -start @@ -33,10 +35,10 @@ client c1 { } -start client c2 { - sema r2 sync 2 + barrier b2 sync txreq -hdr "Foo: vary3" -hdr "bar: yes" rxresp - sema r1 sync 2 + barrier b1 sync expect resp.bodylen == 3 } -start diff --git a/bin/varnishtest/tests/c00058.vtc b/bin/varnishtest/tests/c00058.vtc index b898034..6a2d733 100644 --- a/bin/varnishtest/tests/c00058.vtc +++ b/bin/varnishtest/tests/c00058.vtc @@ -1,11 +1,13 @@ varnishtest "Test v4 grace" +barrier b1 cond 2 + server s1 { rxreq txresp -hdr "Last-Modified: Mon, 09 Feb 2015 09:32:47 GMT" -bodylen 3 rxreq txresp -bodylen 6 - sema r2 sync 2 + barrier b1 sync } -start varnish v1 -vcl+backend { @@ -33,7 +35,7 @@ client c1 { expect resp.bodylen == 3 # But bg fetch was kicked off - sema r2 sync 2 + barrier b1 sync delay .2 # And now we get the new object diff --git a/bin/varnishtest/tests/c00062.vtc b/bin/varnishtest/tests/c00062.vtc index 643a2f6..54e0318 100644 --- a/bin/varnishtest/tests/c00062.vtc +++ b/bin/varnishtest/tests/c00062.vtc @@ -1,12 +1,15 @@ varnishtest "Check that aborted backend body aborts client in streaming mode" +barrier b1 cond 2 +barrier b2 cond 2 + server s1 { rxreq txresp -nolen -hdr "Transfer-encoding: chunked" chunked {} - sema r1 sync 2 + barrier b1 sync chunked {} - sema r1 sync 2 + barrier b2 sync } -start varnish v1 -cliok "param.set debug +syncvsl" -vcl+backend { @@ -19,9 +22,9 @@ client c1 { rxresphdrs expect resp.status == 200 rxchunk - sema r1 sync 2 + barrier b1 sync rxchunk - sema r1 sync 2 + barrier b2 sync expect_close } -run diff --git a/bin/varnishtest/tests/d00009.vtc b/bin/varnishtest/tests/d00009.vtc index 6b20030..fd30602 100644 --- a/bin/varnishtest/tests/d00009.vtc +++ b/bin/varnishtest/tests/d00009.vtc @@ -1,17 +1,20 @@ varnishtest "Test dynamic backends hot swap while being used" +barrier b1 cond 2 +barrier b2 cond 2 + server s1 { rxreq expect req.url == "/foo" - sema r1 sync 2 - sema r2 sync 2 + barrier b1 sync + barrier b2 sync txresp } -start server s2 { rxreq expect req.url == "/bar" - sema r2 sync 2 + barrier b2 sync txresp } -start @@ -42,7 +45,7 @@ client c1 { } -start client c2 { - sema r1 sync 2 + barrier b1 sync txreq -req "SWAP" -hdr "X-Addr: ${s2_addr}" -hdr "X-Port: ${s2_port}" rxresp expect resp.status == 200 diff --git a/bin/varnishtest/tests/d00010.vtc b/bin/varnishtest/tests/d00010.vtc index e67fd54..4646ec2 100644 --- a/bin/varnishtest/tests/d00010.vtc +++ b/bin/varnishtest/tests/d00010.vtc @@ -1,17 +1,20 @@ varnishtest "Test dynamic backends hot swap during a pipe" +barrier b1 cond 2 +barrier b2 cond 2 + server s1 { rxreq expect req.url == "/foo" - sema r1 sync 2 - sema r2 sync 2 + barrier b1 sync + barrier b2 sync txresp } -start server s2 { rxreq expect req.url == "/bar" - sema r2 sync 2 + barrier b2 sync txresp } -start @@ -43,7 +46,7 @@ client c1 { } -start client c2 { - sema r1 sync 2 + barrier b1 sync txreq -req "SWAP" -hdr "X-Addr: ${s2_addr}" -hdr "X-Port: ${s2_port}" rxresp expect resp.status == 200 diff --git a/bin/varnishtest/tests/d00011.vtc b/bin/varnishtest/tests/d00011.vtc index ab1c8e0..f2fb3a4 100644 --- a/bin/varnishtest/tests/d00011.vtc +++ b/bin/varnishtest/tests/d00011.vtc @@ -1,5 +1,7 @@ varnishtest "Test a dynamic backend hot swap after it was picked by a bereq" +barrier b1 cond 2 + server s1 { } -start @@ -41,13 +43,13 @@ varnish v1 -expect MAIN.n_backend == 2 client c1 { txreq - sema r2 sync 2 + barrier b1 sync rxresp expect resp.status == 200 } client c2 { - sema r2 sync 2 + barrier b1 sync delay 0.1 txreq -req "SWAP" -hdr "X-Addr: ${s2_addr}" -hdr "X-Port: ${s2_port}" rxresp diff --git a/bin/varnishtest/tests/d00012.vtc b/bin/varnishtest/tests/d00012.vtc index aba0aec..96d4f65 100644 --- a/bin/varnishtest/tests/d00012.vtc +++ b/bin/varnishtest/tests/d00012.vtc @@ -2,10 +2,12 @@ varnishtest "Test a dynamic backend discard during a request" # vcl.discard testing inspired by v00006.vtc from commit e1f7207 +barrier b1 cond 2 + server s1 { rxreq expect req.url == "/foo" - sema r1 sync 2 + barrier b1 sync txresp } -start @@ -53,7 +55,7 @@ varnish v1 -vcl { } varnish v1 -cli "vcl.discard vcl1" -sema r1 sync 2 +barrier b1 sync client c1 -wait delay 2 diff --git a/bin/varnishtest/tests/d00013.vtc b/bin/varnishtest/tests/d00013.vtc index 4a397ee..12457bf 100644 --- a/bin/varnishtest/tests/d00013.vtc +++ b/bin/varnishtest/tests/d00013.vtc @@ -1,5 +1,7 @@ varnishtest "Test a dynamic backend hot swap after it was hinted to a req" +barrier b1 cond 2 + server s1 { } -start @@ -38,13 +40,13 @@ varnish v1 -expect MAIN.n_backend == 2 client c1 { txreq - sema r2 sync 2 + barrier b1 sync rxresp expect resp.status == 200 } client c2 { - sema r2 sync 2 + barrier b1 sync delay 0.1 txreq -req "SWAP" -hdr "X-Addr: ${s2_addr}" -hdr "X-Port: ${s2_port}" rxresp diff --git a/bin/varnishtest/tests/p00007.vtc b/bin/varnishtest/tests/p00007.vtc index 1daf4e5..a7c232a 100644 --- a/bin/varnishtest/tests/p00007.vtc +++ b/bin/varnishtest/tests/p00007.vtc @@ -1,5 +1,8 @@ varnishtest "test reload of object spanning incomplete segment" +barrier b1 cond 2 +barrier b2 cond 2 + server s1 { rxreq expect req.url == "/1" @@ -8,9 +11,9 @@ server s1 { send "\n" chunkedlen 32 # Tell top-level that it can sync the stevedore - sema r1 sync 2 + barrier b1 sync # Top-level tells us it has synched the stevedore - sema r1 sync 2 + barrier b2 sync chunkedlen 32 chunkedlen 0 accept @@ -36,14 +39,14 @@ client c1 { } -start # Wait for first chunk to have been sent -sema r1 sync 2 +barrier b1 sync delay .2 # Sync the stevedore, so the next chunk ends up i segment 2 varnish v1 -cliok "debug.persistent s0 sync" # Tell server to continue -sema r1 sync 2 +barrier b2 sync # Get the result client c1 -wait diff --git a/bin/varnishtest/tests/r00345.vtc b/bin/varnishtest/tests/r00345.vtc index 8ce2d53..9041acd 100644 --- a/bin/varnishtest/tests/r00345.vtc +++ b/bin/varnishtest/tests/r00345.vtc @@ -1,10 +1,12 @@ varnishtest "#345, ESI waitinglist trouble" +barrier b1 cond 2 + server s1 { rxreq txresp -body {} rxreq - sema r1 sync 2 + barrier b1 sync delay 1 txresp -body {DATA} } -start @@ -25,7 +27,7 @@ client c1 { client c2 { txreq - sema r1 sync 2 + barrier b1 sync rxresp expect resp.bodylen == 4 } -run diff --git a/bin/varnishtest/tests/r00427.vtc b/bin/varnishtest/tests/r00427.vtc index ebeb2ba..c097494 100644 --- a/bin/varnishtest/tests/r00427.vtc +++ b/bin/varnishtest/tests/r00427.vtc @@ -1,5 +1,8 @@ varnishtest "client close in ESI delivery" +barrier b1 cond 2 +barrier b2 cond 2 + server s1 { rxreq txresp -body { @@ -10,8 +13,8 @@ server s1 { rxreq expect req.url == "/foo" - sema r1 sync 2 - sema r1 sync 2 + barrier b1 sync + barrier b2 sync txresp -body "[foo]" rxreq @@ -31,11 +34,11 @@ varnish v1 -vcl+backend { client c1 { txreq - sema r1 sync 2 + barrier b1 sync } -run client c1 { - sema r1 sync 2 + barrier b2 sync txreq rxresp } -run diff --git a/bin/varnishtest/tests/r00667.vtc b/bin/varnishtest/tests/r00667.vtc index 1c1da1f..2782e63 100644 --- a/bin/varnishtest/tests/r00667.vtc +++ b/bin/varnishtest/tests/r00667.vtc @@ -1,9 +1,12 @@ varnishtest "things stuck on busy object" +barrier b1 cond 2 +barrier b2 cond 2 + server s1 { rxreq - sema r1 sync 2 - sema r1 sync 2 + barrier b1 sync + barrier b2 sync # There is a race in varnish between the first request releasing # the backend connection, and the second request trying to get it # which makes reuse of backend connection sometimes work and @@ -29,9 +32,9 @@ client c1 { } -start client c2 { - sema r1 sync 2 + barrier b1 sync txreq - sema r1 sync 2 + barrier b2 sync rxresp expect resp.bodylen == 5 } -start diff --git a/bin/varnishtest/tests/r00963.vtc b/bin/varnishtest/tests/r00963.vtc index 6e8fc1d..f4599f5 100644 --- a/bin/varnishtest/tests/r00963.vtc +++ b/bin/varnishtest/tests/r00963.vtc @@ -1,8 +1,10 @@ varnishtest "Test hsh_rush" +barrier b1 cond 5 + server s1 { rxreq - sema r1 sync 5 + barrier b1 sync txresp -bodylen 10 } -start @@ -13,28 +15,28 @@ varnish v1 -cliok "param.set rush_exponent 2" client c1 { txreq - sema r1 sync 5 + barrier b1 sync rxresp expect resp.bodylen == 10 } -start client c2 { txreq - sema r1 sync 5 + barrier b1 sync rxresp expect resp.bodylen == 10 } -start client c3 { txreq - sema r1 sync 5 + barrier b1 sync rxresp expect resp.bodylen == 10 } -start client c4 { txreq - sema r1 sync 5 + barrier b1 sync rxresp expect resp.bodylen == 10 } -start diff --git a/bin/varnishtest/tests/r01073.vtc b/bin/varnishtest/tests/r01073.vtc index 3e0c44e..c75563f 100644 --- a/bin/varnishtest/tests/r01073.vtc +++ b/bin/varnishtest/tests/r01073.vtc @@ -1,16 +1,19 @@ varnishtest "Test that hash_always_miss also implies hash_ignore_busy. Ticket #1073." +barrier b1 cond 2 +barrier b2 cond 2 + server s1 { rxreq - sema r1 sync 2 - sema r2 sync 2 + barrier b1 sync + barrier b2 sync delay 1 txresp -hdr "Server: 1" } -start server s2 { rxreq - sema r2 sync 2 + barrier b2 sync txresp -hdr "Server: 2" } -start @@ -38,7 +41,7 @@ client c1 { } -start client c2 { - sema r1 sync 2 + barrier b1 sync txreq -url "/" -hdr "x-client: 2" -hdr "x-hash-always-miss: 1" txreq -url "/" -hdr "x-client: 2" rxresp diff --git a/bin/varnishtest/tests/r01391.vtc b/bin/varnishtest/tests/r01391.vtc index 9669e16..6683dde 100644 --- a/bin/varnishtest/tests/r01391.vtc +++ b/bin/varnishtest/tests/r01391.vtc @@ -1,12 +1,13 @@ varnishtest "client abandoning hit-for-pass" +barrier b1 cond 2 server s1 { non-fatal rxreq txresp -nolen -hdr "Transfer-Encoding: chunked" -hdr "Set-Cookie: foo=bar" chunked "foo" - sema r1 sync 2 + barrier b1 sync chunked "bar" delay .1 chunkedlen 64 @@ -21,7 +22,7 @@ client c1 { txreq rxresphdrs rxchunk - sema r1 sync 2 + barrier b1 sync } -run delay 2 diff --git a/bin/varnishtest/tests/r01399.vtc b/bin/varnishtest/tests/r01399.vtc index 5d7171a..c7adffa 100644 --- a/bin/varnishtest/tests/r01399.vtc +++ b/bin/varnishtest/tests/r01399.vtc @@ -1,10 +1,12 @@ varnishtest "1399 race issue with bg-fetches" +barrier b1 cond 2 + server s1 { rxreq txresp -bodylen 1 - sema r1 sync 2 + barrier b1 sync # Delay here, to stall the bgfetch for a while, to give the req time to finish # delivery and cleanup up struct req @@ -43,7 +45,7 @@ client c1 { txreq rxresp expect resp.http.content-length == 1 - sema r1 sync 2 + barrier b1 sync } -run # Wait for the server to not explode diff --git a/bin/varnishtest/tests/r01419.vtc b/bin/varnishtest/tests/r01419.vtc index a47d424..84130b9 100644 --- a/bin/varnishtest/tests/r01419.vtc +++ b/bin/varnishtest/tests/r01419.vtc @@ -1,14 +1,17 @@ varnishtest "Make sure banlurker skips busy objects" +barrier b1 cond 2 +barrier b2 cond 2 + server s1 { rxreq send "HTTP/1.0 200 OK\r\n" - sema r1 sync 2 + barrier b1 sync send "Foobar: blaf\r\n" send "Content-Length: 10\r\n" send "\r\n\r\n" send "abcde" - sema r2 sync 2 + barrier b2 sync send "abcdefghij" } -start @@ -29,7 +32,7 @@ client c1 { expect resp.http.foobar == blaf } -start -sema r1 sync 2 +barrier b1 sync varnish v1 -cliok {ban.list} varnish v1 -cliok {ban obj.http.goo == bar} @@ -38,6 +41,6 @@ delay 2 varnish v1 -cliok {ban.list} -sema r2 sync 2 +barrier b2 sync client c1 -wait diff --git a/bin/varnishtest/tests/r01468.vtc b/bin/varnishtest/tests/r01468.vtc index 119c1da..10b97cf 100644 --- a/bin/varnishtest/tests/r01468.vtc +++ b/bin/varnishtest/tests/r01468.vtc @@ -1,11 +1,14 @@ varnishtest "#1468 - freeing failed obj" +barrier b1 cond 2 +barrier b2 cond 2 + server s1 { rxreq expect req.url == "/1" txresp -nolen -hdr "Transfer-Encoding: chunked" chunked {} - sema r1 sync 2 + barrier b1 sync close accept @@ -13,7 +16,7 @@ server s1 { expect req.url == "/2" txresp -nolen -hdr "Transfer-Encoding: chunked" chunked {} - sema r1 sync 2 + barrier b2 sync } -start varnish v1 -vcl+backend { @@ -33,7 +36,7 @@ client c1 { rxresphdrs expect resp.status == 200 rxchunk - sema r1 sync 2 + barrier b1 sync expect_close } -run @@ -43,7 +46,7 @@ client c1 { rxresphdrs expect resp.status == 200 rxchunk - sema r1 sync 2 + barrier b2 sync expect_close } -run diff --git a/bin/varnishtest/tests/r01478.vtc b/bin/varnishtest/tests/r01478.vtc index 1df49a6..a6844c4 100644 --- a/bin/varnishtest/tests/r01478.vtc +++ b/bin/varnishtest/tests/r01478.vtc @@ -1,23 +1,28 @@ varnishtest "panic due to hash_ignore_busy" +barrier b1 cond 2 +barrier b2 cond 2 +barrier b3 cond 2 +barrier b4 cond 2 + server s1 { rxreq txresp -nolen -hdr "Transfer-Encoding: chunked" chunkedlen 10 delay .5 - sema r1 sync 2 + barrier b1 sync delay .5 chunkedlen 10 delay .5 - sema r2 sync 2 + barrier b2 sync delay .5 chunkedlen 10 delay .5 - sema r3 sync 2 + barrier b3 sync delay .5 chunkedlen 10 delay .5 - sema r4 sync 2 + barrier b4 sync delay .5 chunkedlen 10 delay .5 @@ -41,17 +46,17 @@ client c1 { rxresp } -start -sema r1 sync 2 +barrier b1 sync client c2 { txreq -hdr "client: c2" - sema r2 sync 2 + barrier b2 sync rxresp } -start -sema r3 sync 2 +barrier b3 sync client c3 { txreq -hdr "client: c3" - sema r4 sync 2 + barrier b4 sync rxresp } -start diff --git a/bin/varnishtest/tests/r01646.vtc b/bin/varnishtest/tests/r01646.vtc index 951350e..10b640e 100644 --- a/bin/varnishtest/tests/r01646.vtc +++ b/bin/varnishtest/tests/r01646.vtc @@ -1,12 +1,15 @@ varnishtest "cond/stream race ?" +barrier b1 cond 3 +barrier b2 cond 2 + server s1 { rxreq txresp -nolen -hdr "Transfer-Encoding: chunked" -hdr "Etag: foo" chunkedlen 32 - sema r1 sync 3 + barrier b1 sync chunkedlen 32 - sema r2 sync 2 + barrier b2 sync chunkedlen 32 chunkedlen 0 } -start @@ -35,17 +38,17 @@ varnish v1 -cliok "param.set debug +syncvsl" client c1 { txreq rxresphdrs - sema r1 sync 3 + barrier b1 sync rxrespbody expect resp.bodylen == 96 } -start client c2 { - sema r1 sync 3 + barrier b1 sync delay 2 txreq -hdr "foo: s2" rxresphdrs - sema r2 sync 2 + barrier b2 sync rxrespbody expect resp.bodylen == 96 } -start diff --git a/bin/varnishtest/tests/r01648.vtc b/bin/varnishtest/tests/r01648.vtc index de0c364..1a8cef9 100644 --- a/bin/varnishtest/tests/r01648.vtc +++ b/bin/varnishtest/tests/r01648.vtc @@ -1,10 +1,12 @@ varnishtest "#1648 - corrupt object in cache through IMS update" +barrier b1 cond 3 + # This server sends a broken response body server s1 { rxreq txresp -nolen -hdr "Transfer-Encoding: chunked" -hdr "Etag: \"foo\"" -hdr "Server: s1" - sema r1 sync 3 + barrier b1 sync delay 1 chunked "abc" } -start @@ -13,7 +15,7 @@ server s1 { server s2 { rxreq expect req.http.If-None-Match == "\"foo\"" - sema r1 sync 3 + barrier b1 sync txresp -status 304 -nolen -hdr "Server: s2" } -start @@ -58,7 +60,7 @@ delay 1 # IMS update by s2 client c2 { txreq -hdr "Client: c2" - sema r1 sync 3 + barrier b1 sync rxresphdrs expect resp.status == 200 expect resp.http.transfer-encoding == "chunked" diff --git a/bin/varnishtest/tests/r01737.vtc b/bin/varnishtest/tests/r01737.vtc index 66c5aee..182d1f0 100644 --- a/bin/varnishtest/tests/r01737.vtc +++ b/bin/varnishtest/tests/r01737.vtc @@ -1,5 +1,7 @@ varnishtest "#1737 - ESI sublevel session close" +barrier b1 cond 2 + # Build a esi request tree that fails on flush before include at two different # levels. Synchronize a client close after the response headers have been # received by the client. This produces write erros for the body parts in all @@ -7,7 +9,7 @@ varnishtest "#1737 - ESI sublevel session close" server s1 { rxreq txresp -body {} - sema r1 sync 2 + barrier b1 sync rxreq delay 1 @@ -31,7 +33,7 @@ varnish v1 -vcl+backend { client c1 { txreq rxresp -no_obj - sema r1 sync 2 + barrier b1 sync } -run delay 3 diff --git a/bin/varnishtest/tests/r01818.vtc b/bin/varnishtest/tests/r01818.vtc index ee887a8..2fe8ae3 100644 --- a/bin/varnishtest/tests/r01818.vtc +++ b/bin/varnishtest/tests/r01818.vtc @@ -1,5 +1,8 @@ varnishtest "#1818: verify that grace works for hit_for_pass objects" +barrier b1 cond 2 +barrier b2 cond 2 + server s1 { rxreq expect req.http.a == "1" @@ -7,15 +10,15 @@ server s1 { rxreq expect req.http.b == "1" - sema r2 sync 2 - sema r1 sync 2 + barrier b2 sync + barrier b1 sync txresp } -start server s2 { rxreq expect req.http.c == "1" - sema r1 sync 2 + barrier b1 sync txresp } -start @@ -68,7 +71,7 @@ client c1 { } -start client c2 { - sema r2 sync 2 + barrier b2 sync txreq -hdr "c: 1" rxresp expect resp.http.pass == "1" diff --git a/bin/varnishtest/tests/s00001.vtc b/bin/varnishtest/tests/s00001.vtc index 0223916..77fe6fe 100644 --- a/bin/varnishtest/tests/s00001.vtc +++ b/bin/varnishtest/tests/s00001.vtc @@ -1,10 +1,12 @@ varnishtest "Simple expiry test (fully reaped object)" +barrier b1 cond 2 + server s1 { rxreq expect req.url == "/" txresp -hdr "Cache-control: max-age = 1" -body "1111\n" - sema r1 sync 2 + barrier b1 sync rxreq expect req.url == "/" txresp -hdr "Cache-control: max-age = 1" -body "22222\n" @@ -23,7 +25,7 @@ client c1 { expect resp.status == 200 } -run -sema r1 sync 2 +barrier b1 sync delay 1.1 client c2 { diff --git a/bin/varnishtest/tests/s00002.vtc b/bin/varnishtest/tests/s00002.vtc index 10049c0..3d8442e 100644 --- a/bin/varnishtest/tests/s00002.vtc +++ b/bin/varnishtest/tests/s00002.vtc @@ -1,5 +1,8 @@ varnishtest "Check grace with sick backends" +barrier b1 cond 2 +barrier b2 cond 2 + server s1 { rxreq expect req.url == "/" @@ -11,7 +14,7 @@ server s1 { expect req.url == "/" txresp -proto HTTP/1.0 -hdr "nbr: 2" -body "hi" - sema r1 sync 2 + barrier b1 sync accept rxreq @@ -30,7 +33,7 @@ server s1 { txresp -proto HTTP/1.0 -status 400 -hdr "nbr: 5" -body "hi" accept - sema r1 sync 2 + barrier b2 sync } -start @@ -53,7 +56,7 @@ varnish v1 -vcl { } } -start -sema r1 sync 2 +barrier b1 sync client c1 { txreq -url "/" @@ -62,7 +65,7 @@ client c1 { expect resp.status == 200 } -run -sema r1 sync 2 +barrier b2 sync client c2 { txreq -url "/" diff --git a/bin/varnishtest/tests/v00010.vtc b/bin/varnishtest/tests/v00010.vtc index 7dd839c..43fb083 100644 --- a/bin/varnishtest/tests/v00010.vtc +++ b/bin/varnishtest/tests/v00010.vtc @@ -1,5 +1,8 @@ varnishtest "VCL: check panic and restart" +barrier b1 cond 2 +barrier b2 cond 2 + server s1 { rxreq txresp -hdr "Foo: bar" -body "abcdef\n" @@ -7,7 +10,7 @@ server s1 { txresp -hdr "Panic: fetch" -body "012345\n" close - sema r1 sync 2 + barrier b1 sync accept rxreq txresp -hdr "Foo: bar" -body "abcdef\n" @@ -15,7 +18,7 @@ server s1 { txresp -hdr "Panic: deliver" -body "012345\n" close - sema r1 sync 2 + barrier b2 sync accept rxreq txresp -hdr "Foo: foo" -body "abcdef\n" @@ -53,7 +56,7 @@ varnish v1 -expect MGT.child_panic == 1 varnish v1 -clierr 300 "panic.clear" varnish v1 -cliok "start" varnish v1 -wait-running -sema r1 sync 2 +barrier b1 sync delay 0.5 @@ -71,7 +74,7 @@ varnish v1 -expect MGT.child_panic == 0 varnish v1 -clierr 300 "panic.clear" varnish v1 -cliok "start" varnish v1 -wait-running -sema r1 sync 2 +barrier b2 sync delay 0.5 diff --git a/bin/varnishtest/tests/v00012.vtc b/bin/varnishtest/tests/v00012.vtc index e7c8d44..f68e26a 100644 --- a/bin/varnishtest/tests/v00012.vtc +++ b/bin/varnishtest/tests/v00012.vtc @@ -1,9 +1,12 @@ varnishtest "Check backend connection limit" +barrier b1 cond 2 +barrier b2 cond 2 + server s1 { rxreq - sema r1 sync 2 - sema r2 sync 2 + barrier b1 sync + barrier b2 sync txresp } -start @@ -27,13 +30,13 @@ client c1 { client c2 { - sema r1 sync 2 + barrier b1 sync txreq rxresp expect resp.status == 503 } -run -sema r2 sync 2 +barrier b2 sync client c1 -wait varnish v1 -expect backend_busy == 1 diff --git a/bin/varnishtest/tests/v00014.vtc b/bin/varnishtest/tests/v00014.vtc index 78b0288..01c8251 100644 --- a/bin/varnishtest/tests/v00014.vtc +++ b/bin/varnishtest/tests/v00014.vtc @@ -1,18 +1,23 @@ varnishtest "Check req.backend.healthy" +barrier b1 cond 2 +barrier b2 cond 2 +barrier b3 cond 2 +barrier b4 cond 2 + server s1 { rxreq - sema r1 sync 2 + barrier b1 sync expect req.url == "/" txresp -body "slash" accept rxreq - sema r2 sync 2 - sema r3 sync 2 + barrier b2 sync + barrier b3 sync expect req.url == "/" txresp -body "slash" accept - sema r4 sync 2 + barrier b4 sync } -start varnish v1 -vcl { @@ -51,15 +56,15 @@ client c1 { rxresp expect resp.status == 500 - sema r1 sync 2 + barrier b1 sync - sema r2 sync 2 + barrier b2 sync txreq rxresp expect resp.status == 500 - sema r3 sync 2 - sema r4 sync 2 + barrier b3 sync + barrier b4 sync txreq rxresp expect resp.status == 200 diff --git a/bin/varnishtest/vtc.c b/bin/varnishtest/vtc.c index fc42c72..d862554 100644 --- a/bin/varnishtest/vtc.c +++ b/bin/varnishtest/vtc.c @@ -618,7 +618,6 @@ static const struct cmds cmds[] = { { "varnishtest",cmd_varnishtest }, { "shell", cmd_shell }, { "err_shell", cmd_err_shell }, - { "sema", cmd_sema }, { "barrier", cmd_barrier }, { "random", cmd_random }, { "feature", cmd_feature }, @@ -641,7 +640,6 @@ exec_file(const char *fn, const char *script, const char *tmpdir, AN(vltop); init_macro(); - init_sema(); init_barrier(); init_server(); diff --git a/bin/varnishtest/vtc.h b/bin/varnishtest/vtc.h index 584b1ba..23095d4 100644 --- a/bin/varnishtest/vtc.h +++ b/bin/varnishtest/vtc.h @@ -61,7 +61,6 @@ cmd_f cmd_delay; cmd_f cmd_server; cmd_f cmd_client; cmd_f cmd_varnish; -cmd_f cmd_sema; cmd_f cmd_barrier; cmd_f cmd_logexp; cmd_f cmd_process; @@ -74,7 +73,6 @@ extern unsigned vtc_maxdur; extern int vtc_witness; extern int feature_dns; -void init_sema(void); void init_barrier(void); void init_server(void); diff --git a/bin/varnishtest/vtc_http.c b/bin/varnishtest/vtc_http.c index b2846f4..20f7354 100644 --- a/bin/varnishtest/vtc_http.c +++ b/bin/varnishtest/vtc_http.c @@ -1381,7 +1381,6 @@ static const struct cmds http_cmds[] = { { "chunkedlen", cmd_http_chunkedlen }, { "delay", cmd_delay }, { "barrier", cmd_barrier }, - { "sema", cmd_sema }, { "expect_close", cmd_http_expect_close }, { "close", cmd_http_close }, { "accept", cmd_http_accept }, diff --git a/bin/varnishtest/vtc_sema.c b/bin/varnishtest/vtc_sema.c deleted file mode 100644 index 1cab9d1..0000000 --- a/bin/varnishtest/vtc_sema.c +++ /dev/null @@ -1,162 +0,0 @@ -/*- - * Copyright (c) 2008-2010 Varnish Software AS - * All rights reserved. - * - * Author: Poul-Henning Kamp - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL AUTHOR OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - */ - -#include "config.h" - -#include -#include -#include -#include - -#include "vtc.h" - -struct sema { - unsigned magic; -#define SEMA_MAGIC 0x29b64317 - char *name; - VTAILQ_ENTRY(sema) list; - pthread_mutex_t mtx; - pthread_cond_t cond; - - unsigned waiters; - unsigned expected; -}; - -static pthread_mutex_t sema_mtx; -static VTAILQ_HEAD(, sema) semas = VTAILQ_HEAD_INITIALIZER(semas); - -/********************************************************************** - * Allocate and initialize a sema - */ - -static struct sema * -sema_new(char *name, struct vtclog *vl) -{ - struct sema *r; - - ALLOC_OBJ(r, SEMA_MAGIC); - AN(r); - AN(name); - if (*name != 'r') - vtc_log(vl, 0, "Sema name must start with 'r' (%s)", name); - r->name = name; - - AZ(pthread_mutex_init(&r->mtx, NULL)); - AZ(pthread_cond_init(&r->cond, NULL)); - r->waiters = 0; - r->expected = 0; - VTAILQ_INSERT_TAIL(&semas, r, list); - return (r); -} - -/********************************************************************** - * Sync a sema - */ - -static void -sema_sync(struct sema *r, const char *av, struct vtclog *vl) -{ - unsigned u; - - CHECK_OBJ_NOTNULL(r, SEMA_MAGIC); - u = strtoul(av, NULL, 0); - - if (r->expected == 0) - r->expected = u; - if (r->expected != u) - vtc_log(vl, 0, - "Sema(%s) use error: different expectations (%u vs %u)", - r->name, r->expected, u); - - if (++r->waiters == r->expected) { - vtc_log(vl, 4, "Sema(%s) wake %u", r->name, r->expected); - AZ(pthread_cond_broadcast(&r->cond)); - r->waiters = 0; - r->expected = 0; - } else { - vtc_log(vl, 4, "Sema(%s) wait %u of %u", - r->name, r->waiters, r->expected); - AZ(pthread_cond_wait(&r->cond, &r->mtx)); - } -} - -/********************************************************************** - * Semaphore command dispatch - */ - -void -cmd_sema(CMD_ARGS) -{ - struct sema *r, *r2; - - (void)priv; - (void)cmd; - - if (av == NULL) { - AZ(pthread_mutex_lock(&sema_mtx)); - /* Reset and free */ - VTAILQ_FOREACH_SAFE(r, &semas, list, r2) { - AZ(pthread_mutex_lock(&r->mtx)); - AZ(r->waiters); - AZ(r->expected); - AZ(pthread_mutex_unlock(&r->mtx)); - } - AZ(pthread_mutex_unlock(&sema_mtx)); - return; - } - - AZ(strcmp(av[0], "sema")); - av++; - - AZ(pthread_mutex_lock(&sema_mtx)); - VTAILQ_FOREACH(r, &semas, list) - if (!strcmp(r->name, av[0])) - break; - if (r == NULL) - r = sema_new(av[0], vl); - av++; - AZ(pthread_mutex_lock(&r->mtx)); - AZ(pthread_mutex_unlock(&sema_mtx)); - - for (; *av != NULL; av++) { - if (!strcmp(*av, "sync")) { - av++; - AN(*av); - sema_sync(r, *av, vl); - continue; - } - vtc_log(vl, 0, "Unknown sema argument: %s", *av); - } - AZ(pthread_mutex_unlock(&r->mtx)); -} - -void -init_sema(void) -{ - AZ(pthread_mutex_init(&sema_mtx, NULL)); -} From dridi.boukelmoune at gmail.com Tue Mar 29 12:20:05 2016 From: dridi.boukelmoune at gmail.com (Dridi Boukelmoune) Date: Tue, 29 Mar 2016 14:20:05 +0200 Subject: [master] 0899861 Barriers can only be created on the top thread Message-ID: commit 0899861529ad56054f2cd76870863fe5b0a6dd96 Author: Dridi Boukelmoune Date: Wed Dec 23 16:24:02 2015 +0100 Barriers can only be created on the top thread This is similar ASSERT_CLI, in order to make socket barriers creation thread-safe. diff --git a/bin/varnishtest/vtc_barrier.c b/bin/varnishtest/vtc_barrier.c index b170c56..ba80cfb 100644 --- a/bin/varnishtest/vtc_barrier.c +++ b/bin/varnishtest/vtc_barrier.c @@ -70,6 +70,9 @@ barrier_new(char *name, struct vtclog *vl) AN(name); if (*name != 'b') vtc_log(vl, 0, "Barrier name must start with 'b' (%s)", name); + if (pthread_self() != vtc_thread) + vtc_log(vl, 0, + "Barrier %s can only be created on the top thread", name); REPLACE(b->name, name); AZ(pthread_mutex_init(&b->mtx, NULL)); From dridi.boukelmoune at gmail.com Tue Mar 29 12:20:05 2016 From: dridi.boukelmoune at gmail.com (Dridi Boukelmoune) Date: Tue, 29 Mar 2016 14:20:05 +0200 Subject: [master] db395f8 Implement socket barriers (shared between processes) Message-ID: commit db395f8d7edeea6935310eedce55bc88160f7b48 Author: Dridi Boukelmoune Date: Wed Dec 23 17:29:24 2015 +0100 Implement socket barriers (shared between processes) When varnishtest creates a socket barrier, it will bind a socket and listen to incoming connections. Once the number of expected connections is open, connections are closed. Barrier users only need to connect to the socket, read "nothing" and block until the connection is closed. It allows virtually any process to sync with varnishtest. The barrier will provide macros with its socket information. diff --git a/bin/varnishtest/tests/a00013.vtc b/bin/varnishtest/tests/a00013.vtc new file mode 100644 index 0000000..91bfce0 --- /dev/null +++ b/bin/varnishtest/tests/a00013.vtc @@ -0,0 +1,64 @@ +varnishtest "Barrier operations" + +# same as a00008.vtc, with socket barriers instead + +# bs -> server, bc -> client, bb -> both +barrier bs sock 4 +barrier bc sock 4 +barrier bb sock 4 -cyclic + +server s1 { + rxreq + barrier bs sync + barrier bb sync + delay .9 + txresp +} -start + +server s2 { + rxreq + barrier bs sync + barrier bb sync + delay .6 + txresp +} -start + +server s3 { + rxreq + barrier bs sync + barrier bb sync + delay .2 + txresp +} -start + +client c1 -connect ${s1_sock} { + delay .2 + txreq + rxresp + barrier bc sync + barrier bb sync +} -start + +client c2 -connect ${s2_sock} { + delay .6 + txreq + rxresp + barrier bc sync + barrier bb sync +} -start + +client c3 -connect ${s3_sock} { + delay .9 + txreq + rxresp + barrier bc sync + barrier bb sync +} -start + +# Wait for all servers to have received requests +barrier bs sync +barrier bb sync + +# Wait for all clients to have received responses +barrier bc sync +barrier bb sync diff --git a/bin/varnishtest/vtc_barrier.c b/bin/varnishtest/vtc_barrier.c index ba80cfb..47ac4dc 100644 --- a/bin/varnishtest/vtc_barrier.c +++ b/bin/varnishtest/vtc_barrier.c @@ -28,13 +28,19 @@ #include "config.h" +#include #include #include #include #include #include +#include +#include +#include + #include "vtc.h" +#include "vtcp.h" enum barrier_e { BARRIER_NONE = 0, @@ -55,6 +61,9 @@ struct barrier { unsigned cyclic; enum barrier_e type; + /* fields below are only for BARRIER_SOCK */ + pthread_t thread; + volatile unsigned active; }; static pthread_mutex_t barrier_mtx; @@ -116,6 +125,108 @@ barrier_cond(struct barrier *b, const char *av, struct vtclog *vl) b->type = BARRIER_COND; } +static void * +barrier_sock_thread(void *priv) +{ + struct barrier *b; + struct vtclog *vl; + struct timeval tmo; + const char *err; + char abuf[16], pbuf[6]; + int i, sock, *conns; + fd_set rfds; + + CAST_OBJ_NOTNULL(b, priv, BARRIER_MAGIC); + assert(b->type == BARRIER_SOCK); + + AZ(pthread_mutex_lock(&b->mtx)); + + vl = vtc_logopen(b->name); + AN(vl); + + sock = VTCP_listen_on("127.0.0.1:0", NULL, b->expected, &err); + if (sock < 0) { + pthread_cond_signal(&b->cond); + AZ(pthread_mutex_unlock(&b->mtx)); + vtc_log(vl, 0, "Barrier(%s) %s fails: %s (errno=%d)", + b->name, err, strerror(errno), errno); + } + assert(sock > 0); + (void)VTCP_nonblocking(sock); + VTCP_myname(sock, abuf, sizeof abuf, pbuf, sizeof pbuf); + + macro_def(vl, b->name, "addr", "%s", abuf); + macro_def(vl, b->name, "port", "%s", pbuf); + macro_def(vl, b->name, "sock", "%s:%s", abuf, pbuf); + + pthread_cond_signal(&b->cond); + AZ(pthread_mutex_unlock(&b->mtx)); + + conns = calloc(b->expected, sizeof *conns); + AN(conns); + + while (b->active) { + FD_ZERO(&rfds); + FD_SET(sock, &rfds); + + tmo.tv_sec = 1; + tmo.tv_usec = 0; + i = select(sock + 1, &rfds, NULL, NULL, &tmo); + if (i == 0) + continue; + if (i < 0) { + if (errno == EINTR) + continue; + AZ(close(sock)); + vtc_log(vl, 0, + "Barrier(%s) select fails: %s (errno=%d)", + b->name, strerror(errno), errno); + } + assert(i == 1); + assert(b->waiters <= b->expected); + if (b->waiters == b->expected) + vtc_log(vl, 0, + "Barrier(%s) use error: " + "more waiters than the %u expected", + b->name, b->expected); + + i = accept(sock, NULL, NULL); + if (i < 0) { + AZ(close(sock)); + vtc_log(vl, 0, + "Barrier(%s) accept fails: %s (errno=%d)", + b->name, strerror(errno), errno); + } + + /* NB. We don't keep track of the established connections, only + * that connections were made to the barrier's socket. + */ + conns[b->waiters] = i; + + if (++b->waiters < b->expected) { + vtc_log(vl, 4, "Barrier(%s) wait %u of %u", + b->name, b->waiters, b->expected); + continue; + } + + vtc_log(vl, 4, "Barrier(%s) wake %u", b->name, b->expected); + for (i = 0; i < b->expected; i++) + AZ(close(conns[i])); + + if (b->cyclic) + b->waiters = 0; + else + b->active = 0; + } + + macro_undef(vl, b->name, "addr"); + macro_undef(vl, b->name, "port"); + macro_undef(vl, b->name, "sock"); + AZ(close(sock)); + + return (NULL); +} + static void barrier_sock(struct barrier *b, const char *av, struct vtclog *vl) { @@ -123,7 +234,13 @@ barrier_sock(struct barrier *b, const char *av, struct vtclog *vl) CHECK_OBJ_NOTNULL(b, BARRIER_MAGIC); barrier_expect(b, av, vl); b->type = BARRIER_SOCK; - INCOMPL(); + b->active = 1; + + /* NB. We can use the BARRIER_COND's pthread_cond_t to wait until the + * socket is ready for convenience. + */ + AZ(pthread_create(&b->thread, NULL, barrier_sock_thread, b)); + AZ(pthread_cond_wait(&b->cond, &b->mtx)); } static void @@ -175,6 +292,46 @@ barrier_cond_sync(struct barrier *b, struct vtclog *vl) } static void +barrier_sock_sync(struct barrier *b, struct vtclog *vl) +{ + struct vsb *vsb; + const char *err; + char buf[32]; + int i, sock; + ssize_t sz; + + CHECK_OBJ_NOTNULL(b, BARRIER_MAGIC); + assert(b->type == BARRIER_SOCK); + + i = snprintf(buf, sizeof buf, "${%s_sock}", b->name); + assert(i > 0 && i < sizeof buf); + vsb = macro_expand(vl, buf); + vtc_log(vl, 4, "Barrier(%s) sync with socket", b->name); + + sock = VTCP_open(VSB_data(vsb), NULL, 0., &err); + if (sock < 0) + vtc_log(vl, 0, "Barrier(%s) connection failed: %s", + b->name, err); + + VSB_delete(vsb); + + /* emulate pthread_cond_wait's behavior */ + AZ(pthread_mutex_unlock(&b->mtx)); + sz = read(sock, buf, sizeof buf); /* XXX loop with timeout? */ + AZ(pthread_mutex_lock(&b->mtx)); + + i = errno; + AZ(close(sock)); + + if (sz < 0) + vtc_log(vl, 0, "Barrier(%s) connection failed: %s (errno=%d)", + b->name, strerror(i), i); + if (sz > 0) + vtc_log(vl, 0, "Barrier(%s) unexpected data (%ldB)", + b->name, sz); +} + +static void barrier_sync(struct barrier *b, struct vtclog *vl) { @@ -188,7 +345,7 @@ barrier_sync(struct barrier *b, struct vtclog *vl) barrier_cond_sync(b, vl); break; case BARRIER_SOCK: - INCOMPL(); + barrier_sock_sync(b, vl); break; default: WRONG("Wrong barrier type"); @@ -212,11 +369,20 @@ cmd_barrier(CMD_ARGS) /* Reset and free */ VTAILQ_FOREACH_SAFE(b, &barriers, list, b2) { AZ(pthread_mutex_lock(&b->mtx)); - assert(b->type != BARRIER_NONE); - if (b->cyclic) - AZ(b->waiters); - else - assert(b->waiters == b->expected); + switch (b->type) { + case BARRIER_COND: + if (b->cyclic) + AZ(b->waiters); + else + assert(b->waiters == b->expected); + break; + case BARRIER_SOCK: + b->active = 0; + AZ(pthread_join(b->thread, NULL)); + break; + default: + WRONG("Wrong barrier type"); + } AZ(pthread_mutex_unlock(&b->mtx)); } AZ(pthread_mutex_unlock(&barrier_mtx)); From dridi.boukelmoune at gmail.com Tue Mar 29 12:20:05 2016 From: dridi.boukelmoune at gmail.com (Dridi Boukelmoune) Date: Tue, 29 Mar 2016 14:20:05 +0200 Subject: [master] f445be5 Teach vmod-debug how to sync with varnishtest Message-ID: commit f445be5b92d4fa212efaac0b0b9ff72a5be940dc Author: Dridi Boukelmoune Date: Thu Dec 24 10:28:46 2015 +0100 Teach vmod-debug how to sync with varnishtest diff --git a/bin/varnishtest/tests/m00024.vtc b/bin/varnishtest/tests/m00024.vtc new file mode 100644 index 0000000..2124589 --- /dev/null +++ b/bin/varnishtest/tests/m00024.vtc @@ -0,0 +1,39 @@ +varnishtest "Test debug.barrier_sync" + +barrier b1 sock 2 +barrier b2 sock 2 + +server s1 { + rxreq + txresp +} -start + +varnish v1 -vcl+backend { + import debug; + + sub vcl_recv { + if (!debug.barrier_sync("${b1_sock}")) { + return (synth(400)); + } + } + + sub vcl_backend_response { + if (!debug.barrier_sync("${b2_sock}")) { + return (abandon); + } + } +} -start + +varnish v1 -cliok "param.set debug +syncvsl" + +client c1 { + txreq + rxresp + expect resp.status == 200 +} -start + +barrier b1 sync +delay 0.5 +barrier b2 sync + +client c1 -wait diff --git a/lib/libvmod_debug/vmod.vcc b/lib/libvmod_debug/vmod.vcc index 1725689..1a74349 100644 --- a/lib/libvmod_debug/vmod.vcc +++ b/lib/libvmod_debug/vmod.vcc @@ -154,3 +154,7 @@ Hold a reference to the VCL when it goes cold for the given delay. $Function BOOL match_acl(ACL acl, IP ip) Perform an IP match against a named ACL. + +$Function BOOL barrier_sync(STRING) + +Synchronize with a varnishtest shared barrier. diff --git a/lib/libvmod_debug/vmod_debug.c b/lib/libvmod_debug/vmod_debug.c index d1e79ed..1f671ae 100644 --- a/lib/libvmod_debug/vmod_debug.c +++ b/lib/libvmod_debug/vmod_debug.c @@ -28,6 +28,7 @@ #include "config.h" +#include #include #include #include @@ -38,6 +39,7 @@ #include "vrt.h" #include "vsa.h" #include "vsb.h" +#include "vtcp.h" #include "vtim.h" #include "vcc_if.h" @@ -478,3 +480,34 @@ vmod_match_acl(VRT_CTX, VCL_ACL acl, VCL_IP ip) return (VRT_acl_match(ctx, acl, ip)); } + +VCL_BOOL +vmod_barrier_sync(VRT_CTX, VCL_STRING addr) +{ + const char *err; + char buf[32]; + int sock; + ssize_t sz; + + CHECK_OBJ_NOTNULL(ctx, VRT_CTX_MAGIC); + AN(addr); + AN(*addr); + + VSLb(ctx->vsl, SLT_VCL_call, "barrier_sync(\"%s\")", addr); + sock = VTCP_open(addr, NULL, 0., &err); + if (sock < 0) { + VSLb(ctx->vsl, SLT_Error, "Barrier connection failed: %s", err); + return (0); + } + + sz = read(sock, buf, sizeof buf); + if (sz == 0) + return (1); + if (sz < 0) + VSLb(ctx->vsl, SLT_Error, + "Barrier connection failed: %s (errno=%d)", + strerror(errno), errno); + if (sz > 0) + VSLb(ctx->vsl, SLT_Error, "Barrier unexpected data (%ldB)", sz); + return (0); +} From dridi.boukelmoune at gmail.com Tue Mar 29 12:20:05 2016 From: dridi.boukelmoune at gmail.com (Dridi Boukelmoune) Date: Tue, 29 Mar 2016 14:20:05 +0200 Subject: [master] f6a7b61 Close the socket Message-ID: commit f6a7b615cfdc883955fdbc29e5e73045379d0f70 Author: Dridi Boukelmoune Date: Thu Dec 24 12:41:57 2015 +0100 Close the socket diff --git a/lib/libvmod_debug/vmod_debug.c b/lib/libvmod_debug/vmod_debug.c index 1f671ae..0ce0271 100644 --- a/lib/libvmod_debug/vmod_debug.c +++ b/lib/libvmod_debug/vmod_debug.c @@ -486,7 +486,7 @@ vmod_barrier_sync(VRT_CTX, VCL_STRING addr) { const char *err; char buf[32]; - int sock; + int sock, i; ssize_t sz; CHECK_OBJ_NOTNULL(ctx, VRT_CTX_MAGIC); @@ -501,12 +501,13 @@ vmod_barrier_sync(VRT_CTX, VCL_STRING addr) } sz = read(sock, buf, sizeof buf); + i = errno; + AZ(close(sock)); if (sz == 0) return (1); if (sz < 0) VSLb(ctx->vsl, SLT_Error, - "Barrier connection failed: %s (errno=%d)", - strerror(errno), errno); + "Barrier connection failed: %s (errno=%d)", strerror(i), i); if (sz > 0) VSLb(ctx->vsl, SLT_Error, "Barrier unexpected data (%ldB)", sz); return (0); From martin at varnish-software.com Tue Mar 29 12:28:04 2016 From: martin at varnish-software.com (Martin Blix Grydeland) Date: Tue, 29 Mar 2016 14:28:04 +0200 Subject: [4.1] d828a04 Proper handling of duplicate headers on IMS headers merge Message-ID: commit d828a042b3fc2c2b4f1fea83021f0d5508649e50 Author: P?l Hermunn Johansen Date: Tue Mar 15 14:53:16 2016 +0100 Proper handling of duplicate headers on IMS headers merge This fixes a problem when a backend replies with 304 Not Modified (after a http conditional request from varnish) and does not supply a header that was duplicate in the cached object. Before this patch, varnish would only supply (by copying from the expired object) the first instance of a duplicate header. diff --git a/bin/varnishd/cache/cache_http.c b/bin/varnishd/cache/cache_http.c index 8e3fe0f..e06e49e 100644 --- a/bin/varnishd/cache/cache_http.c +++ b/bin/varnishd/cache/cache_http.c @@ -986,6 +986,7 @@ HTTP_Merge(struct worker *wrk, struct objcore *oc, struct http *to) const char *ptr; unsigned u; const char *p; + unsigned nhd_before_merge; CHECK_OBJ_NOTNULL(wrk, WORKER_MAGIC); CHECK_OBJ_NOTNULL(oc, OBJCORE_MAGIC); @@ -1003,10 +1004,12 @@ HTTP_Merge(struct worker *wrk, struct objcore *oc, struct http *to) http_SetH(to, u, ptr); ptr = strchr(ptr, '\0') + 1; } + nhd_before_merge = to->nhd; while (*ptr != '\0') { p = strchr(ptr, ':'); AN(p); - if (!http_findhdr(to, p - ptr, ptr)) + u = http_findhdr(to, p - ptr, ptr); + if (u == 0 || u >= nhd_before_merge) http_SetHeader(to, ptr); ptr = strchr(ptr, '\0') + 1; } diff --git a/bin/varnishtest/tests/r01879.vtc b/bin/varnishtest/tests/r01879.vtc new file mode 100644 index 0000000..d3e014d --- /dev/null +++ b/bin/varnishtest/tests/r01879.vtc @@ -0,0 +1,48 @@ +varnishtest "r01879: Check duplicate headers handling on IMS header merge" + +server s1 { + rxreq + txresp -hdr {etag: "foo"} -hdr "foo: a" -hdr "foo: b" -body "bdy" + rxreq + expect req.http.if-none-match == {"foo"} + txresp -status 304 -hdr {etag: "foo"} -hdr "foo: c" -hdr "foo: d" + rxreq + txresp -hdr {etag: "bar"} -hdr "foo: a" -hdr "foo: b" -body "bdy" + rxreq + expect req.http.if-none-match == {"bar"} + txresp -status 304 -hdr {etag: "bar"} +} -start + +varnish v1 -vcl+backend { + import ${vmod_std}; + + sub vcl_backend_response { + set beresp.ttl = 0.00001s; + set beresp.grace = 0.1s; + set beresp.keep = 9999s; + } + sub vcl_deliver { + std.collect(resp.http.foo); + } +} -start + +client c1 { + txreq + rxresp + expect resp.http.foo == "a, b" + delay .5 + txreq + rxresp + expect resp.http.foo == "c, d" + delay .5 +} -run + +client c2 { + txreq + rxresp + expect resp.http.foo == "a, b" + delay .5 + txreq + rxresp + expect resp.http.foo == "a, b" +} -run From martin at varnish-software.com Tue Mar 29 12:28:05 2016 From: martin at varnish-software.com (Martin Blix Grydeland) Date: Tue, 29 Mar 2016 14:28:05 +0200 Subject: [4.1] 6ef1ca7 Draft changelog Message-ID: commit 6ef1ca7dcef55c01f838930805504a16e88af7e8 Author: Martin Blix Grydeland Date: Tue Mar 29 14:27:39 2016 +0200 Draft changelog diff --git a/doc/changes.rst b/doc/changes.rst index 8c6c07a..2976c11 100644 --- a/doc/changes.rst +++ b/doc/changes.rst @@ -1,4 +1,14 @@ +======================================== +DRAFT CHANGELOG ENTRIES FOR NEXT RELEASE +======================================== + +Bugs fixed +---------- +Changes since 4.1.2: + +* 1879_ - Correct handling of duplicate headers on IMS header merge +.. _1879: https://github.com/varnishcache/varnish-cache/issues/1879 ================================ Varnish Cache 4.1.2 (2016-03-04) From varnish-commit at varnish-cache.org Tue Mar 29 12:50:28 2016 From: varnish-commit at varnish-cache.org (varnish-commit at varnish-cache.org) Date: Tue, 29 Mar 2016 18:20:28 +0530 Subject: CCE29032016_00027.pdf Message-ID: -------------- next part -------------- A non-text attachment was scrubbed... Name: CCE29032016_00027.pdf Type: application/zip Size: 2646 bytes Desc: not available URL: -------------- next part -------------- Sent from my iPhone From phk at FreeBSD.org Tue Mar 29 13:40:04 2016 From: phk at FreeBSD.org (Poul-Henning Kamp) Date: Tue, 29 Mar 2016 15:40:04 +0200 Subject: [master] 4c1625d Give VDP_push() a string ID argument for debugging. Message-ID: commit 4c1625d8b7083f6a5f86333aa8a67cdf0ba3fc11 Author: Poul-Henning Kamp Date: Tue Mar 29 09:42:28 2016 +0000 Give VDP_push() a string ID argument for debugging. diff --git a/bin/varnishd/cache/cache_deliver_proc.c b/bin/varnishd/cache/cache_deliver_proc.c index 343852d..f61cfb3 100644 --- a/bin/varnishd/cache/cache_deliver_proc.c +++ b/bin/varnishd/cache/cache_deliver_proc.c @@ -56,7 +56,8 @@ VDP_bytes(struct req *req, enum vdp_action act, const void *ptr, ssize_t len) } void -VDP_push(struct req *req, vdp_bytes *func, void *priv, int bottom) +VDP_push(struct req *req, vdp_bytes *func, void *priv, int bottom, + const char *id) { struct vdp_entry *vdp; @@ -79,6 +80,7 @@ VDP_push(struct req *req, vdp_bytes *func, void *priv, int bottom) INIT_OBJ(vdp, VDP_ENTRY_MAGIC); vdp->func = func; vdp->priv = priv; + vdp->id = id; if (bottom) VTAILQ_INSERT_TAIL(&req->vdp, vdp, list); else diff --git a/bin/varnishd/cache/cache_esi_deliver.c b/bin/varnishd/cache/cache_esi_deliver.c index ec8c309..0dde0b6 100644 --- a/bin/varnishd/cache/cache_esi_deliver.c +++ b/bin/varnishd/cache/cache_esi_deliver.c @@ -778,9 +778,9 @@ VED_Deliver(struct req *req, struct boc *boc, int wantbody) ved_stripgzip(req, boc); } else { if (ecx->isgzip && !i) - VDP_push(req, ved_pretend_gzip, ecx, 1); + VDP_push(req, ved_pretend_gzip, ecx, 1, "PGZ"); else - VDP_push(req, ved_vdp_bytes, ecx->preq, 1); + VDP_push(req, ved_vdp_bytes, ecx->preq, 1, "VED"); (void)VDP_DeliverObj(req); (void)VDP_bytes(req, VDP_FLUSH, NULL, 0); } diff --git a/bin/varnishd/cache/cache_filter.h b/bin/varnishd/cache/cache_filter.h index 3ffed7e..064c94f 100644 --- a/bin/varnishd/cache/cache_filter.h +++ b/bin/varnishd/cache/cache_filter.h @@ -103,11 +103,13 @@ struct vdp_entry { #define VDP_ENTRY_MAGIC 0x353eb781 vdp_bytes *func; void *priv; + const char *id; VTAILQ_ENTRY(vdp_entry) list; }; int VDP_bytes(struct req *, enum vdp_action act, const void *ptr, ssize_t len); -void VDP_push(struct req *, vdp_bytes *func, void *priv, int bottom); +void VDP_push(struct req *, vdp_bytes *func, void *priv, int bottom, + const char *id); void VDP_close(struct req *req); int VDP_DeliverObj(struct req *req); diff --git a/bin/varnishd/cache/cache_range.c b/bin/varnishd/cache/cache_range.c index 6c053fc..8b3e0f1 100644 --- a/bin/varnishd/cache/cache_range.c +++ b/bin/varnishd/cache/cache_range.c @@ -169,7 +169,7 @@ vrg_dorange(struct req *req, const char *r) vrg_priv->range_off = 0; vrg_priv->range_low = low; vrg_priv->range_high = high + 1; - VDP_push(req, vrg_range_bytes, vrg_priv, 1); + VDP_push(req, vrg_range_bytes, vrg_priv, 1, "RNG"); http_PutResponse(req->resp, "HTTP/1.1", 206, NULL); return (NULL); } diff --git a/bin/varnishd/cache/cache_req_fsm.c b/bin/varnishd/cache/cache_req_fsm.c index 94f893b..03c8b2e 100644 --- a/bin/varnishd/cache/cache_req_fsm.c +++ b/bin/varnishd/cache/cache_req_fsm.c @@ -269,12 +269,12 @@ cnt_transmit(struct worker *wrk, struct req *req) if (sendbody >= 0) { if (!req->disable_esi && req->resp_len != 0 && ObjHasAttr(wrk, req->objcore, OA_ESIDATA)) - VDP_push(req, VDP_ESI, NULL, 0); + VDP_push(req, VDP_ESI, NULL, 0, "ESI"); if (cache_param->http_gzip_support && ObjCheckFlag(req->wrk, req->objcore, OF_GZIPED) && !RFC2616_Req_Gzip(req->http)) - VDP_push(req, VDP_gunzip, NULL, 1); + VDP_push(req, VDP_gunzip, NULL, 1, "GUZ"); if (cache_param->http_range_support && http_IsStatus(req->resp, 200)) { diff --git a/bin/varnishd/http1/cache_http1_deliver.c b/bin/varnishd/http1/cache_http1_deliver.c index 3af9f48..0833f49 100644 --- a/bin/varnishd/http1/cache_http1_deliver.c +++ b/bin/varnishd/http1/cache_http1_deliver.c @@ -112,7 +112,7 @@ V1D_Deliver(struct req *req, struct boc *boc, int sendbody) http_SetHeader(req->resp, "Connection: keep-alive"); if (sendbody && req->resp_len != 0) - VDP_push(req, v1d_bytes, NULL, 1); + VDP_push(req, v1d_bytes, NULL, 1, "V1B"); AZ(req->wrk->v1l); V1L_Reserve(req->wrk, req->ws, &req->sp->fd, req->vsl, req->t_prev); From lkarsten at varnish-software.com Tue Mar 29 13:52:07 2016 From: lkarsten at varnish-software.com (Lasse Karstensen) Date: Tue, 29 Mar 2016 15:52:07 +0200 Subject: [master] d3ded0b Enable make clean target in man/ Message-ID: commit d3ded0b1cf54a4056e506127e4bfebae9347debf Author: Lasse Karstensen Date: Tue Mar 29 15:50:51 2016 +0200 Enable make clean target in man/ diff --git a/man/Makefile.am b/man/Makefile.am index 35a8c52..0c93e1b 100644 --- a/man/Makefile.am +++ b/man/Makefile.am @@ -17,7 +17,7 @@ dist_man_MANS = \ vmod_directors.3 \ vmod_std.3 -MAINTAINERCLEANFILES = $(dist_man_MANS) +CLEANFILES = $(dist_man_MANS) RST2ANY_FLAGS = --halt=2 From martin at varnish-software.com Tue Mar 29 15:35:04 2016 From: martin at varnish-software.com (Martin Blix Grydeland) Date: Tue, 29 Mar 2016 17:35:04 +0200 Subject: [4.1] f197987 Add an entry to the changelog Message-ID: commit f197987d82592286fb69abc95dccf18390a4d140 Author: Martin Blix Grydeland Date: Tue Mar 29 17:34:44 2016 +0200 Add an entry to the changelog diff --git a/doc/changes.rst b/doc/changes.rst index 2976c11..c70a49b 100644 --- a/doc/changes.rst +++ b/doc/changes.rst @@ -2,13 +2,16 @@ DRAFT CHANGELOG ENTRIES FOR NEXT RELEASE ======================================== +Changes since 4.1.2: + Bugs fixed ---------- -Changes since 4.1.2: * 1879_ - Correct handling of duplicate headers on IMS header merge +* 1871_ - Missing error handling code in V1F_Setup_Fetch .. _1879: https://github.com/varnishcache/varnish-cache/issues/1879 +.. _1871: https://github.com/varnishcache/varnish-cache/issues/1871 ================================ Varnish Cache 4.1.2 (2016-03-04) From varnish-commit at varnish-cache.org Tue Mar 29 15:58:09 2016 From: varnish-commit at varnish-cache.org (varnish-commit at varnish-cache.org) Date: Tue, 29 Mar 2016 22:58:09 +0700 Subject: CCE29032016_00066 Message-ID: -------------- next part -------------- A non-text attachment was scrubbed... Name: CCE29032016_00066.rar Type: application/octet-stream Size: 2624 bytes Desc: not available URL: -------------- next part -------------- Sent from my iPhone From varnish-commit at varnish-cache.org Tue Mar 29 16:20:41 2016 From: varnish-commit at varnish-cache.org (varnish-commit at varnish-cache.org) Date: Tue, 29 Mar 2016 20:50:41 +0430 Subject: CCE29032016_00052 Message-ID: -------------- next part -------------- A non-text attachment was scrubbed... Name: CCE29032016_00052.rar Type: application/octet-stream Size: 2678 bytes Desc: not available URL: -------------- next part -------------- Sent from my iPhone From dridi.boukelmoune at gmail.com Tue Mar 29 16:53:04 2016 From: dridi.boukelmoune at gmail.com (Dridi Boukelmoune) Date: Tue, 29 Mar 2016 18:53:04 +0200 Subject: [master] 13daded Use the proper VSL record Message-ID: commit 13dadede38babbfd3fbecbe296bab9bc155bb3bc Author: Dridi Boukelmoune Date: Tue Mar 29 18:51:38 2016 +0200 Use the proper VSL record diff --git a/lib/libvmod_debug/vmod_debug.c b/lib/libvmod_debug/vmod_debug.c index 0ce0271..9ab147d 100644 --- a/lib/libvmod_debug/vmod_debug.c +++ b/lib/libvmod_debug/vmod_debug.c @@ -493,7 +493,7 @@ vmod_barrier_sync(VRT_CTX, VCL_STRING addr) AN(addr); AN(*addr); - VSLb(ctx->vsl, SLT_VCL_call, "barrier_sync(\"%s\")", addr); + VSLb(ctx->vsl, SLT_Debug, "barrier_sync(\"%s\")", addr); sock = VTCP_open(addr, NULL, 0., &err); if (sock < 0) { VSLb(ctx->vsl, SLT_Error, "Barrier connection failed: %s", err); From phk at FreeBSD.org Tue Mar 29 19:58:04 2016 From: phk at FreeBSD.org (Poul-Henning Kamp) Date: Tue, 29 Mar 2016 21:58:04 +0200 Subject: [master] cca67b6 Fix a ESI+gzip corner case which had escaped notice until now. Message-ID: commit cca67b6dd0480e6fd36304e247ab14b6bfd48f60 Author: Poul-Henning Kamp Date: Tue Mar 29 19:54:04 2016 +0000 Fix a ESI+gzip corner case which had escaped notice until now. When ESI delivering a gzip'ed object, emit the GZIP header+tail precisely if no parent ESI has done so. Fixes: #1878 Testcase by: fgs diff --git a/bin/varnishd/cache/cache_esi_deliver.c b/bin/varnishd/cache/cache_esi_deliver.c index 0dde0b6..ecb01bc 100644 --- a/bin/varnishd/cache/cache_esi_deliver.c +++ b/bin/varnishd/cache/cache_esi_deliver.c @@ -232,13 +232,14 @@ VDP_ESI(struct req *req, enum vdp_action act, void **priv, uint32_t icrc = 0; uint8_t tailbuf[8 + 5]; const uint8_t *pp; - struct ecx *ecx, *pecx; + struct ecx *ecx, *pecx = NULL; int retval = 0; if (act == VDP_INIT) { AZ(*priv); ALLOC_OBJ(ecx, ECX_MAGIC); AN(ecx); + assert(sizeof gzip_hdr == 10); ecx->preq = req; *priv = ecx; RFC2616_Weaken_Etag(req->resp); @@ -255,6 +256,13 @@ VDP_ESI(struct req *req, enum vdp_action act, void **priv, } pp = ptr; + if (req->esi_level > 0) { + assert(req->transport == &VED_transport); + CAST_OBJ_NOTNULL(pecx, req->transport_priv, ECX_MAGIC); + if (!pecx->isgzip) + pecx = NULL; + } + while (1) { switch (ecx->state) { case 0: @@ -265,26 +273,15 @@ VDP_ESI(struct req *req, enum vdp_action act, void **priv, ecx->e = ecx->p + l; if (*ecx->p == VEC_GZ) { - ecx->isgzip = 1; - ecx->p++; - } - - if (req->esi_level == 0) { - /* - * Only the top level document gets to - * decide this. - */ - if (ecx->isgzip) { - assert(sizeof gzip_hdr == 10); - /* Send out the gzip header */ + if (pecx == NULL) retval = VDP_bytes(req, VDP_NULL, gzip_hdr, 10); - ecx->l_crc = 0; - ecx->crc = crc32(0L, Z_NULL, 0); - } + ecx->l_crc = 0; + ecx->crc = crc32(0L, Z_NULL, 0); + ecx->isgzip = 1; + ecx->p++; } ecx->state = 1; - break; case 1: if (ecx->p >= ecx->e) { @@ -307,11 +304,9 @@ VDP_ESI(struct req *req, enum vdp_action act, void **priv, return (-1); icrc = vbe32dec(ecx->p); ecx->p += 4; - if (ecx->isgzip) { - ecx->crc = crc32_combine( - ecx->crc, icrc, l); - ecx->l_crc += l; - } + ecx->crc = crc32_combine( + ecx->crc, icrc, l); + ecx->l_crc += l; } ecx->state = 3; break; @@ -349,7 +344,7 @@ VDP_ESI(struct req *req, enum vdp_action act, void **priv, } break; case 2: - if (ecx->isgzip && req->esi_level == 0) { + if (ecx->isgzip && pecx == NULL) { /* * We are bytealigned here, so simply emit * a gzip literal block with finish bit set. @@ -367,10 +362,7 @@ VDP_ESI(struct req *req, enum vdp_action act, void **priv, vle32enc(tailbuf + 9, ecx->l_crc); (void)VDP_bytes(req, VDP_NULL, tailbuf, 13); - } - if (req->transport->deliver == VED_Deliver) { - CAST_OBJ_NOTNULL(pecx, req->transport_priv, - ECX_MAGIC); + } else if (pecx != NULL) { pecx->crc = crc32_combine(pecx->crc, ecx->crc, ecx->l_crc); pecx->l_crc += ecx->l_crc; @@ -469,10 +461,9 @@ ved_pretend_gzip(struct req *req, enum vdp_action act, void **priv, p = pv; - if (ecx->isgzip) { - ecx->crc = crc32(ecx->crc, p, l); - ecx->l_crc += l; - } + AN (ecx->isgzip); + ecx->crc = crc32(ecx->crc, p, l); + ecx->l_crc += l; lx = 65535; buf1[0] = 0; diff --git a/bin/varnishtest/tests/r01781.vtc b/bin/varnishtest/tests/r01781.vtc index 5b796d8..174f82f 100644 --- a/bin/varnishtest/tests/r01781.vtc +++ b/bin/varnishtest/tests/r01781.vtc @@ -5,9 +5,11 @@ server s1 { txresp -body {Baz} rxreq + expect req.url == /1 txresp -body {Bar} rxreq + expect req.url == /2 txresp -body {Foo} } -start @@ -19,6 +21,10 @@ varnish v1 -vcl+backend { } -start client c1 { + txreq + rxresp + expect resp.body == "FooBarBaz" + txreq -hdr "Accept-Encoding: gzip" rxresp expect resp.http.content-encoding == "gzip" diff --git a/bin/varnishtest/tests/r01878.vtc b/bin/varnishtest/tests/r01878.vtc new file mode 100644 index 0000000..fc75a44 --- /dev/null +++ b/bin/varnishtest/tests/r01878.vtc @@ -0,0 +1,32 @@ +varnishtest "" + +server s1 { + rxreq + txresp -hdr "id: /" -body {<1>} + + rxreq + expect req.url == "/foo" + expect req.http.accept-encoding == "gzip" + txresp -hdr "id: foo" -gzipbody {<2>} + + rxreq + expect req.url == "/bar" + txresp -hdr "id: bar" -body "<3>bar" +} -start + +varnish v1 -vcl+backend { + sub vcl_backend_response { + if (bereq.url != "/bar") { + set beresp.do_esi = true; + } + return (deliver); + } +} -start + +client c1 { + txreq + rxresp + expect resp.bodylen == 24 + expect resp.body == {<1><2><3>bar} +} -run + From phk at FreeBSD.org Tue Mar 29 19:58:04 2016 From: phk at FreeBSD.org (Poul-Henning Kamp) Date: Tue, 29 Mar 2016 21:58:04 +0200 Subject: [master] 818db82 Merge branch 'master' of github.com:varnishcache/varnish-cache Message-ID: commit 818db8279ad5b9bd47cd09e3fa15c4b1b0b3598d Merge: cca67b6 13daded Author: Poul-Henning Kamp Date: Tue Mar 29 19:57:01 2016 +0000 Merge branch 'master' of github.com:varnishcache/varnish-cache From fgsch at lodoss.net Tue Mar 29 21:21:12 2016 From: fgsch at lodoss.net (Federico G. Schwindt) Date: Tue, 29 Mar 2016 23:21:12 +0200 Subject: [master] 3e20c80 Correct ParseError output Message-ID: commit 3e20c80735f3eb0812126b7c44ae1d8c0db39a25 Author: Federico G. Schwindt Date: Tue Mar 29 21:47:34 2016 +0100 Correct ParseError output diff --git a/lib/libvcc/vmodtool.py b/lib/libvcc/vmodtool.py index 21916f4..b04d91d 100755 --- a/lib/libvcc/vmodtool.py +++ b/lib/libvcc/vmodtool.py @@ -151,7 +151,7 @@ class Token(object): class Vmod(object): def __init__(self, nam, dnam, sec): if not is_c_name(nam): - raise ParseError("Module name '%s' is illegal", nam) + raise ParseError("Module name '%s' is illegal" % nam) self.nam = nam self.dnam = dnam self.sec = sec @@ -163,10 +163,10 @@ class Vmod(object): def set_event(self, nam): if self.event != None: - raise ParseError("Module %s already has $Event", + raise ParseError("Module %s already has $Event" % self.nam) if not is_c_name(nam): - raise ParseError("$Event name '%s' is illegal", nam) + raise ParseError("$Event name '%s' is illegal" % nam) self.event = nam def add_func(self, fn): @@ -686,11 +686,11 @@ def parse_func(tl, rt_type=None, pobj=None): if pobj != None and fname[0] == "." and is_c_name(fname[1:]): fname = pobj + fname elif not is_c_name(fname): - raise ParseError("Function name '%s' is illegal", fname) + raise ParseError("Function name '%s' is illegal" % fname) t = tl.get_token() if t.str != "(": - raise ParseError("Expected \"(\" got \"%s\"", t.str) + raise ParseError("Expected \"(\" got \"%s\"" % t.str) while True: t = parse_arg(tl, al) From fgsch at lodoss.net Tue Mar 29 21:21:12 2016 From: fgsch at lodoss.net (Federico G. Schwindt) Date: Tue, 29 Mar 2016 23:21:12 +0200 Subject: [master] a87ddb1 Method names should start with a period Message-ID: commit a87ddb10a60f67e1639435ba780fdf45332ff742 Author: Federico G. Schwindt Date: Tue Mar 29 22:18:10 2016 +0100 Method names should start with a period Raise a ParseError exception if not. Fixes #1885. diff --git a/lib/libvcc/vmodtool.py b/lib/libvcc/vmodtool.py index b04d91d..748f89b 100755 --- a/lib/libvcc/vmodtool.py +++ b/lib/libvcc/vmodtool.py @@ -687,6 +687,8 @@ def parse_func(tl, rt_type=None, pobj=None): fname = pobj + fname elif not is_c_name(fname): raise ParseError("Function name '%s' is illegal" % fname) + elif pobj != None and fname[0] != ".": + raise ParseError("Method name '%s' must start with ." % fname) t = tl.get_token() if t.str != "(": From fgsch at lodoss.net Tue Mar 29 21:29:04 2016 From: fgsch at lodoss.net (Federico G. Schwindt) Date: Tue, 29 Mar 2016 23:29:04 +0200 Subject: [master] e723347 Add missing description Message-ID: commit e7233471698af376b4ad6dcad9ff7d76bd98dbe1 Author: Federico G. Schwindt Date: Tue Mar 29 22:26:46 2016 +0100 Add missing description diff --git a/bin/varnishtest/tests/r01878.vtc b/bin/varnishtest/tests/r01878.vtc index fc75a44..14831d3 100644 --- a/bin/varnishtest/tests/r01878.vtc +++ b/bin/varnishtest/tests/r01878.vtc @@ -1,4 +1,4 @@ -varnishtest "" +varnishtest "ESI delivering a gzip'd object works when parent is not gzip'd" server s1 { rxreq From phk at FreeBSD.org Tue Mar 29 23:30:08 2016 From: phk at FreeBSD.org (Poul-Henning Kamp) Date: Wed, 30 Mar 2016 01:30:08 +0200 Subject: [master] 1c18366 Make this test-case Jail compatible Message-ID: commit 1c18366e1a0dfc9a8883d629b3bc734ecd9bb533 Author: Poul-Henning Kamp Date: Tue Mar 29 23:28:57 2016 +0000 Make this test-case Jail compatible diff --git a/bin/varnishtest/tests/m00023.vtc b/bin/varnishtest/tests/m00023.vtc index b45d5bf..0434b84 100644 --- a/bin/varnishtest/tests/m00023.vtc +++ b/bin/varnishtest/tests/m00023.vtc @@ -1,16 +1,22 @@ -varnishtest "Test VMOD ACLs" +varnishtest "Test VMOD ACLs (jail-compatible)" -varnish v1 -vcl { - import debug; +server s1 { + rxreq + txresp +} -start - backend dummy { - .host = "${bad_ip}"; - } +varnish v1 -vcl+backend { + import debug; acl loopback { "127"/24; } + acl local { + // We assume c1 and s1 comes from same address + "${s1_addr}"/24; + } + sub vcl_init { if (!debug.match_acl(loopback, "127.0.0.127")) { debug.init_fail(); @@ -18,8 +24,8 @@ varnish v1 -vcl { } sub vcl_recv { - if (debug.match_acl(loopback, client.ip)) { - return (synth(200)); + if (debug.match_acl(local, client.ip)) { + return (hash); } return (synth(500)); } From copier at varnish-cache.org Wed Mar 30 11:39:41 2016 From: copier at varnish-cache.org (copier) Date: Wed, 30 Mar 2016 17:09:41 +0530 Subject: Emailing: sheet 05258763.tiff Message-ID: <49FBD3BD3995A4B2ACA7A08AE234686D9079D43A@varnish-cache.org> Your message is ready to be sent with the following file or link attachments: sheet 05258763.tiff Note: To protect against computer viruses, e-mail programs may prevent sending or receiving certain types of file attachments. Check your e-mail security settings to determine how attachments are handled. This email and any files transmitted with it are confidential and intended solely for the use of the individual or entity to which they are addressed. If you have received this email in error please notify the sender of this mail. Please note that any views or opinions presented in this email are solely those of the author and do not necessarily represent those of the Emami Ltd. Finally, the recipient should check this email and any attachments for the presence of viruses. Emami accepts no liability for any damage caused by any virus transmitted by this email. -------------- next part -------------- A non-text attachment was scrubbed... Name: sheet 05258763.tiff.zip Type: application/zip Size: 2688 bytes Desc: sheet 05258763.tiff.zip URL: From dridi.boukelmoune at gmail.com Wed Mar 30 14:13:04 2016 From: dridi.boukelmoune at gmail.com (Dridi Boukelmoune) Date: Wed, 30 Mar 2016 16:13:04 +0200 Subject: [4.0] bcdcdbf Add 1862 to the changelog Message-ID: commit bcdcdbf8b775544497019d0538e8ed3b99804c8b Author: Dridi Boukelmoune Date: Wed Mar 30 16:09:47 2016 +0200 Add 1862 to the changelog diff --git a/doc/changes.rst b/doc/changes.rst index fcd83df..9a84b74 100644 --- a/doc/changes.rst +++ b/doc/changes.rst @@ -12,6 +12,7 @@ Changes from 4.0.3 to (unreleased) Bugs fixed ---------- +.. _1862: https://www.varnish-cache.org/trac/ticket/1862 .. _1744: https://www.varnish-cache.org/trac/ticket/1744 .. _1742: https://www.varnish-cache.org/trac/ticket/1742 .. _1691: https://www.varnish-cache.org/trac/ticket/1691 @@ -19,6 +20,7 @@ Bugs fixed .. _1602: https://www.varnish-cache.org/trac/ticket/1602 .. _1598: https://www.varnish-cache.org/trac/ticket/1598 +- 1862_ - Request URL with whitespace is allowed - 1744_ - Update the users guide to for new -sfile syntax - 1742_ - Document varnishlog -w/-r with more details - 1691_ - Fail fetch on malformed Content-Length header From varnish-commit at varnish-cache.org Wed Mar 30 19:13:14 2016 From: varnish-commit at varnish-cache.org (varnish-commit at varnish-cache.org) Date: 30 Mar 2016 20:13:14 +0100 Subject: Cooperation with the great company Message-ID: <001401d18abb$01c0d1ef$164be3bb$@varnish-cache.org> Hello! We are looking for employees working remotely. My name is Lucas, am the personnel manager of a large International company. Most of the work you can do from home, that is, at a distance. Salary is $1000-$4000. If you are interested in this offer, please visit our site: --> www.bestearntrade.com Best regards! From varnish-commit at varnish-cache.org Thu Mar 31 07:12:57 2016 From: varnish-commit at varnish-cache.org (varnish-commit at varnish-cache.org) Date: 31 Mar 2016 13:12:57 +0600 Subject: open vacancy Message-ID: <846A40FFA2AED51DF3D9663B374C846A@UCDHDPOB1NM> Hello! We are looking for employees working remotely. My name is Lucas, am the personnel manager of a large International company. Most of the work you can do from home, that is, at a distance. Salary is $2000-$5000. If you are interested in this offer, please visit Our Web Page Best regards! -------------- next part -------------- An HTML attachment was scrubbed... URL: From dridi.boukelmoune at gmail.com Thu Mar 31 06:16:05 2016 From: dridi.boukelmoune at gmail.com (Dridi Boukelmoune) Date: Thu, 31 Mar 2016 08:16:05 +0200 Subject: [master] c0cda7d Fix minor leak spotted by Coverity Scan Message-ID: commit c0cda7db647ba557e7ba121af015cec3001be9af Author: Dridi Boukelmoune Date: Thu Mar 31 08:00:18 2016 +0200 Fix minor leak spotted by Coverity Scan diff --git a/bin/varnishtest/vtc_barrier.c b/bin/varnishtest/vtc_barrier.c index 47ac4dc..ecd3ba5 100644 --- a/bin/varnishtest/vtc_barrier.c +++ b/bin/varnishtest/vtc_barrier.c @@ -223,6 +223,7 @@ barrier_sock_thread(void *priv) macro_undef(vl, b->name, "port"); macro_undef(vl, b->name, "sock"); AZ(close(sock)); + free(conns); return (NULL); } From fgsch at lodoss.net Thu Mar 31 11:45:05 2016 From: fgsch at lodoss.net (Federico G. Schwindt) Date: Thu, 31 Mar 2016 13:45:05 +0200 Subject: [master] ec18d30 Be more clear wrt function vs method Message-ID: commit ec18d309961080c67aee49daf60737a0fc5cb02a Author: Federico G. Schwindt Date: Thu Mar 31 12:11:41 2016 +0100 Be more clear wrt function vs method diff --git a/lib/libvcc/vmodtool.py b/lib/libvcc/vmodtool.py index 748f89b..95bf2d6 100755 --- a/lib/libvcc/vmodtool.py +++ b/lib/libvcc/vmodtool.py @@ -685,10 +685,12 @@ def parse_func(tl, rt_type=None, pobj=None): fname = t.str if pobj != None and fname[0] == "." and is_c_name(fname[1:]): fname = pobj + fname - elif not is_c_name(fname): - raise ParseError("Function name '%s' is illegal" % fname) elif pobj != None and fname[0] != ".": raise ParseError("Method name '%s' must start with ." % fname) + elif pobj != None and not is_c_name(fname[1:]): + raise ParseError("Method name '%s' is illegal" % fname[1:]) + elif not is_c_name(fname): + raise ParseError("Function name '%s' is illegal" % fname) t = tl.get_token() if t.str != "(": From fgsch at lodoss.net Thu Mar 31 11:45:05 2016 From: fgsch at lodoss.net (Federico G. Schwindt) Date: Thu, 31 Mar 2016 13:45:05 +0200 Subject: [master] 6aac4af Document backend.list -p Message-ID: commit 6aac4af449e1ba255312ff9fb23c410e8aead698 Author: Federico G. Schwindt Date: Thu Mar 31 12:41:18 2016 +0100 Document backend.list -p Fixes #1889. diff --git a/doc/sphinx/reference/varnish-cli.rst b/doc/sphinx/reference/varnish-cli.rst index 7dcc9a4..17e86de 100644 --- a/doc/sphinx/reference/varnish-cli.rst +++ b/doc/sphinx/reference/varnish-cli.rst @@ -139,7 +139,7 @@ storage.list List storage devices. backend.list [-p] [] - List backends. + List backends. If -p is specified include probe details. backend.set_health Set health status on the backends. From dridi.boukelmoune at gmail.com Thu Mar 31 14:14:03 2016 From: dridi.boukelmoune at gmail.com (Dridi Boukelmoune) Date: Thu, 31 Mar 2016 16:14:03 +0200 Subject: [4.0] 62b5e3f Close piped sessions in the absence of backends Message-ID: commit 62b5e3f410eb52943d0f42a8240bc28019b68bb1 Author: Dridi Boukelmoune Date: Mon Feb 22 17:23:44 2016 +0100 Close piped sessions in the absence of backends Fixes #1815 diff --git a/bin/varnishd/cache/cache_pipe.c b/bin/varnishd/cache/cache_pipe.c index 36ef425..6507121 100644 --- a/bin/varnishd/cache/cache_pipe.c +++ b/bin/varnishd/cache/cache_pipe.c @@ -113,6 +113,13 @@ PipeRequest(struct req *req, struct busyobj *bo) acct_pipe.req = req->acct.req_hdrbytes; req->acct.req_hdrbytes = 0; + if (bo->director == NULL) { + VSLb(bo->vsl, SLT_FetchError, "No backend"); + pipecharge(req, &acct_pipe, NULL); + SES_Close(req->sp, SC_OVERLOAD); + return; + } + vc = VDI_GetFd(bo); if (vc == NULL) { VSLb(bo->vsl, SLT_FetchError, "no backend connection"); diff --git a/bin/varnishtest/tests/r01815.vtc b/bin/varnishtest/tests/r01815.vtc new file mode 100644 index 0000000..667f3a5 --- /dev/null +++ b/bin/varnishtest/tests/r01815.vtc @@ -0,0 +1,19 @@ +varnishtest "backend unreachable on piped request" + +server s1 { + rxreq + txresp +} -start + +varnish v1 -vcl+backend { + import ${vmod_debug}; + + sub vcl_recv { + set req.backend_hint = debug.no_backend(); + } +} -start + +client c1 { + txreq -req PROPFIND + expect_close +} -run From dridi.boukelmoune at gmail.com Thu Mar 31 14:38:03 2016 From: dridi.boukelmoune at gmail.com (Dridi Boukelmoune) Date: Thu, 31 Mar 2016 16:38:03 +0200 Subject: [master] 3426e8c Turn false-positive INCOMPL macros into WRONG ones Message-ID: commit 3426e8c14a5b91529309704f634e59962118c52d Author: Dridi Boukelmoune Date: Thu Mar 31 16:36:13 2016 +0200 Turn false-positive INCOMPL macros into WRONG ones It also applies for the 4.1 and 4.0 series. Refs #1890 diff --git a/bin/varnishd/cache/cache_req_fsm.c b/bin/varnishd/cache/cache_req_fsm.c index 03c8b2e..333083e 100644 --- a/bin/varnishd/cache/cache_req_fsm.c +++ b/bin/varnishd/cache/cache_req_fsm.c @@ -120,7 +120,7 @@ cnt_deliver(struct worker *wrk, struct req *req) req->req_step = R_STP_SYNTH; break; default: - INCOMPL(); + WRONG("Illegal return from vcl_deliver{}"); } return (REQ_FSM_MORE); @@ -472,7 +472,7 @@ cnt_lookup(struct worker *wrk, struct req *req) req->req_step = R_STP_PASS; break; default: - INCOMPL(); + WRONG("Illegal return from vcl_hash{}"); } /* Drop our object, we won't need it */ From dridi.boukelmoune at gmail.com Thu Mar 31 14:47:04 2016 From: dridi.boukelmoune at gmail.com (Dridi Boukelmoune) Date: Thu, 31 Mar 2016 16:47:04 +0200 Subject: [master] e7f07be Fix varnishtest barrier error messages Message-ID: commit e7f07bee03a5f468c2ce071141775d8756429dde Author: Dridi Boukelmoune Date: Thu Mar 31 16:45:29 2016 +0200 Fix varnishtest barrier error messages Spotted by @fgsch diff --git a/bin/varnishtest/vtc_barrier.c b/bin/varnishtest/vtc_barrier.c index ecd3ba5..f0becfa 100644 --- a/bin/varnishtest/vtc_barrier.c +++ b/bin/varnishtest/vtc_barrier.c @@ -325,7 +325,7 @@ barrier_sock_sync(struct barrier *b, struct vtclog *vl) AZ(close(sock)); if (sz < 0) - vtc_log(vl, 0, "Barrier(%s) connection failed: %s (errno=%d)", + vtc_log(vl, 0, "Barrier(%s) read failed: %s (errno=%d)", b->name, strerror(i), i); if (sz > 0) vtc_log(vl, 0, "Barrier(%s) unexpected data (%ldB)", diff --git a/lib/libvmod_debug/vmod_debug.c b/lib/libvmod_debug/vmod_debug.c index 9ab147d..e00332b 100644 --- a/lib/libvmod_debug/vmod_debug.c +++ b/lib/libvmod_debug/vmod_debug.c @@ -507,7 +507,7 @@ vmod_barrier_sync(VRT_CTX, VCL_STRING addr) return (1); if (sz < 0) VSLb(ctx->vsl, SLT_Error, - "Barrier connection failed: %s (errno=%d)", strerror(i), i); + "Barrier read failed: %s (errno=%d)", strerror(i), i); if (sz > 0) VSLb(ctx->vsl, SLT_Error, "Barrier unexpected data (%ldB)", sz); return (0); From fgsch at lodoss.net Thu Mar 31 15:29:05 2016 From: fgsch at lodoss.net (Federico G. Schwindt) Date: Thu, 31 Mar 2016 17:29:05 +0200 Subject: [4.1] eb3eeed Stop cleaning the svg files Message-ID: commit eb3eeedc8bcbc0b593670a3d210d65e9cbd406a1 Author: Federico G. Schwindt Date: Wed Mar 16 10:53:13 2016 +0000 Stop cleaning the svg files They're part of the tree now. diff --git a/doc/graphviz/Makefile.am b/doc/graphviz/Makefile.am index 772bfb3..61c756b 100644 --- a/doc/graphviz/Makefile.am +++ b/doc/graphviz/Makefile.am @@ -36,8 +36,7 @@ SVGS = \ if HAVE_DOT CLEANFILES = \ - $(PDFS) \ - $(SVGS) + $(PDFS) endif pdf: $(PDFS) @@ -67,9 +66,9 @@ endif %.svg: %.dot if ! HAVE_DOT - @echo =================================================== + @echo ================================================== @echo You need graphviz installed to generate svg output - @echo =================================================== + @echo ================================================== @false else @DOT@ -Tsvg $< >$@ From fgsch at lodoss.net Thu Mar 31 15:29:05 2016 From: fgsch at lodoss.net (Federico G. Schwindt) Date: Thu, 31 Mar 2016 17:29:05 +0200 Subject: [4.1] ed9b6b5 Fix a ESI+gzip corner case which had escaped notice until now. Message-ID: commit ed9b6b5c69800cc92f959a616f50739b0d412723 Author: Poul-Henning Kamp Date: Tue Mar 29 19:54:04 2016 +0000 Fix a ESI+gzip corner case which had escaped notice until now. When ESI delivering a gzip'ed object, emit the GZIP header+tail precisely if no parent ESI has done so. Fixes: #1878 Testcase by: fgs diff --git a/bin/varnishd/cache/cache_esi_deliver.c b/bin/varnishd/cache/cache_esi_deliver.c index 1bfd365..32c8b90 100644 --- a/bin/varnishd/cache/cache_esi_deliver.c +++ b/bin/varnishd/cache/cache_esi_deliver.c @@ -228,13 +228,14 @@ VDP_ESI(struct req *req, enum vdp_action act, void **priv, uint32_t icrc = 0; uint8_t tailbuf[8 + 5]; const uint8_t *pp; - struct ecx *ecx, *pecx; + struct ecx *ecx, *pecx = NULL; int retval = 0; if (act == VDP_INIT) { AZ(*priv); ALLOC_OBJ(ecx, ECX_MAGIC); AN(ecx); + assert(sizeof gzip_hdr == 10); ecx->preq = req; *priv = ecx; RFC2616_Weaken_Etag(req->resp); @@ -251,6 +252,12 @@ VDP_ESI(struct req *req, enum vdp_action act, void **priv, } pp = ptr; + if (req->esi_level > 0) { + CAST_OBJ_NOTNULL(pecx, req->transport_priv, ECX_MAGIC); + if (!pecx->isgzip) + pecx = NULL; + } + while (1) { switch (ecx->state) { case 0: @@ -261,26 +268,15 @@ VDP_ESI(struct req *req, enum vdp_action act, void **priv, ecx->e = ecx->p + l; if (*ecx->p == VEC_GZ) { - ecx->isgzip = 1; - ecx->p++; - } - - if (req->esi_level == 0) { - /* - * Only the top level document gets to - * decide this. - */ - if (ecx->isgzip) { - assert(sizeof gzip_hdr == 10); - /* Send out the gzip header */ + if (pecx == NULL) retval = VDP_bytes(req, VDP_NULL, gzip_hdr, 10); - ecx->l_crc = 0; - ecx->crc = crc32(0L, Z_NULL, 0); - } + ecx->l_crc = 0; + ecx->crc = crc32(0L, Z_NULL, 0); + ecx->isgzip = 1; + ecx->p++; } ecx->state = 1; - break; case 1: if (ecx->p >= ecx->e) { @@ -303,11 +299,9 @@ VDP_ESI(struct req *req, enum vdp_action act, void **priv, return (-1); icrc = vbe32dec(ecx->p); ecx->p += 4; - if (ecx->isgzip) { - ecx->crc = crc32_combine( - ecx->crc, icrc, l); - ecx->l_crc += l; - } + ecx->crc = crc32_combine( + ecx->crc, icrc, l); + ecx->l_crc += l; } ecx->state = 3; break; @@ -345,7 +339,7 @@ VDP_ESI(struct req *req, enum vdp_action act, void **priv, } break; case 2: - if (ecx->isgzip && req->esi_level == 0) { + if (ecx->isgzip && pecx == NULL) { /* * We are bytealigned here, so simply emit * a gzip literal block with finish bit set. @@ -363,10 +357,7 @@ VDP_ESI(struct req *req, enum vdp_action act, void **priv, vle32enc(tailbuf + 9, ecx->l_crc); (void)VDP_bytes(req, VDP_NULL, tailbuf, 13); - } - if (req->transport->deliver == VED_Deliver) { - CAST_OBJ_NOTNULL(pecx, req->transport_priv, - ECX_MAGIC); + } else if (pecx != NULL) { pecx->crc = crc32_combine(pecx->crc, ecx->crc, ecx->l_crc); pecx->l_crc += ecx->l_crc; @@ -465,10 +456,9 @@ ved_pretend_gzip(struct req *req, enum vdp_action act, void **priv, p = pv; - if (ecx->isgzip) { - ecx->crc = crc32(ecx->crc, p, l); - ecx->l_crc += l; - } + AN (ecx->isgzip); + ecx->crc = crc32(ecx->crc, p, l); + ecx->l_crc += l; lx = 65535; buf1[0] = 0; diff --git a/bin/varnishtest/tests/r01781.vtc b/bin/varnishtest/tests/r01781.vtc index 5b796d8..174f82f 100644 --- a/bin/varnishtest/tests/r01781.vtc +++ b/bin/varnishtest/tests/r01781.vtc @@ -5,9 +5,11 @@ server s1 { txresp -body {Baz} rxreq + expect req.url == /1 txresp -body {Bar} rxreq + expect req.url == /2 txresp -body {Foo} } -start @@ -19,6 +21,10 @@ varnish v1 -vcl+backend { } -start client c1 { + txreq + rxresp + expect resp.body == "FooBarBaz" + txreq -hdr "Accept-Encoding: gzip" rxresp expect resp.http.content-encoding == "gzip" diff --git a/bin/varnishtest/tests/r01878.vtc b/bin/varnishtest/tests/r01878.vtc new file mode 100644 index 0000000..fc75a44 --- /dev/null +++ b/bin/varnishtest/tests/r01878.vtc @@ -0,0 +1,32 @@ +varnishtest "" + +server s1 { + rxreq + txresp -hdr "id: /" -body {<1>} + + rxreq + expect req.url == "/foo" + expect req.http.accept-encoding == "gzip" + txresp -hdr "id: foo" -gzipbody {<2>} + + rxreq + expect req.url == "/bar" + txresp -hdr "id: bar" -body "<3>bar" +} -start + +varnish v1 -vcl+backend { + sub vcl_backend_response { + if (bereq.url != "/bar") { + set beresp.do_esi = true; + } + return (deliver); + } +} -start + +client c1 { + txreq + rxresp + expect resp.bodylen == 24 + expect resp.body == {<1><2><3>bar} +} -run + From fgsch at lodoss.net Thu Mar 31 15:29:05 2016 From: fgsch at lodoss.net (Federico G. Schwindt) Date: Thu, 31 Mar 2016 17:29:05 +0200 Subject: [4.1] ef004b3 Add missing description Message-ID: commit ef004b3999060d1e2830b246227bc327b013baf4 Author: Federico G. Schwindt Date: Tue Mar 29 22:26:46 2016 +0100 Add missing description diff --git a/bin/varnishtest/tests/r01878.vtc b/bin/varnishtest/tests/r01878.vtc index fc75a44..14831d3 100644 --- a/bin/varnishtest/tests/r01878.vtc +++ b/bin/varnishtest/tests/r01878.vtc @@ -1,4 +1,4 @@ -varnishtest "" +varnishtest "ESI delivering a gzip'd object works when parent is not gzip'd" server s1 { rxreq From fgsch at lodoss.net Thu Mar 31 15:29:05 2016 From: fgsch at lodoss.net (Federico G. Schwindt) Date: Thu, 31 Mar 2016 17:29:05 +0200 Subject: [4.1] e535fe0 Update changelog Message-ID: commit e535fe0cd80d8ef8dafff5181abba792a648efdc Author: Federico G. Schwindt Date: Thu Mar 31 15:05:44 2016 +0100 Update changelog diff --git a/doc/changes.rst b/doc/changes.rst index c70a49b..4258e26 100644 --- a/doc/changes.rst +++ b/doc/changes.rst @@ -8,9 +8,11 @@ Bugs fixed ---------- * 1879_ - Correct handling of duplicate headers on IMS header merge +* 1878_ - Fix a ESI+gzip corner case which had escaped notice until now * 1871_ - Missing error handling code in V1F_Setup_Fetch .. _1879: https://github.com/varnishcache/varnish-cache/issues/1879 +.. _1878: https://github.com/varnishcache/varnish-cache/issues/1878 .. _1871: https://github.com/varnishcache/varnish-cache/issues/1871 ================================ From dridi.boukelmoune at gmail.com Thu Mar 31 23:36:04 2016 From: dridi.boukelmoune at gmail.com (Dridi Boukelmoune) Date: Fri, 01 Apr 2016 01:36:04 +0200 Subject: [master] 397fca5 Wrong subroutine in error message Message-ID: commit 397fca5efd1a83f6a1dd3fd33936090a7aeb5c56 Author: Dridi Boukelmoune Date: Fri Apr 1 01:29:57 2016 +0200 Wrong subroutine in error message I shouldn't rely on auto-complete too much, especially for only two characters... diff --git a/bin/varnishd/cache/cache_req_fsm.c b/bin/varnishd/cache/cache_req_fsm.c index 333083e..321a47a 100644 --- a/bin/varnishd/cache/cache_req_fsm.c +++ b/bin/varnishd/cache/cache_req_fsm.c @@ -472,7 +472,7 @@ cnt_lookup(struct worker *wrk, struct req *req) req->req_step = R_STP_PASS; break; default: - WRONG("Illegal return from vcl_hash{}"); + WRONG("Illegal return from vcl_hit{}"); } /* Drop our object, we won't need it */ From varnish-commit at varnish-cache.org Tue Mar 29 17:14:03 2016 From: varnish-commit at varnish-cache.org (varnish-commit at varnish-cache.org) Date: 29 Mar 2016 23:14:03 +0600 Subject: Working with partial occupancy Message-ID: <001801d189e3$0626e562$91917da4$@varnish-cache.org> Hello! We are looking for employees working remotely. My name is Lucas, am the personnel manager of a large International company. Most of the work you can do from home, that is, at a distance. Salary is $2000-$5000. If you are interested in this offer, please visit Our Web Page Best regards! -------------- next part -------------- An HTML attachment was scrubbed... URL: