[Varnish] #1576: varnishd child process crashes with segfault error 6 in libpcre.so.3.13.1
Varnish
varnish-bugs at varnish-cache.org
Tue Aug 26 11:25:13 CEST 2014
#1576: varnishd child process crashes with segfault error 6 in libpcre.so.3.13.1
----------------------+-----------------------
Reporter: abdi | Owner:
Type: defect | Status: needinfo
Priority: normal | Milestone:
Component: varnishd | Version: 4.0.1
Severity: normal | Resolution:
Keywords: |
----------------------+-----------------------
Comment (by abdi):
"Have you compiled Varnish youself?"
no, I got it from varnish repository https://repo.varnish-
cache.org/debian/pool/varnish-4.0/v/varnish/varnish_4.0.1-1~wheezy_amd64.deb
Main VCL:
######
vcl 4.0;
# Varnish Modules
import std;
import directors;
# Backends definition
include "/etc/varnish/backends.vcl";
# Access control list
include "/etc/varnish/acl.vcl";
# Device detections
include "/etc/varnish/devicedetect.vcl";
# Called when VCL is loaded, before any requests pass through it.
Typically used
# to initialize Varnish Modules.
sub vcl_init {
# Backend selection logic (directors configuration) for blogs.
new blogs = directors.round_robin();
blogs.add_backend(blogs01);
blogs.add_backend(blogs02);
# Backend selection logic (directors configuration) for orders.
new orders = directors.round_robin();
orders.add_backend(orders01);
orders.add_backend(orders02);
}
sub vcl_recv {
#Block bad guys
include "/etc/varnish/block.vcl";
#Redirect before anything else
include "/etc/varnish/redirects.vcl";
#Grace mode - Allow the backend to serve up stale content
#set req.grace = 24h;
#Clear the headers that we are going to set later
unset req.http.X-Server-IP;
unset req.http.X-Bmc-Remote-Addr;
#Detect device and set X-UA-Device header
call devicedetect;
#Validate and pass client IP to Apache logs
unset req.http.X-Forwarded-For;
set req.http.X-Forwarded-For = client.ip;
#Pass server IP to Apache logs
set req.http.X-Server-IP = server.ip;
#Pass client IP for Journal application
set req.http.X-Bmc-Remote-Addr = req.http.X-Forwarded-For;
# Set another header for blogs/Akamai
set req.http.True-Client-IP = req.http.X-Forwarded-For;
#Pass POST requests to log them properly
if (req.method == "POST") {
return (pass);
}
#We are handling only supported methods
if (req.method != "GET" &&
req.method != "HEAD" &&
req.method != "PUT" &&
req.method != "TRACE" &&
req.method != "OPTIONS" && req.method != "DELETE") {
/* Non-RFC2616 or CONNECT which is weird. */
return (pipe);
}
#Compression fix
if (req.http.Accept-Encoding) {
if (req.url ~ "\.(jpg|png|gif|gz|tgz|bz2|tbz|mp3|ogg|jpeg)$") {
#No point in compressing these
unset req.http.Accept-Encoding;
} elsif(req.http.Accept-Encoding ~ "gzip") {
set req.http.Accept-Encoding = "gzip";
} elsif(req.http.Accept-Encoding ~ "deflate"
&& req.http.User-Agent !~ "MSIE") {
set req.http.Accept-Encoding = "deflate";
} else {
#unkown algorithm
unset req.http.Accept-Encoding;
}
}
return (hash);
}
sub vcl_pipe {
return (pipe);
}
sub vcl_pass {
return (fetch);
}
sub vcl_hash {
hash_data(req.url);
if (req.http.host) {
hash_data(req.http.host);
} else {
hash_data(server.ip);
}
hash_data(req.http.X-UA-Device);
return (lookup);
}
sub vcl_hit {
return (deliver);
}
sub vcl_miss {
return (fetch);
}
sub vcl_backend_response {
#Grace mode - Allow items to be stale if needed
set beresp.grace = 24 h;
#Default setting for cache
set beresp.http.X-Cacheable = "NO";
#Varnish determined the object was cacheable
if (include "/etc/varnish/cached_pages.vcl";) {
set beresp.http.X-Cacheable = "YES";
}
if (beresp.http.Set-Cookie ~ "bmccookie"
|| beresp.http.Cookie ~ "bmccookie"
|| bereq.http.Cookie ~ "bmccookie"
|| beresp.http.Set-Cookie ~ "wordpress"
|| beresp.http.Cookie ~ "wordpress"
|| bereq.http.cookie ~ "wordpress"
|| beresp.http.Set-Cookie ~ "wp-"
|| beresp.http.Cookie ~ "wp-"
|| bereq.http.Cookie ~ "wp-") {
set beresp.http.X-Cacheable = "NO";
}
if (beresp.http.Set-Cookie ~ "athens" ||
beresp.http.Cookie ~ "athens" ||
bereq.http.Cookie ~ "athens" || bereq.http.User-Agent ~
"pingdom_nocache") {
set beresp.http.X-Cacheable = "NO";
}
# Respect backend cache settings
if (beresp.http.Cache-Control ~ "private"
|| beresp.http.Cache-Control ~ "no-cache"
|| beresp.http.Cache-Control ~ "no-store"
|| beresp.http.Cache-Control ~ "must-revalidate"
|| beresp.http.Pragma ~ "no-cache") {
set beresp.http.X-Cacheable = "NO";
}
if (beresp.http.X-Cacheable == "YES") {
unset beresp.http.Cookie;
unset beresp.http.Set-Cookie;
unset bereq.http.Cookie;
unset beresp.http.Etag;
#Cache non 200s for 1s, set 1 hour TTL for XML (RSS) and 24H for
others
if (beresp.status != 200) {
set beresp.ttl = 1 s;
} elsif (beresp.http.Content-Type ~
"application/json;charset=[Uu][Tt][Ff]-8"
|| beresp.http.Content-Type ~
"application/xml;charset=[Uu][Tt][Ff]-8"
|| beresp.http.Content-Type ~
"text/html;charset=[Uu][Tt][Ff]-8") {
set beresp.ttl = 1 h;
} else {
set beresp.ttl = 24 h;
}
#Remove Expires from backend, it's not long enough
unset beresp.http.expires;
#Set the clients TTL on this object if it doesn't exist
if (!(beresp.http.Cache-control)) {
if (bereq.url == "/") {
set beresp.http.Cache-Control = "max-age=0";
} else {
set beresp.http.Cache-Control = "public,max-age=86400";
}
}
if (!beresp.http.Last-Modified) {
set beresp.http.Last-Modified = beresp.http.date;
}
}
#Send detected device back to browser
if (!beresp.http.X-UA-Device) {
set beresp.http.X-UA-Device = bereq.http.X-UA-Device;
}
#Modify server string and Vary header
unset beresp.http.Server;
set beresp.http.Server = "BioMed Central Web Server 1.0";
if (beresp.http.Vary ~ "User-Agent") {
set beresp.http.Vary =
regsub(bereq.http.Vary, "(^|; ) *User-Agent,? *", "\1");
if (beresp.http.Vary == "") {
unset beresp.http.Vary;
}
}
if (beresp.http.X-Cacheable == "NO") {
set beresp.uncacheable = true;
} else {
return (deliver);
}
}
sub vcl_deliver {
#Diagnostics
if (resp.http.X-Cacheable == "YES") {
if (obj.hits > 0) {
unset resp.http.X-Cacheable;
set resp.http.X-Cache = "HIT";
set resp.http.X-Cache-Hits = obj.hits;
} else {
set resp.http.X-Cache = "MISS";
}
}
#Hide sensitive information
unset resp.http.X-Varnish;
unset resp.http.X-Powered-By;
unset resp.http.Via;
unset resp.http.Age;
#Log server and client IP
std.log("X-Server-IP:" + server.ip);
std.log("X-Forwarded-For:" + req.http.X-Forwarded-For);
return (deliver);
}
sub vcl_backend_error {
include "/etc/varnish/backend-synthetic-error.vcl";
}
--
Ticket URL: <https://www.varnish-cache.org/trac/ticket/1576#comment:2>
Varnish <https://varnish-cache.org/>
The Varnish HTTP Accelerator
More information about the varnish-bugs
mailing list