Cant get it work (Assert error in vmod_country_code()
majik12345 opened this issue · 6 comments
Continued playing with this today but no dice. I compiled fine for varnish 4.
Adding line import geoip; is fine no error.
But as soon as I add line:
set req.http.X-Country-Code = geoip.country_code("" + client.ip);
and reload varnish nothing works.. Varnish only returns an empty response for all sites. (blank page)
I've checked I have all necessary libraries installed (on centos GeoIP-devel GeoIP-GeoLite-data)
Any idea why it isnt working now?
In the log there is this error:
Last panic at: Sun, 31 Jul 2016 10:21:59 GMT#012"Assert error in vmod_country_code(), vmod_geoip.c line 71:#12 Condition((pp->priv) != 0) not true.#012thread = (cache-worker)#012version = varnish-4.1.3 revision 5e3b6d2#012ident = Linux,2.6.32-358.6.1.el6.x86_64,x86_64,-junix,-smalloc,-smalloc,-hcritbit,epoll#012Backtrace:#12 0x432f23: varnishd() [0x432f23]#12 0x7f96007f7b85: libvmod_geoip.so(vmod_country_code+0x65) [0x7f96007f7b85]#12 0x7f9603df1015: vgc.so(VGC_function_vcl_recv+0x85) [0x7f9603df1015]#12 0x43f944: varnishd() [0x43f944]#12 0x43fd0a: varnishd(VCL_recv_method+0x5a) [0x43fd0a]#12 0x4377c6: varnishd(CNT_Request+0x7a6) [0x4377c6]#12 0x44ea77: varnishd(HTTP1_Session+0x127) [0x44ea77]#12 0x43a5bd: varnishd(SES_Proto_Req+0x5d) [0x43a5bd]#12 0x449835: varnishd() [0x449835]#12 0x449c6b: varnishd() [0x449c6b]#012req = 0x7f95fd096020 {#12 vxid = 2, step = R_STP_RECV,#12 req_body = R_BODY_NONE,#12 restarts = 0, esi_level = 0,#12 sp = 0x7f95fcc0f420 {#12 fd = 18, vxid = 1,#12 client = 108.162.223.113 54107,#12 t_open = 1469960518.676669,#12 t_idle = 1469960518.676669,#12 step = S_STP_H1PROC,#12 },#12 worker = 0x7f961006bbc0 {#12 stack = {0x7f961006c000 -> 0x7f9610060000},#12 ws = 0x7f961006bdb8 {#12 id = "wrk",#12 {s,f,r,e} = {0x7f961006b380,0x7f961006b380,(nil),+2040},#12 },#12 VCL::method = inside RECV,#12 VCL::return = abandon,#12 VCL::methods = {RECV},#12 },#12 ws = 0x7f95fd096200 {#12 id = "req",#12 {s,f,r,e} = {0x7f95fd098000,+584,(nil),+57336},#12 },#12 http_conn = 0x7f95fd096128 {#12 fd = 18,#12 doclose = NULL,#12 ws = 0x7f95fd096200,#12 {rxbuf_b, rxbuf_e} = {0x7f95fd098000, 0x7f95fd0981cf},#12 {pipeline_b, pipeline_e} = {(nil), (nil)},#12 content_length = -1,#12 body_status = none,#12 first_byte_timeout = 0.000000,#12 between_bytes_timeout = 0.000000,#12 },#12 http[req] = 0x7f95fd096298 {#12 ws[req
Panic in more readable form from panic.show: (note i have hidden my domain and IP data but these do appear normally)
varnish> panic.show
200
Last panic at: Sun, 31 Jul 2016 15:42:45 GMT
"Assert error in vmod_country_code(), vmod_geoip.c line 71:
Condition((pp->priv) != 0) not true.
thread = (cache-worker)
version = varnish-4.1.3 revision 5e3b6d2
ident = Linux,2.6.32-358.6.1.el6.x86_64,x86_64,-junix,-smalloc,-smalloc,-hcritbit,epoll
Backtrace:
0x432f23: varnishd() [0x432f23]
0x7f53b63ddb85: libvmod_geoip.so(vmod_country_code+0x65) [0x7f53b63ddb85]
0x7f53b65e2f42: vgc.so(VGC_function_vcl_recv+0x72) [0x7f53b65e2f42]
0x43f944: varnishd() [0x43f944]
0x43fd0a: varnishd(VCL_recv_method+0x5a) [0x43fd0a]
0x4377c6: varnishd(CNT_Request+0x7a6) [0x4377c6]
0x44ea77: varnishd(HTTP1_Session+0x127) [0x44ea77]
0x43a5bd: varnishd(SES_Proto_Req+0x5d) [0x43a5bd]
0x449835: varnishd() [0x449835]
0x449c6b: varnishd() [0x449c6b]
req = 0x7f53b4896020 {
vxid = 2, step = R_STP_RECV,
req_body = R_BODY_NONE,
restarts = 0, esi_level = 0,
sp = 0x7f53b440f420 {
fd = 21, vxid = 1,
client = 173.245.48.98 47600,
t_open = 1469979764.842485,
t_idle = 1469979764.842485,
step = S_STP_H1PROC,
},
worker = 0x7f53c7925bc0 {
stack = {0x7f53c7926000 -> 0x7f53c791a000},
ws = 0x7f53c7925db8 {
id = "wrk",
{s,f,r,e} = {0x7f53c7925380,0x7f53c7925380,(nil),+2040},
},
VCL::method = inside RECV,
VCL::return = abandon,
VCL::methods = {RECV},
},
ws = 0x7f53b4896200 {
id = "req",
{s,f,r,e} = {0x7f53b4898000,+464,(nil),+57336},
},
http_conn = 0x7f53b4896128 {
fd = 21,
doclose = NULL,
ws = 0x7f53b4896200,
{rxbuf_b, rxbuf_e} = {0x7f53b4898000, 0x7f53b489815f},
{pipeline_b, pipeline_e} = {(nil), (nil)},
content_length = -1,
body_status = none,
first_byte_timeout = 0.000000,
between_bytes_timeout = 0.000000,
},
http[req] = 0x7f53b4896298 {
ws[req] = 0x7f53b4896200,
hdrs {
"GET",
"/wp-login.php",
"HTTP/1.1",
"Host: mydomain.com",
"Connection: Keep-Alive",
"Accept-Encoding: gzip",
"X-Forwarded-Proto: http",
"User-Agent: Opera/8.98 (X11; Linux i686; U; en-US) Presto/2.9.170 Version/12.00",
"X-Forwarded-For: ip hidden",
},
},
vcl = {
busy = 1
discard = 0,
state = auto,
temp = warm,
conf = {
srcname = {
"/etc/varnish/default.vcl",
"Builtin",
},
},
},
flags = {
},
},
"
varnish>
Hi @majik12345,
can you please share with us your VCL? or at least the parts where you use the geoip mod.
From the panic you get, it seems the parameter you pass to the country_code function results into a NULL pointer.
Hi @majik12345 ,
It looks like you are using the vmod's 4.0 branch on a varnish 4.1, am I wrong? If not, please try the master banch.
Yes, I am using 4.1.3, I used 4.0 branch (maybe that is not quite accurate then :D) However I just tried with master branch but when I make with master branch for some reason it outputs a varnish 3 build??? Because when I add line import geoip to vcl I cannot start varnish it says something about vmod is for varnish 3 and not supported. When I use 4.0 branch that error goes away however any call to get country code results in a panic and varnish dies...
OK, I wiped all trace from my system, re downloaded master branch and recompiled, all appears to be good now
I just hit the same issue: it's the lack of /usr/share/GeoIP/GeoIP.dat
that creates this panic. At least I can see «no such file or directory».
It's working great even with a symlink (as MaxMind geoipupdate doesn't have GeoIP.dat, but GeoLiteCountry.dat which is the same in the end).