# SQUID replacement_policies heap GDSF don't work [ SOLVED ]

## DawgG

i'm setting up a squid 3.0.16 and both replacement_policies heap GDSF don't work. when i try to start squid with this config

```
memory_replacement_policy heap GDSF     # default lru

cache_replacement_policy heap GDSF      # default lru
```

 it will not even parse or create the cache_dirs:

```
newsquid squid # squid -k parse

2009/07/21 13:40:22| Processing Configuration File: /etc/squid/squid.conf (depth 0)

2009/07/21 13:40:22| assertion failed: heap/store_repl_heap.cc:344: "!args"

Aborted
```

when i use lru instead squid runs.

i think it might have something to do with the way squid was configured/compiled (some args weren't passed/set correctly(?)) but i don't understand the source of store_repl_heap.cc:

```
343  /* No additional arguments expected */

344    assert(!args);
```

squid was emerged with USE="pam logrotate ssl", the system is stable amd64 and the compiler-flags are fairly conservative

```
newsquid ~ # emerge --info

Portage 2.1.6.13 (default/linux/amd64/2008.0, gcc-4.3.2, glibc-2.9_p20081201-r2, 2.6.29-gentoo-r5 x86_64)

=================================================================

System uname: Linux-2.6.29-gentoo-r5-x86_64-Intel-R-_Xeon-R-_CPU_E5410_[at]_2.33GHz-with-glibc2.2.5

Timestamp of tree: Tue, 21 Jul 2009 04:20:01 +0000

app-shells/bash:     3.2_p39

dev-lang/python:     2.5.4-r3

sys-apps/baselayout: 1.12.11.1

sys-apps/sandbox:    1.6-r2

sys-devel/autoconf:  2.63

sys-devel/automake:  1.10.2

sys-devel/binutils:  2.18-r3

sys-devel/gcc-config: 1.4.1

sys-devel/libtool:   1.5.26

virtual/os-headers:  2.6.27-r2

ACCEPT_KEYWORDS="amd64"

CBUILD="x86_64-pc-linux-gnu"

CFLAGS="-march=nocona -O2 -pipe"

CHOST="x86_64-pc-linux-gnu"
```

do i need any additional options in squid's configfile or any additional useflags? on the squid to be replaced using heap gdsf was not a problem.

thx for your help!

----------

## Mike Hunt

I tried heap GDSF for both memory and cache_replacement_policy's on mine and it restarted fine.

My use flags are: net-proxy/squid-3.0.16  USE="caps ldap logrotate mysql pam ssl"

My squid.conf is otherwise out-of-the-box.

Not sure if that helps.    :Confused: 

----------

## DawgG

CORRECTION: it's SQUID 3.0.15 and NOT .16

 *Quote:*   

> I tried heap GDSF for both memory and cache_replacement_policy's on mine and it restarted fine. 

 

at least it works for somebody else  :wink: 

i got it to work for memory only with 

```
squid -k parse
```

 (see next post )  but not for disk (cache_dirs). rtfm told me that the policies have to be defined BEFORE the cache_dir-statements they apply to. when i apply the policy heap GDSF to cache_dir the error is the same as stated above, but heap LRU and heap LFUDA do work.

so now i have tow different replacement policies for disk and mem which might not be so bad after all.

i'd still like to know why heap GDSF does not work for cache_dir.

my working config now:

```
# RAM

memory_replacement_policy heap GDSF     # default lru

cache_mem 1000 MB                       # default 8 MB

maximum_object_size_in_memory 128 KB    # default 8 KB

# DISKs

cache_replacement_policy heap LFUDA

cache_dir aufs /cache/squid 100000 32 512

minimum_object_size 0 KB                

maximum_object_size 16 MB               # default 4096 KB
```

yesterday i recompiled squid w/out any C-/CXX-FLAGS, but the error remained the same. i think squid should support GDSF, though (recompiled WITH CFLAGS here):

newsquid ~ # squid -v

Squid Cache: Version 3.0.STABLE15

configure options:  '--prefix=/usr' '--build=x86_64-pc-linux-gnu' '--host=x86_64-pc-linux-gnu' '--mandir=/usr/share/man' '--infodir=/usr/share/info' '--datadir=/usr/share' '--sysconfdir=/etc' '--localstatedir=/var/lib' '--libdir=/usr/lib64' '--sysconfdir=/etc/squid' '--libexecdir=/usr/libexec/squid' '--localstatedir=/var' '--datadir=/usr/share/squid' '--with-default-user=squid' '--enable-auth=basic,digest,negotiate,ntlm' '--enable-removal-policies=lru,heap' '--enable-digest-auth-helpers=password' '--enable-basic-auth-helpers=PAM,getpwnam,NCSA,MSNT' '--enable-external-acl-helpers=ip_user,session,unix_group' '--enable-ntlm-auth-helpers=fakeauth' '--enable-negotiate-auth-helpers=' '--enable-useragent-log' '--enable-cache-digests' '--enable-delay-pools' '--enable-referer-log' '--enable-arp-acl' '--with-large-files' '--with-filedescriptors=8192' '--disable-caps' '--disable-snmp' '--enable-ssl' '--disable-icap-client' '--enable-storeio=ufs,diskd,aufs,null' '--enable-linux-netfilter' '--disable-epoll' 'build_alias=x86_64-pc-linux-gnu' 'host_alias=x86_64-pc-linux-gnu' 'CC=x86_64-pc-linux-gnu-gcc' 'CFLAGS=-march=nocona -O2 -pipe' 'LDFLAGS=-Wl,-O1' 'CXXFLAGS=-march=nocona -O2 -pipe

THX for your help!

----------

## Mike Hunt

In my out-of-the-box squid.conf

the MEMORY CACHE OPTIONS are defined before the memory_replacement_policy line

then next

the DISK CACHE OPTIONS are defined after the cache_replacement_policy line

Not sure if that could make a huge difference since there is no mention in the comments that a specific order is required.  :Confused: Last edited by Mike Hunt on Thu Jul 23, 2009 1:48 pm; edited 2 times in total

----------

## DawgG

you won't believe it (i didn't at first, either)

