# Squid with aufs or diskd crashes



## Mox (Jan 31, 2014)

Hi everyone!
I encountered with a problem when I had tried to set up a proxy server. I installed fresh FreeBSD 10.0-RELEASE amd64, then installed www/squid33. The problem is squid goes down immediately if I want to use AUFS store type instead of traditional UFS. Squid can't even perform '`squid -z`' to initialize cache directory. Segfault and core dumped.
Bad.

So, I tried to set cache_dir to diskd. Good, it works... for a first glance. Diskd went down after some time with small load. Again and again. In the end squid exited with 'Exiting due to repeated, frequent failures' message.

Config is simple:

```
visible_hostname bla-bla
http_access allow all
http_port 3128
cache_dir (ufs|aufs|diskd) /var/squid/cache 10240 16 256
```
I performed some testing with i386/amd64, here is result:

FreeBSD 10.0-RELEASE amd64 and i386
ufs - works well
aufs - goes down, can't do 'squid -z'
diskd - works for some time, then goes down

FreeBSD 9.2-RELEASE amd64 and i386
ufs - works well
aufs - works well (!!!!!)
diskd  - works for some time, then goes down

Can anybody confirm such behaviour?
Or I do something wrong?


----------



## Mox (Jan 31, 2014)

In case of diskd there were such messages in cache.log

```
...
2014/01/30 16:27:04 kid1| storeDiskdSend: msgsnd: (35) Resource temporarily unavailable
2014/01/30 16:27:04 kid1| storeDiskdSend WRITE: (35) Resource temporarily unavailable
2014/01/30 16:27:04 kid1| avoid write on theFile with error
2014/01/30 16:27:04 kid1| calling free_func for 0x806fad020
2014/01/30 16:27:04 kid1| avoid write on theFile with error
2014/01/30 16:27:04 kid1| calling free_func for 0x806faf020
2014/01/30 16:27:04 kid1| avoid write on theFile with error
2014/01/30 16:27:04 kid1| calling free_func for 0x806fb1020
2014/01/30 16:27:04 kid1| avoid write on theFile with error
2014/01/30 16:27:04 kid1| calling free_func for 0x806fb3020
FATAL: Received Segment Violation...dying.
```

*UPD.*
I found this page http://wiki.squid-cache.org/Features/DiskDaemon
I added to /boot/loader.conf these values

```
kern.ipc.msgmnb=8192
kern.ipc.msgssz=64
kern.ipc.msgtql=2048
```
(other sysctls are already have suitable values)
then rebooted, and diskd works good.
So, it's my fault about diskd. =)

But aufs still doesn't work at all! I.e. aufs works under 9.2-RELEASE, but crashes under 10.0-RELEASE.


----------



## xtaz (Feb 2, 2014)

I can confirm what you've found. I used www/squid33 for years with aufs and then there were some changes made to the port to allow it to be compiled with `clang` on FreeBSD 10. It just crashes with signal 11 when you try and run things like `squid -z`. I never actually got around to reporting it though. Probably worth sending in a problem report.


----------



## Mox (Feb 5, 2014)

xtaz said:
			
		

> I can confirm what you've found. I used www/squid33 for years with aufs and then there were some changes made to the port to allow it to be compiled with `clang` on FreeBSD 10. It just crashes with signal 11 when you try and run things like `squid -z`. I never actually got around to reporting it though. Probably worth sending in a problem report.


Thank you! What's better: write a PR or write to freebsd-stable?


----------



## SirDice (Feb 5, 2014)

Mox said:
			
		

> What's better: write a PR or write to freebsd-stable?


It won't hurt to do both. You can refer to the PR in the email to the mailing list. The PR is mainly there to keep track of bugs and fixes. The mailing lists are usually used for discussions on how to fix them.


----------



## xtaz (Feb 7, 2014)

Although freebsd-ports is probably better than freebsd-stable for that. I'll definitely be interested in a fix for this. But I unfortunately never reported it at the time because I don't actually use squid very often so forgot about it until I read this thread. Thanks!


----------



## Mox (Feb 7, 2014)

Thank you! I wrote to freebsd-ports@


----------

