• 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
..
cache Loading commit data...
common Loading commit data...
hash Loading commit data...
hpack Loading commit data...
http1 Loading commit data...
http2 Loading commit data...
mgt Loading commit data...
proxy Loading commit data...
storage Loading commit data...
waiter Loading commit data...
Makefile.am Loading commit data...
Makefile.phk Loading commit data...
VSC_lck.vsc Loading commit data...
VSC_main.vsc Loading commit data...
VSC_mempool.vsc Loading commit data...
VSC_mgt.vsc Loading commit data...
VSC_sma.vsc Loading commit data...
VSC_smf.vsc Loading commit data...
VSC_smu.vsc Loading commit data...
VSC_vbe.vsc Loading commit data...
builtin.vcl Loading commit data...
flint.lnt Loading commit data...
flint.sh Loading commit data...
vclflint.lnt Loading commit data...
vclflint.sh Loading commit data...