[Varnish] #1144: Assert error when (backend name + ipv4 + ipv6) is too long

Varnish varnish-bugs at varnish-cache.org
Fri Jun 1 12:08:13 CEST 2012

#1144: Assert error when (backend name + ipv4 + ipv6) is too long
 Reporter:  tmagnien  |        Type:  defect  
   Status:  new       |    Priority:  normal  
Milestone:            |   Component:  varnishd
  Version:  trunk     |    Severity:  major   
 Keywords:            |  
 Hi, I experienced this assert error on a varnish-3.0.2s instance :

 Assert error in VSM__Alloc(), vsm.c line 185:
   Condition(snprintf(sha->ident, sizeof sha->ident, "%s", ident) < sizeof
 sha->ident) not true.
 thread = (cache-main)
 ident =
   0x42fd18: /usr/sbin/varnishd() [0x42fd18]
   0x452775: /usr/sbin/varnishd(VSM__Alloc+0xbc5) [0x452775]
   0x434e43: /usr/sbin/varnishd(VSM_Alloc+0x43) [0x434e43]
   0x4115f3: /usr/sbin/varnishd(VBE_AddBackend+0x1c3) [0x4115f3]
   0x40f984: /usr/sbin/varnishd(VRT_init_dir_simple+0xe4) [0x40f984]
   0x7f91b23c8dbd: ./vcl.4lmdKkVI.so(+0x1cdbd) [0x7f91b23c8dbd]
   0x436ffe: /usr/sbin/varnishd() [0x436ffe]
   0x7f91bcc19bde: /usr/lib/varnish/libvarnish.so(+0x7bde) [0x7f91bcc19bde]
   0x7f91bcc1a0bd: /usr/lib/varnish/libvarnish.so(+0x80bd) [0x7f91bcc1a0bd]
   0x7f91bcc1cf01: /usr/lib/varnish/libvarnish.so(+0xaf01) [0x7f91bcc1cf01]

 It occurs because in VBE_AddBackend we reserve a 128 char buf to store
 vcl_name, ipv4_addr, ipv6_addr and port. Then we call VSM_Alloc and try to
 put this buf into the ident field of VSM_chunk struct, which is only 64
 char long.

 I've looked into trunk code and it seems we could encounter the same
 problem, at a different place : in VSM_common_alloc :

 assert(strlen(ident) < sizeof(vr->chunk->ident));


Ticket URL: <https://www.varnish-cache.org/trac/ticket/1144>
Varnish <https://varnish-cache.org/>
The Varnish HTTP Accelerator

More information about the varnish-bugs mailing list