• Dridi Boukelmoune's avatar
    Only let VRT_AddDirector undo a COOLING attempt · 07a09db9
    Dridi Boukelmoune authored
    When a VCL is in the COOLING state it is supposed to delete the director
    that was being added, but at the same time when a VBE backend fails to
    be added as a director it would also undo itself.
    
    This is in general a code path very hard to reach because either this
    happens in a worker and the opportunistic check always kicks in to hide
    the problem or this is done asynchronously (e.g. non-blocking lookups to
    create dynamic backends) and the race window is very small. In order to
    solve this the opportunistic check is skipped in VTC mode.
    
    The test coverage with vmod_debug is done synchronously to make things
    easier, but for this reason vbe_destroy can no longer expect to only run
    in the CLI thread.
    
    This is inspired by a similar patch by Martin for a different branch,
    since VRT_AddDirector deletes the backend upon failure, everything needs
    to be set up beforehand.
    
    We have to tolerate backend creation attempts in a COOLING VCL because
    in the asynchronous case the VCL temperature will change before COLD
    events are dispatched so there's no way to prevent a race.
    
    Closes #3176
    07a09db9
vmod.vcc 7.53 KB