the comments at the end of the lines in the configfile messed it up (unbelieveable amount of "debugging" i had to invest in this...)

 :oops: 

WRONG:

```
cache_replacement_policy heap GDSF     # default lru
```

RIGHT:

```
cache_replacement_policy heap GDSF
```

i noticed when changing around lines and other policies refused to work.

now this:

```
2009/07/21 13:40:22| assertion failed: heap/store_repl_heap.cc:344: "!args" 
```

and this

```
343  /* No additional arguments expected */

344    assert(!args);
```

makes some sense, too.

i'll use heap GDSF ofr mem and heap LFUDA for disk.

THX for the help!

----------

## Mike Hunt

That's a weird one, because the end-of-line comments have no effect here.

I would try this:

1. rename squid.conf -> squid.conf.bak

2. emerge squid-3.0.16

3. edit only the replacement policies in the fresh config and start squid

4. diddle the rest of your config edits

But what is this assert thing?  Could it have something to do with your glibc?

----------

## DawgG

with the only slightly modified default squid.conf the same error appears when i put the # comment at the end of the policy line, but squid continues running and repeatedly complaining about this with the same errmsg.

 *Quote:*   

> But what is this assert thing? Could it have something to do with your glibc?

 

it's from squid's source, you can find it on the web, just search for heap/store_repl_heap.cc

i (as a non.programmer) understand it this way:

```
343  /* No additional arguments expected */ 
```

(just like it says: no more args, please)

```
344    assert(!args);
```

this is expected but not enforced (by filtering out useless stuff like comments etc.)

and since this is not true the following error occurs:

```
assertion failed: heap/store_repl_heap.cc:344: "!args"
```

maybe i'll search squid's bugzilla and tell the programmers about this.

----------

## Mike Hunt

Well, that's a weird one.  I'm out of ideas. 

Have a good one.   :Smile: 

----------

## DawgG

maybe it's just a little bug.

could you verify on your system before it file a bug over at squid's?

just add 

```
# blabla
```

 after your replacement policy and see if it's reproducible.

THX!

have a god one, too! :D

ps i just tested it on an different box with 3.0.15 in accelerator mode with lru - same error. i filed a bug.

----------

## Mike Hunt

Wow!!!

```
memory_replacement_policy heap GDSF # blabla

cache_replacement_policy heap GDSF # blabla
```

```
# /etc/init.d/squid restart

* Caching service dependencies...                                           [ok]

* Stopping squid...

2009/07/23 13:03:13| assertion failed: heap/store_repl_heap.cc:344: "!args"

/etc/init.d/squid: line 60: 29265 Aborted                 /usr/sbin/squid -k shutdown

* Waiting for squid to shutdown .....................................................^C* squid: caught SIGINT, aborting

# kill $(pidof squid)

# ps ax | grep squid

3120 ?        R      0:35 (squid) -DYC

# kill 3120

# /etc/init.d/squid zap

* Manually resetting squid to stopped state

# /etc/init.d/squid start

* Starting squid...

2009/07/23 13:07:08| assertion failed: heap/store_repl_heap.cc:344: "!args"

/etc/init.d/squid: line 53: 29425 Aborted                 KRB5_KTNAME="${SQUID_KEYTAB}" /usr/sbin/squid ${SQUID_OPTS}                                       [!!]

* ERROR: squid failed to start

```

 :Confused:   :Crying or Very sad:   :Shocked:   :Question:   :Exclamation: 

Hope it helps.   :Smile: 

----------

## Mike Hunt

 *Mike Hunt wrote:*   

> That's a weird one, because the end-of-line comments have no effect here.

 

Obviously I misspoke here, sorry.  I guess only the acl section allows end-of-line comments.

----------

## DawgG

i filed a bug yesterday and henrik has already confirmed it, but not as a real "bug":

```
This is a know shortcoming. squid.conf generally only supports wholeline

comments with the exception of the acl directive which also supports

end-of-line comments. Comments at the end of other lines is read as arguments

to that directive.
```

http://www.squid-cache.org/bugs/show_bug.cgi?id=2720

i really think it is not a real bug as long as you know about it (i guess i found out about it the hard way  :wink: ).

it would be nice to put this information in the configfile/documentation someplace.

THX for your help!

CHEERS!

----------

## Mike Hunt

Hey DawgG, glad to help.   :Smile: 

 *DawgG wrote:*   

> it would be nice to put this information in the configfile/documentation someplace.

 Definitely.

Hope you can get that heap LFUDA/GDSF problem in DISK straightened out too.

Cheers.

----------

