• Nils Goroll's avatar
    Fix a race between vdp_pesi_fini() and vped_task() on done flag · 58a1f111
    Nils Goroll authored
    To terminate a subrequest, we need to do two things:
    
    - fini the task (signal that the thread handling the subrequest in
      parallel is about to terminate)
    
    - signal that the node representing the subrequest can be picked up by
      esi_level 0 delivery
    
    From the perspective of delivery (unpending), the former needs to
    happen before the latter (delivery needs to be sure that no other
    thread is working on the node), so we call task_fini() before
    signalling that the node done status has changed.
    
    The top level delivery thread, however, might need to tear down the
    tree, which assumes that all subrequests have finished. For this, it
    checks the task list and waits for it to become empty.
    
    The assumption was that when this is the case, the tree can not be in
    use any more, however it could be in vped_task() between task_fini and
    releasing the tree lock.
    
    We solve this race by taking the tree lock before finally destroying
    it.
    
    Fixes https://gitlab.com/uplex/varnish/libvdp-pesi/-/issues/2
    58a1f111
Name
Last commit
Last update
src Loading commit data...
.dir-locals.el Loading commit data...
.gitignore Loading commit data...
CONTRIBUTING.rst Loading commit data...
COPYING Loading commit data...
INSTALL.rst Loading commit data...
LICENSE Loading commit data...
Makefile.am Loading commit data...
README.rst Loading commit data...
autogen.sh Loading commit data...
configure.ac Loading commit data...