[Varnish] #571: Assert error while setting header using inline C-code

Varnish varnish-bugs at projects.linpro.no
Fri Oct 30 13:19:51 CET 2009


#571: Assert error while setting header using inline C-code
----------------------------+-----------------------------------------------
 Reporter:  maheshollalwar  |       Owner:  phk
     Type:  defect          |      Status:  new
 Priority:  normal          |   Milestone:     
Component:  varnishd        |     Version:  2.0
 Severity:  critical        |    Keywords:     
----------------------------+-----------------------------------------------
 Hi,

 Error Messege:-

 Oct 30 10:47:57 monitoring-ril varnishd[31107]: Child (31108) said Closed
 fds: 4 5 6 10 11 13 14
 Oct 30 10:47:57 monitoring-ril varnishd[31107]: Child (31108) said Child
 starts
 Oct 30 10:47:57 monitoring-ril varnishd[31107]: Child (31108) said managed
 to mmap 1610612736 bytes of 1610612736
 Oct 30 10:47:57 monitoring-ril varnishd[31107]: Child (31108) said Ready
 Oct 30 10:47:57 monitoring-ril varnishd[31107]: Child (31108) said
 Netacuity plugin loaded successfully.
 Oct 30 10:48:14 monitoring-ril varnishd[31107]: Child (31108) said Cont :
 (ind)
 Oct 30 10:48:14 monitoring-ril varnishd[31107]: Child (31108) died
 signal=6
 Child (31108) Panic message: Assert error in http_IsHdr(), cache_http.c
 line 141:   Condition(l == strlen(hdr + 1)) not true.  thread = (cache-
 worker)sp = 0x47e02004 {   fd = 10, id = 10, xid = 124885105,   client =
 203.199.83.206:43968,   step = STP_RECV,   handling = error,   ws =
 0x47e0204c {      id = "sess",     {s,f,r,e} =
 {0x47e02534,,+89,(nil),+16384},   },     worker = 0x473fe120 {     },
 vcl = {       srcname = {         "input",         "Default",       },
 }, },

 Config :-

 C{
   #include <dlfcn.h>
   #include <stdlib.h>
   #include <stdio.h>

 char* (*get_country_code)(char* ip) = NULL;

 __attribute__((constructor)) void
 load_module()
 {
         const char* symbol_name = "CountryCode";
         const char* plugin_name = "/usr/local/lib/libnetacuity.so";
         void* handle = NULL;

         handle = dlopen( plugin_name, RTLD_NOW );
         if (handle != NULL) {
                 get_country_code = dlsym( handle, symbol_name );
                 if (get_country_code == NULL)
                         fprintf( stderr, "\nError: Could not load
 Netacuity plugin:\n%s\n\n", dlerror() );
                 else {
                         printf( "Netacuity plugin loaded
 successfully.\n");
                 }
         }
         else
                 fprintf( stderr, "\nError: Could not load Netacuity
 plugin:\n%s\n\n", dlerror() );
 }
 }C

 Below is used in vcl_recv :-

         C{
                         char *ip = VRT_IP_string(sp, VRT_r_client_ip(sp));
                         char country[256] = {0};
                         char *con = (*get_country_code)(ip);
                         snprintf(country,256,"%s",con);
                         printf("Cont : (%s)\n",country);
                         VRT_SetHdr(sp, HDR_REQ, "\007R-CN:",
 country,vrt_magic_string_end);
                 }C
                 if (req.http.R-CN ~ "usa") {
                         set req.http.host = "xx.example.com";
                 } else {
                         set req.http.host = "yy.example.com";
                 }

-- 
Ticket URL: <http://varnish.projects.linpro.no/ticket/571>
Varnish <http://varnish.projects.linpro.no/>
The Varnish HTTP Accelerator


More information about the varnish-bugs mailing list