• Dridi Boukelmoune's avatar
    vca: Have one inheritance check per listen socket · 9c6f6043
    Dridi Boukelmoune authored
    Instead of having a single global check that all acceptors may race
    towards, this check now happens on a per listen socket basis. For
    sockets with a different inheritance behavior on a single system, we
    avoid having the first connection dictate what may be inherited by
    a connection socket from its listen socket for all the other listen
    addresses.
    
    At least on Linux, Unix-domain sockets DO NOT inherit options like
    SO_{RCV,SND}TIMEO even though TCP sockets do. On the off chance that
    even sockets of the same family could behave differently, like for
    example a regular vs a loopback TCP session, this is done on a per
    listen address basis. To avoid cache-acceptor coordination with the
    acceptor worker threads of a given listen address, workers will
    individually perform this check once and for all when the first
    connection is accepted.
    
    We also stay defensive in the event of a parameter change, just in
    case a previous test would assume inheritance because the Varnish
    parameter value would match the kernel default value. Once a mismatch
    is observed for a given connection with a given socket, the inheritance
    test is no longer performed needlessly for this combination.
    
    A race still exists between acceptors from different thread pools for
    a given listen address, but this race is identical to the previous one
    based on the former global need_test variable.
    
    Although the inheritance check leaks into struct listen_sock, it is
    opaque so everything can remain contained inside cache_acceptor.c.
    
    Some aspects of this change (including the clarification comments) are
    from @mbgrydeland.
    
    Refs #2722
    9c6f6043
Name
Last commit
Last update
.circleci Loading commit data...
.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...
vmod Loading commit data...
.dir-locals.el Loading commit data...
.gitignore Loading commit data...
.lgtm.yml 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...
README.Packaging Loading commit data...
README.rst Loading commit data...
autogen.des Loading commit data...
autogen.sh 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...
vtc.am Loading commit data...
wflags.py Loading commit data...