Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add a facility for unlocked director iteration #4142

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Commits on Nov 9, 2024

  1. cache_vcl: Add a facility for unlocked director iteration

    Pondering varnishcache#4140 made me realize that our central per-vcl director list
    constitutes a classic case of iterating a mutable list. That besides the already
    known fact that running potentially expensive iterator functions while holding
    the vcl_mtx is a very bad idea.
    
    So this patch is a suggestion on how to get out of this situation. It does not
    go all the way (it still leaves unsolved a similar problem of iterating over all
    backends of _all vcls_), but shows an attempt on how to tackle the "iterate over
    one VCL's backends".
    
    We add a fittingly named 'vdire' facility which manages the director list and,
    in particular, director retirement. The main change is that, while iterators are
    active on the director list, vcl_mtx is _not_ held and any request of a director
    to retire only ends up in a resignation, which manifests by this director being
    put on a second list.
    
    When all iterators have completed, the resignation list is worked and the actual
    retirement carried out.
    nigoroll committed Nov 9, 2024
    Configuration menu
    Copy the full SHA
    dff43f1 View commit details
    Browse the repository at this point in the history
  2. vdire: Wait for directors to retire before staring a new iteration

    This is to prevent a potential pileup of resigned directors with a constant
    stream of iterators coming on
    nigoroll committed Nov 9, 2024
    Configuration menu
    Copy the full SHA
    804fbee View commit details
    Browse the repository at this point in the history