• Nils Goroll's avatar
    serialize access to heritage.socks in the child · 217d9277
    Nils Goroll authored
    I did consider avoiding locks, but as long as the close() in VCA_Shutdown()
    happens concurrent to vca_acct(), the file descriptor could become invalid
    at any time, so even if we'd not hit the sock > 0 assertion, other errors
    could occur / assertions be hit.
    
    We could also move the close to vca_acct() and just signal it to finish off,
    but this would delay the close by the sleep(1), unless we further complicated
    things with a condvar.
    
    Avoiding the lock would require us to make any operation on a socket fd
    ignore errors, which is totally against our policy to assert on everything.
    (see vca_tcp_opt_set() for example).
    
    So, for the time being, I think simple serialization using a pthread mutex
    is the safest and simplest solution. A varnish lock would be overkill, as
    this lock is really only relevant during VCA_Shutdown.
    
    IMHO, the primary risk involved here is delayed VCA_Shutdown() due to
    vca_acct() hanging in a syscall. Famous Last Words - sigh.
    
    Fixes #2482
    217d9277
Name
Last commit
Last update
..
varnishadm Loading commit data...
varnishd Loading commit data...
varnishhist Loading commit data...
varnishlog Loading commit data...
varnishncsa Loading commit data...
varnishstat Loading commit data...
varnishtest Loading commit data...
varnishtop Loading commit data...
Makefile.am Loading commit data...
Makefile.phk Loading commit data...
flint.lnt Loading commit data...