晚上正想睡觉,突然接到报警,前两天新搭的squid服务器squid意外停止,真是奇怪啊,上去一看,squid发生意外错误,汗,崩溃了,赶紧调整解析。解析调整完毕后,查找原因,在此记录错误处理经过吧。
less cache.log
大概隔半个小时就抛一个错误:squid FATAL: Received Segment Violation...dying.然后squid就尝试重新启动,从早上一直有,郁闷啊,看了后就开始上网查找资料,终于找到一段:
参考:
The following words are excerpted from Squit FAQ:
Some versions of GCC (notably 2.95.1 through 2.95.3) have bugs with compiler optimization. These GCC bugs may cause NULL pointer accesses in Squid, resulting in a ``FATAL: Received Segment Violation...dying'' message and a core dump.
You can work around these GCC bugs by disabling compiler optimization. The best way to do that is start with a clean source tree and set the CC options specifically:
% cd squid-x.y
% make distclean
% setenv CFLAGS='-g -Wall'
% ./configure ...
To check that you did it right, you can search for AC_CFLAGS in src/Makefile:
% grep AC_CFLAGS src/Makefile
AC_CFLAGS = -g -Wall
Now when you recompile, GCC won't try to optimize anything:
% make
Making all in lib...
gcc -g -Wall -I../include -I../include -c rfc1123.c
...etc...
NOTE: some people worry that disabling compiler optimization will negatively impact Squid's performance. The impact should be negligible, unless your cache is really busy and already runs at a high CPU usage. For most people, the compiler optimization makes little or no difference at all.
Some versions of GCC (notably 2.95.1 through 2.95.3) have bugs with compiler optimization. These GCC bugs may cause NULL pointer accesses in Squid, resulting in a ``FATAL: Received Segment Violation...dying'' message and a core dump.
You can work around these GCC bugs by disabling compiler optimization. The best way to do that is start with a clean source tree and set the CC options specifically:
% cd squid-x.y
% make distclean
% setenv CFLAGS='-g -Wall'
% ./configure ...
To check that you did it right, you can search for AC_CFLAGS in src/Makefile:
% grep AC_CFLAGS src/Makefile
AC_CFLAGS = -g -Wall
Now when you recompile, GCC won't try to optimize anything:
% make
Making all in lib...
gcc -g -Wall -I../include -I../include -c rfc1123.c
...etc...
NOTE: some people worry that disabling compiler optimization will negatively impact Squid's performance. The impact should be negligible, unless your cache is really busy and already runs at a high CPU usage. For most people, the compiler optimization makes little or no difference at all.
说实话,这段英文还比较简单,咱就用谷歌翻译了下,原来gcc编译器优化的一个bug导致的,晕死啊,这个破系统是让idc帮忙装的,这系统真要命呢。开始按照上面的操作步骤重新编译:
#/usr/local/squid/sbin/squid -k shutdown
#mv /usr/locla/squid /usr/local/squid-bak
#tar xvzf squid-2.7.STABLE9.tar.gz
#cd squid-2.7.STABLE9
#export CFLAGS='-g -Wall'
#source /etc/profile
重新编译:
#./configure --prefix=/usr/local/squid --enable-removal-policies=heap,lru --enable-linux-netfilter --enable-storeio=ufs,aufs,diskd,null --enable-epoll --enable-ident-lookups --enable-carp --enable-delay-pools --disable-wccp --disable-wccpv2 --enable-snmp --enable-cachemgr-hostname=squid --enable-cache-digests --with-pthreads --enable-gnuregex --with-aio --enable-large-cache-files --with-maxfd=344800 --enable-async-io=160 --enable-internal-dns --enable-linux-netfilter --enable-kill-parent-hack --enable-default-err-language="Simplify_Chinese"
#cd src
#vim Makefile 发现现在的CFLAGS为:
CFLAGS = -G -Wall -D_REENTRANT
而未禁用编译器优化前的为:
CFLAGS = -Wall -g -O2 -D_REENTRANT
看来还是有了一定的变化。
#cd ..
#make
#make install
好了,重新部署配置文件,启动squid,调整解析,再次查看日志,暂时倒是没抛上面的错误,继续观察吧。
记录2天日志看看,如果还有这个错误,这事可就玩大了。。祈祷吧。
转载于:https://blog.51cto.com/newyue/527309