[Varnish] #878: Varnish child dies with segfault when loading a VCL importing std vmod
Varnish
varnish-bugs at varnish-cache.org
Fri Mar 25 14:04:55 CET 2011
#878: Varnish child dies with segfault when loading a VCL importing std vmod
----------------------+-----------------------------------------------------
Reporter: tmagnien | Owner: phk
Type: defect | Status: new
Priority: normal | Milestone:
Component: varnishd | Version: trunk
Severity: normal | Keywords: std vmod segfault
----------------------+-----------------------------------------------------
Comment(by tmagnien):
I made further investigations and here is what I found.
In the generated VCL code, we have this function :
{{{
static void
VGC_Init(struct cli *cli)
{
VRT_Vmod_Init(&VGC_vmod_std,
&Vmod_Func_std,
sizeof(Vmod_Func_std),
"std",
"/usr/local/unmodified/lib/varnish/vmods/libvmod_std.so");
Vmod_Func_std._init(&vmod_priv_std, &VCL_conf);
VRT_init_dir(cli, VCL_conf.director, "simple",
VGC_backend__default, &vgc_dir_priv__default);
VCL_conf.director[0] = VCL_conf.director[1];
}
}}}
What happens is that the 1st time the VCL is loaded (at startup for
example), the Vmod_Func_std is filled by the VRT_Vmod_Init function. The
second time the VCL is loaded (by a vcl.load), the VRT_Vmod_Init function
is called with a Vmod_Func_std pointer value which is different. BUT, the
VRT_Vmod_Init starts with :
{{{
VTAILQ_FOREACH(v, &vmods, list)
if (!strcmp(v->nm, nm))
break;
}}}
And as the std vmod is already loaded, it breaks. So the Vmod_Func_std is
not populated, so value of Vmod_Func_std._init is NULL, which causes the
segfault.
Now I'll try to find the right way to correct this, without loading std
vmod twice...
Regards,
Thierry
--
Ticket URL: <http://www.varnish-cache.org/trac/ticket/878#comment:2>
Varnish <http://varnish-cache.org/>
The Varnish HTTP Accelerator
More information about the varnish-bugs
mailing list