-
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