• 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
.github Loading commit data...
bin Loading commit data...
doc Loading commit data...
etc Loading commit data...
include Loading commit data...
lib Loading commit data...
m4 Loading commit data...
man Loading commit data...
tools Loading commit data...
.dir-locals.el Loading commit data...
.gitignore Loading commit data...
.syntastic_c_config Loading commit data...
.travis.yml Loading commit data...
CONTRIBUTING Loading commit data...
ChangeLog Loading commit data...
INSTALL Loading commit data...
LICENSE Loading commit data...
Makefile.am Loading commit data...
Makefile.inc.phk Loading commit data...
Makefile.phk Loading commit data...
README.Packaging Loading commit data...
README.rst Loading commit data...
autogen.des Loading commit data...
autogen.sh Loading commit data...
config.phk Loading commit data...
configure.ac Loading commit data...
flint.lnt Loading commit data...
varnish-legacy.m4 Loading commit data...
varnish.m4 Loading commit data...
varnishapi-uninstalled.pc.in Loading commit data...
varnishapi.pc.in Loading commit data...