Skip to content
This repository was archived by the owner on Feb 16, 2026. It is now read-only.
This repository was archived by the owner on Feb 16, 2026. It is now read-only.

Question on backend refcounting #4445

@gquintard

Description

@gquintard

Hi,

I'm working on backend/director abstraction in rust, and I can't wrap my head around one question, which is usually a sign I'm looking at the issue the wrong way.

So, I can call VRT_AddDirector to create a director, VCL_DelDirector to delete it, and the VCL code will use VRT_AssignBackend to increase the refcount.

But I don't see what prevents the vmod from creating a director, returning a VCL_BACKEND and then destroying the director before the VCL has a chance to call VRT_AssignBackend.
Conversely, if VRT_AssignBackend has the time to be called, then VCL_DelDirector should break because the refcount won't end up being 0?

I'm not doubting the code works, but I'm struggling to understand how it does. Is there a guarantee I missed that the vmod writer needs to maintain?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions