[Varnish] #222: On Solaris, request is not sent to the backend and varnish reports 503

Varnish varnish-bugs at projects.linpro.no
Sat Mar 15 00:58:51 CET 2008

#222: On Solaris, request is not sent to the backend and varnish reports 503
 Reporter:  jyri    |       Owner:  des  
     Type:  defect  |      Status:  new  
 Priority:  normal  |   Milestone:       
Component:  build   |     Version:  trunk
 Severity:  major   |    Keywords:       
 Compiled varnish on Solaris (from trunk, currently @r2605) and I see it
 doesn't send any request traffic to the backend server (no network traffic
 generated) and it just comes back with a 503 error.

 Problem turned out to be that WRK_Flush() attempts to writev() more than
 IOV_MAX elements, which fails (unlike glibc, in Solaris that's a hard

 The root cause is that in cache.h where MAX_IOVS is defined, it checks
 #if (IOV_MAX < (HTTP_HDR_MAX * 2))
 but at this point HTTP_HDR_MAX isn't yet defined, so unless IOV_MAX is <
 that's never true ;-)

 Attached is a patch that defines a HTTP_HDR_MAX_VAL so it is available to
 the preprocessor. With this change, MAX_IOVS gets set compatibly on
 Solaris and requests now make it to the backend server.

 As an aside, this wasn't immediately obvious because WRK_Flush() doesn't
 check for error (-1) from writev. I didn't touch this part in the attached
 patch yet, but would like to suggest some error logging at that point,
        if (i != w->liov) {
             if (i < 0) { ...log write error... }


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

More information about the varnish-bugs mailing list