[PATCH] fixed entry size for max-size
Fixed entry size calculation for the max-size cache_dir selection algorithms. There were two sides of this bug: In src/store_swapout.cc, we must create metadata earlier because storeCreate() needs swap_hdr_sz. With swap_hdr_sz unknown at the time of storeCreate(), the SwapDir selection algorithms may select SwapDirs that should not really take the entry as the real storage size (with the metadata swap_hdr_sz) would exceed the store slot size. In src/store_dir.cc, we must add the metadata size before looking for cache_dirs that accept objsize. Only the new storeDirSelectSwapDirRoundRobin selection scheme was affected. HTH, Alex. P.S. I do not have a version of this patch generated against trunk, but I hope it applies easily. Fixed entry size calculation for the max-size cache_dir selection algorithms. There were two sides of this bug. In src/store_swapout.cc, we must create metadata earlier because storeCreate() needs swap_hdr_sz. With swap_hdr_sz unknown at the time of storeCreate(), the SwapDir selection algorithms may select SwapDirs that should not really take the entry as the real storage size (with the metadata swap_hdr_sz) would exceed the store slot size. In src/store_dir.cc, we must add the metadata size before looking for cache_dirs that accept objsize. Only the new storeDirSelectSwapDirRoundRobin selection scheme was affected. === modified file 'src/store_dir.cc' --- src/store_dir.cc 2009-05-30 13:38:39 + +++ src/store_dir.cc 2009-09-02 04:59:32 + @@ -189,6 +189,10 @@ int load; RefCountSwapDir sd; +ssize_t objsize = e-objectLen(); +if (objsize != -1) +objsize += e-mem_obj-swap_hdr_sz; + for (i = 0; i = Config.cacheSwap.n_configured; i++) { if (++dirn = Config.cacheSwap.n_configured) dirn = 0; @@ -201,7 +205,7 @@ if (sd-cur_size sd-max_size) continue; -if (!sd-objectSizeIsAcceptable(e-objectLen())) +if (!sd-objectSizeIsAcceptable(objsize)) continue; /* check for error or overload condition */ === modified file 'src/store_swapout.cc' --- src/store_swapout.cc 2009-02-01 10:09:23 + +++ src/store_swapout.cc 2009-09-02 05:23:45 + @@ -63,6 +63,15 @@ /* If we start swapping out objects with OutOfBand Metadata, * then this code needs changing */ + +/* TODO: make some sort of data,size refcounted immutable buffer + * and stop fooling ourselves with const char* buffers. + */ + +// Create metadata now, possibly in vain: storeCreate needs swap_hdr_sz. +const char *buf = e-getSerialisedMetaData (); +assert(buf); + /* Create the swap file */ generic_cbdata *c = new generic_cbdata(e); sio = storeCreate(e, storeSwapOutFileNotify, storeSwapOutFileClosed, c); @@ -70,6 +79,7 @@ if (sio == NULL) { e-swap_status = SWAPOUT_NONE; delete c; +xfree((char*)buf); storeLog(STORE_LOG_SWAPOUTFAIL, e); return; } @@ -85,16 +95,6 @@ e-swap_dirn = mem-swapout.sio-swap_dirn; /* write out the swap metadata */ -/* TODO: make some sort of data,size refcounted immutable buffer - * for use by this sort of function. - */ -char const *buf = e-getSerialisedMetaData (); - -/* If we start swapping out with out of band metadata, this assert - * will catch it - this code needs to be adjusted if that happens - */ -assert (buf); - storeIOWrite(mem-swapout.sio, buf, mem-swap_hdr_sz, 0, xfree); }
broken link
Hello, I just wanted to let you know that on your homepage: http://devel.squid-cache.org you have a link to: http://www.shmoo.com/securecode/ (How to Write Secure Code) which does not seem to exist anymore. I am learning all about coding in my programming class and I found this page to be helpful: http://www.investintech.com/content/securecode/ ... As I was browsing, the thought occurred to me that you may find it useful as a replacement for the broken one. Thank you for all of the other resources you have listed, they have proven useful as well. Have a great day, Rose Daus
Re: Fun with Squid2 and Clang
Hm. I'm trying 3.HEAD now, but it's giving me some trouble; analysis starts up fine, but when it gets to doing cf_gen_defines, it switches over to using g++ and doesn't switch back; see below. cf_gen didn't cause any problems for squid2; is there something new and weird in the build process here? Users/mnot/Downloads/checker-0.218/libexec/ccc-analyzer - DSQUID_SNMP=1 -I.. -I../include -I../include -Werror -Wall - Wpointer-arith -Wwrite-strings -Wmissing-prototypes -Wmissing- declarations -Wcomments -D_REENTRANT -Wall -g -O2 -MT snmp_pdu.o -MD - MP -MF .deps/snmp_pdu.Tpo -c -o snmp_pdu.o snmp_pdu.c ANALYZE: snmp_pdu.c snmp_pdu_create ANALYZE: snmp_pdu.c snmp_pdu_clone ANALYZE: snmp_pdu.c snmp_pdu_fix ANALYZE: snmp_pdu.c snmp_fix_pdu ANALYZE: snmp_pdu.c snmp_pdu_free ANALYZE: snmp_pdu.c snmp_free_pdu ANALYZE: snmp_pdu.c snmp_pdu_encode ANALYZE: snmp_pdu.c snmp_pdu_decode ANALYZE: snmp_pdu.c snmp_add_null_var mv -f .deps/snmp_pdu.Tpo .deps/snmp_pdu.Po /Users/mnot/Downloads/checker-0.218/libexec/ccc-analyzer - DSQUID_SNMP=1 -I.. -I../include -I../include -Werror -Wall - Wpointer-arith -Wwrite-strings -Wmissing-prototypes -Wmissing- declarations -Wcomments -D_REENTRANT -Wall -g -O2 -MT snmplib_debug.o - MD -MP -MF .deps/snmplib_debug.Tpo -c -o snmplib_debug.o snmplib_debug.c ANALYZE: snmplib_debug.c snmplib_debug mv -f .deps/snmplib_debug.Tpo .deps/snmplib_debug.Po rm -f libsnmp.a /usr/bin/ar cru libsnmp.a asn1.o parse.o snmp_vars.o coexistance.o snmp_api.o snmp_error.o mib.o snmp_api_error.o snmp_msg.o snmp_pdu.o snmplib_debug.o ranlib libsnmp.a Making all in scripts make[1]: Nothing to be done for `all'. Making all in src gawk -f ./cf_gen_defines ./cf.data.pre cf_gen_defines.h sed \ s...@default_http_port@%3128%g;\ s...@default_icp_port@%3130%g;\ s...@default_cache_effective_user@%nobody%g;\ s...@default_mime_table@%/opt/squid3-test/etc/mime.conf%g;\ s...@default_dnsserver@%/opt/squid3-test/libexec/`echo dnsserver | sed 's,x,x,;s/$//'`%g;\ s...@default_unlinkd@%/opt/squid3-test/libexec/`echo unlinkd | sed 's,x,x,;s/$//'`%g;\ s...@default_pinger@%/opt/squid3-test/libexec/`echo pinger | sed 's,x,x,;s/$//'`%g;\ s...@default_diskd@%/opt/squid3-test/libexec/`echo diskd | sed 's,x,x,;s/$//'`%g;\ s...@default_cache_log@%/opt/squid3-test/var/logs/cache.log%g;\ s...@default_access_log@%/opt/squid3-test/var/logs/access.log%g;\ s...@default_store_log@%/opt/squid3-test/var/logs/store.log%g;\ s...@default_pid_file@%/opt/squid3-test/var/squid.pid%g;\ s...@default_netdb_file@%/opt/squid3-test/var/logs/netdb.state%g;\ s...@default_swap_dir@%/opt/squid3-test/var/cache%g;\ s...@default_icon_dir@%/opt/squid3-test/share/icons%g;\ s...@default_mib_path@%/opt/squid3-test/share/mib.txt%g;\ s...@default_error_dir@%/opt/squid3-test/share/errors%g;\ s...@default_config_dir@%/opt/squid3-test/etc%g;\ s...@default_prefix@%/opt/squid3-test%g;\ s...@default_hosts@%/etc/hosts%g;\ s...@[v]ersion@%3.HEAD-20090902%g;\ ./cf.data.pre cf.data depbase=`echo cf_gen.o | sed 's|[^/]*$|.deps/|;s|\.o$||'`;\ g++ -DHAVE_CONFIG_H -DDEFAULT_CONFIG_FILE=\/opt/squid3-test/etc/ squid.conf\ -DDEFAULT_SQUID_DATA_DIR=\/opt/squid3-test/share\ - DDEFAULT_SQUID_CONFIG_DIR=\/opt/squid3-test/etc\ -I.. -I../include - I../src -I../include -I../lib -I../src -I/usr/include/libxml2 - Werror -Wall -Wpointer-arith -Wwrite-strings -Wcomments -D_REENTRANT - g -O2 -MT cf_gen.o -MD -MP -MF $depbase.Tpo -c -o cf_gen.o cf_gen.cc \ mv -f $depbase.Tpo $depbase.Po /bin/sh ../libtool --tag=CXX --mode=link g++ -I/usr/include/libxml2 - Werror -Wall -Wpointer-arith -Wwrite-strings -Wcomments -D_REENTRANT - g -O2 -g -o cf_gen cf_gen.o -L../lib -lmiscutil ../compat/ libcompat.la -lexpat -lxml2 -lm -lresolv mkdir .libs g++ -I/usr/include/libxml2 -Werror -Wall -Wpointer-arith -Wwrite- strings -Wcomments -D_REENTRANT -g -O2 -g -o cf_gen cf_gen.o -Wl,- bind_at_load -L/Users/mnot/Downloads/squid-3.HEAD-20090902/lib - lmiscutil ../compat/.libs/libcompat.a -lexpat -lxml2 -lm -lresolv ./cf_gen cf.data ./cf.data.depend gawk -f ./mk-string-arrays.awk ./err_type.h err_type.cc gawk -f ./mk-globals-c.awk ./globals.h globals.cc gawk -f ./mk-string-arrays.awk ./hier_code.h hier_code.cc gawk -f ./mk-string-arrays.awk ./icp_opcode.h icp_opcode.cc gawk -f ./mk-string-arrays.awk ./lookup_t.h lookup_t.cc /bin/sh ./repl_modules.sh lru repl_modules.cc gawk -f ./mk-string-arrays.awk ./swap_log_op.h swap_log_op.cc make all-recursive Making all in base /bin/sh ../../libtool --tag=CXX --mode=compile g++ -DHAVE_CONFIG_H - I../.. -I../../include -I../../src -I../../include-I/usr/include/ libxml2 -Werror -Wall -Wpointer-arith -Wwrite-strings -Wcomments - D_REENTRANT -g -O2 -MT AsyncCall.lo -MD -MP -MF .deps/AsyncCall.Tpo -c -o AsyncCall.lo AsyncCall.cc g
Re: Fun with Squid2 and Clang
Maybe that it's C++ while the others are C? Hmm.. from Clang homepage The Clang Static Analyzer consists of both a source code analysis framework and a standalone tool that finds bugs in C and Objective-C programs.. C++ is not C or Objective-C, so it's not too strange it doesn't work for C++ programs. And some seconds further digging gives http://clang.llvm.org/cxx_status.html Regards Henrik ons 2009-09-02 klockan 19:17 +1000 skrev Mark Nottingham: Hm. I'm trying 3.HEAD now, but it's giving me some trouble; analysis starts up fine, but when it gets to doing cf_gen_defines, it switches over to using g++ and doesn't switch back; see below. cf_gen didn't cause any problems for squid2; is there something new and weird in the build process here? Users/mnot/Downloads/checker-0.218/libexec/ccc-analyzer - DSQUID_SNMP=1 -I.. -I../include -I../include -Werror -Wall - Wpointer-arith -Wwrite-strings -Wmissing-prototypes -Wmissing- declarations -Wcomments -D_REENTRANT -Wall -g -O2 -MT snmp_pdu.o -MD - MP -MF .deps/snmp_pdu.Tpo -c -o snmp_pdu.o snmp_pdu.c ANALYZE: snmp_pdu.c snmp_pdu_create ANALYZE: snmp_pdu.c snmp_pdu_clone ANALYZE: snmp_pdu.c snmp_pdu_fix ANALYZE: snmp_pdu.c snmp_fix_pdu ANALYZE: snmp_pdu.c snmp_pdu_free ANALYZE: snmp_pdu.c snmp_free_pdu ANALYZE: snmp_pdu.c snmp_pdu_encode ANALYZE: snmp_pdu.c snmp_pdu_decode ANALYZE: snmp_pdu.c snmp_add_null_var mv -f .deps/snmp_pdu.Tpo .deps/snmp_pdu.Po /Users/mnot/Downloads/checker-0.218/libexec/ccc-analyzer - DSQUID_SNMP=1 -I.. -I../include -I../include -Werror -Wall - Wpointer-arith -Wwrite-strings -Wmissing-prototypes -Wmissing- declarations -Wcomments -D_REENTRANT -Wall -g -O2 -MT snmplib_debug.o - MD -MP -MF .deps/snmplib_debug.Tpo -c -o snmplib_debug.o snmplib_debug.c ANALYZE: snmplib_debug.c snmplib_debug mv -f .deps/snmplib_debug.Tpo .deps/snmplib_debug.Po rm -f libsnmp.a /usr/bin/ar cru libsnmp.a asn1.o parse.o snmp_vars.o coexistance.o snmp_api.o snmp_error.o mib.o snmp_api_error.o snmp_msg.o snmp_pdu.o snmplib_debug.o ranlib libsnmp.a Making all in scripts make[1]: Nothing to be done for `all'. Making all in src gawk -f ./cf_gen_defines ./cf.data.pre cf_gen_defines.h sed \ s...@default_http_port@%3128%g;\ s...@default_icp_port@%3130%g;\ s...@default_cache_effective_user@%nobody%g;\ s...@default_mime_table@%/opt/squid3-test/etc/mime.conf%g;\ s...@default_dnsserver@%/opt/squid3-test/libexec/`echo dnsserver | sed 's,x,x,;s/$//'`%g;\ s...@default_unlinkd@%/opt/squid3-test/libexec/`echo unlinkd | sed 's,x,x,;s/$//'`%g;\ s...@default_pinger@%/opt/squid3-test/libexec/`echo pinger | sed 's,x,x,;s/$//'`%g;\ s...@default_diskd@%/opt/squid3-test/libexec/`echo diskd | sed 's,x,x,;s/$//'`%g;\ s...@default_cache_log@%/opt/squid3-test/var/logs/cache.log%g;\ s...@default_access_log@%/opt/squid3-test/var/logs/access.log%g;\ s...@default_store_log@%/opt/squid3-test/var/logs/store.log%g;\ s...@default_pid_file@%/opt/squid3-test/var/squid.pid%g;\ s...@default_netdb_file@%/opt/squid3-test/var/logs/netdb.state%g;\ s...@default_swap_dir@%/opt/squid3-test/var/cache%g;\ s...@default_icon_dir@%/opt/squid3-test/share/icons%g;\ s...@default_mib_path@%/opt/squid3-test/share/mib.txt%g;\ s...@default_error_dir@%/opt/squid3-test/share/errors%g;\ s...@default_config_dir@%/opt/squid3-test/etc%g;\ s...@default_prefix@%/opt/squid3-test%g;\ s...@default_hosts@%/etc/hosts%g;\ s...@[v]ersion@%3.HEAD-20090902%g;\ ./cf.data.pre cf.data depbase=`echo cf_gen.o | sed 's|[^/]*$|.deps/|;s|\.o$||'`;\ g++ -DHAVE_CONFIG_H -DDEFAULT_CONFIG_FILE=\/opt/squid3-test/etc/ squid.conf\ -DDEFAULT_SQUID_DATA_DIR=\/opt/squid3-test/share\ - DDEFAULT_SQUID_CONFIG_DIR=\/opt/squid3-test/etc\ -I.. -I../include - I../src -I../include -I../lib -I../src -I/usr/include/libxml2 - Werror -Wall -Wpointer-arith -Wwrite-strings -Wcomments -D_REENTRANT - g -O2 -MT cf_gen.o -MD -MP -MF $depbase.Tpo -c -o cf_gen.o cf_gen.cc \ mv -f $depbase.Tpo $depbase.Po /bin/sh ../libtool --tag=CXX --mode=link g++ -I/usr/include/libxml2 - Werror -Wall -Wpointer-arith -Wwrite-strings -Wcomments -D_REENTRANT - g -O2 -g -o cf_gen cf_gen.o -L../lib -lmiscutil ../compat/ libcompat.la -lexpat -lxml2 -lm -lresolv mkdir .libs g++ -I/usr/include/libxml2 -Werror -Wall -Wpointer-arith -Wwrite- strings -Wcomments -D_REENTRANT -g -O2 -g -o cf_gen cf_gen.o -Wl,- bind_at_load -L/Users/mnot/Downloads/squid-3.HEAD-20090902/lib - lmiscutil ../compat/.libs/libcompat.a -lexpat -lxml2 -lm -lresolv ./cf_gen cf.data ./cf.data.depend gawk -f ./mk-string-arrays.awk ./err_type.h err_type.cc gawk -f ./mk-globals-c.awk ./globals.h globals.cc gawk -f ./mk-string-arrays.awk ./hier_code.h hier_code.cc gawk -f ./mk-string-arrays.awk
Build failed in Hudson: 3.HEAD-i386-Debian-sid #43
See http://build.squid-cache.org/job/3.HEAD-i386-Debian-sid/43/ -- Started by upstream project 3.HEAD-amd64-CentOS-5.2 build number 66 Building remotely on rio.treenet bzr: ERROR: Invalid http response for http://www.squid-cache.org/bzr/squid3/.bzr/repository/packs/2ac0b245adaec88233f3f214954e0737.pack: Expected a boundary (squid/3.1.0.13~fischeri20090822:D30A309C9A30607912ECB6A26F0044EC) line, got '' Using saved parent location: http://www.squid-cache.org/bzr/squid3/trunk/ ERROR: Failed to pull
Hudson build is back to normal: 3.HEAD-i386-Debian-sid #44
See http://build.squid-cache.org/job/3.HEAD-i386-Debian-sid/44/changes
R: R: R: R: Squid 3 build errors on Visual Studio - problem still present
Hi, OK, but what next ? Regards Guido Serassio Acme Consulting S.r.l. Microsoft Gold Certified Partner Via Lucia Savarino, 110098 - Rivoli (TO) - ITALY Tel. : +39.011.9530135 Fax. : +39.011.9781115 Email: guido.seras...@acmeconsulting.it WWW: http://www.acmeconsulting.it -Messaggio originale- Da: Amos Jeffries [mailto:squ...@treenet.co.nz] Inviato: martedì 1 settembre 2009 10.43 A: Henrik Nordstrom Cc: Guido Serassio; Robert Collins; squid-dev@squid-cache.org Oggetto: Re: R: R: R: Squid 3 build errors on Visual Studio - problem still present Henrik Nordstrom wrote: mån 2009-08-31 klockan 13:40 +0200 skrev Guido Serassio: Hi, I have found this definition: http://msdn.microsoft.com/en-us/library/tbbk8hs6(VS.80).aspx Hoping that helps. Matches the standard definition from what I can tell, and should not cause any errors... Regards Henrik Ah, well. It seems that npos may not work if its int or unsigned We do this: include/config.h:typedef unsigned int size_t; src/SquidString.h:typedef size_t size_type; src/SquidString.h:const static size_type npos = std::string::npos; making SquidString::size_type == size_t == unsigned int But, the complaint is about constant expression being expected? Amos -- Please be using Current Stable Squid 2.7.STABLE6 or 3.0.STABLE18 Current Beta Squid 3.1.0.13
Re: If refresh_pattern only extends expiration, how to force time-to-live in Squid code?
(Resending, first time accidentally sent with HTML formatting, bounced) Now I see the Expires header having a value in the past, which may confuse clients and caches further down the chain. Scenario: origin returns max-age=900 (15 min) and refresh_pattern overrides expire to 24 hours, what do the headers to the client look like? On the first request (cache-miss), the Expires header is not added to the response sent to client. On subsequent cache-hits the Expires header is added to the response sent to client. (Why this artifact?) The Expires header is set to time the object was received from the origin plus the value in the Max-age header. This results in the Expires header having a value in the past when the cached object is older than the Max-age. How to fix it best? (in my local version) Since my trouble is the Expires header having a value in the past, I consider suppressing the Squid artifact of inserting an Expires header. Is there a Squid configuration ability to do so? If not, what would be the right way to do it in my local code branch? On Fri, Aug 28, 2009 at 6:12 PM, Guy Bashkansky guy...@gmail.com wrote: Henrik, Thanks, it works! Guy On Thu, Aug 27, 2009 at 2:00 AM, Henrik Nordstrom hen...@henriknordstrom.net wrote: ons 2009-08-26 klockan 18:17 -0700 skrev Guy Bashkansky: If indeed refresh_pattern only extends expiration, I would like to develop a feature that enforces an exact time-to-live (per URL) in my local branch of Squid code. See the refreshStaleness() function. Should be sufficient to move the max age check up above the expires check. Regards Henrik -- Forwarded message -- From: Guy Bashkansky guy...@gmail.com Date: Wed, Aug 26, 2009 at 6:17 PM Subject: If refresh_pattern only extends expiration, how to force time-to-live in Squid code? To: squid-dev@squid-cache.org I've tried to set an exact time-to-live (override origin cache control) in Squid (2.4 STABLE6) configuration by refresh_pattern, e.g.: refresh_pattern 30_minutes_cache_control_url 15 0% 15 override-expire ignore-max-age Observed: URL is matched (in log), but objects still cached for 30 minutes, rather than for 15 minutes, as hoped. If indeed refresh_pattern only extends expiration, I would like to develop a feature that enforces an exact time-to-live (per URL) in my local branch of Squid code. What would be the most reasonable way to do this? How can I force objects to expire from cache after a given time? Thanks.
Re: R: R: R: R: Squid 3 build errors on Visual Studio - problem still present
ons 2009-09-02 klockan 21:11 +0200 skrev Guido Serassio: Hi, OK, but what next ? Can you produce a preprocessed source? That's the output of just the preprocessor, not actual compilarion, comparable to gcc -E option. Easier to identify what the compiler actually saw that way... Regards Henrik
Re: If refresh_pattern only extends expiration, how to force time-to-live in Squid code?
ons 2009-09-02 klockan 12:42 -0700 skrev Guy Bashkansky: Now I see the Expires header having a value in the past, which may confuse clients and caches further down the chain. Scenario: origin returns max-age=900 (15 min) and refresh_pattern overrides expire to 24 hours, what do the headers to the client look like? On the first request (cache-miss), the Expires header is not added to the response sent to client. On subsequent cache-hits the Expires header is added to the response sent to client. (Why this artifact?) Is it? Should not, at least not unless you run 2.7 with the act-as-origin option.. The Expires header is set to time the object was received from the origin plus the value in the Max-age header. odd.. Regards Henrik
Re: If refresh_pattern only extends expiration, how to force time-to-live in Squid code?
ons 2009-09-02 klockan 13:42 -0700 skrev Guy Bashkansky: I'm using a customized version of Squid 2.4 STABLE6. But nothing seems to be customized in refresh.c, except for my own recent swap of age and expires checks (as recommended). Ouch.. that's a very very old relese. Upgrading highly recommended. Probably the expires header is added in some other place, it's just difficult to figure out exactly where in the code and how it is controlled. grep -4 HDR_EXPIRES src/*.c Regards Henrik
New dev account please
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 Hey! I'd like to join the squid project and contribute some time/energy to working on outstanding issues, mainly with ICAP support. I'm no expert programmer, but I'm motivated and this is interesting to me, so I'll be working with other devs on the project to make sure I'm up to standards and expectations. I work for a major international insurance company and use several web proxy products and ICAP implementations daily, and spend a lot of time troubleshooting them since they don't all play nicely with ICAP RFC. I think I have a great handle on ICAP as a protocol, and would like to apply this experience back to the OS community where possible. I'm sure I'll learn and find other areas that I am capable of contributing to as well. My sourceforge id is iamfromit Thanks, Jonathan Miller iamfro...@gmail.com -BEGIN PGP SIGNATURE- Version: GnuPG v1.4.9 (GNU/Linux) Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org iEYEARECAAYFAkqemH4ACgkQgGnkqY2ikRusLACfYo3uVTCC+Gg9cxwt5+V1ok99 sa4AnRt5/JX50m4+LvRzDzb/LWtVQ+PY =dCTv -END PGP SIGNATURE-
Re: [PATCH] fixed entry size for max-size
bb: approve +1. Sane, and correct, and also matches what Squid-2 is doing. Hmm.. wonder how that got lost in Squid-3. The change in squid-2 is very old (3 may 2000). Investigating. Right, got lost in refactoring (revision 5998). The comment from when this was fixed in Squid-2 is even left just not visible in your patch, but is there a couple of lines before where you moved back the tlv composing. Regards Henrik ons 2009-09-02 klockan 00:05 -0600 skrev Alex Rousskov: Fixed entry size calculation for the max-size cache_dir selection algorithms. There were two sides of this bug: In src/store_swapout.cc, we must create metadata earlier because storeCreate() needs swap_hdr_sz. With swap_hdr_sz unknown at the time of storeCreate(), the SwapDir selection algorithms may select SwapDirs that should not really take the entry as the real storage size (with the metadata swap_hdr_sz) would exceed the store slot size. In src/store_dir.cc, we must add the metadata size before looking for cache_dirs that accept objsize. Only the new storeDirSelectSwapDirRoundRobin selection scheme was affected. HTH, Alex. P.S. I do not have a version of this patch generated against trunk, but I hope it applies easily.