[Varnish] #768: varnishstat sms_balloc/sms_nbytes race condition

Varnish varnish-bugs at varnish-cache.org
Fri Sep 3 05:43:16 CEST 2010


#768: varnishstat sms_balloc/sms_nbytes race condition
----------------------+-----------------------------------------------------
 Reporter:  askalski  |        Type:  defect 
   Status:  new       |    Priority:  normal 
Milestone:            |   Component:  build  
  Version:  trunk     |    Severity:  trivial
 Keywords:            |  
----------------------+-----------------------------------------------------
 There's a race condition in sms_nbytes and sms_balloc in varnishstat:

 {{{
 sms_nbytes       18446744073709515650          .   SMS outstanding bytes
 sms_balloc          189713772          .   SMS bytes allocated
 sms_bfree           189748637          .   SMS bytes freed
 }}}

 bin/varnishd/storage_synth.c:SMS_Finish() is missing its mutex operations:

 {{{
 --- a/storage_synth.c   2010-09-02 23:40:46.405915699 -0400
 +++ b/storage_synth.c   2010-09-02 23:41:21.365964969 -0400
 @@ -120,6 +120,8 @@
         sto->len = vsb_len(vsb);
         sto->space = vsb_len(vsb);
         obj->len = sto->len;
 +       Lck_Lock(&sms_mtx);
         VSC_main->sms_nbytes += sto->len;
         VSC_main->sms_balloc += sto->len;
 +       Lck_Unlock(&sms_mtx);
  }
 }}}

-- 
Ticket URL: <http://varnish-cache.org/ticket/768>
Varnish <http://varnish-cache.org/>
The Varnish HTTP Accelerator




More information about the varnish-bugs mailing list