Skip to content

VCL garbage collection: set cold state and limit versions #16

@jensens

Description

@jensens

Context

Architecture §3.4 defines VCL lifecycle management after push:

  1. After vcl.use <new>: set old VCL to cold state via vcl.state <old> cold
  2. Wait 5-10 seconds before discarding (worker-thread references)
  3. Maintain max 3 VCL versions (configurable)

Current state

Agent PushVCL (admin.go:163-195):

  • Loads and activates new VCL ✓
  • Discards old VCL after 5s sleep ✓
  • Does NOT set old VCL to cold state first ✗
  • Does NOT enforce max VCL count ✗
  • Does NOT query vcl.list to check existing versions ✗

Risk

Without vcl.state cold, rapid VCL pushes can leave worker threads referencing old VCL. Without max version enforcement, VCL versions accumulate on endpoint churn.

Implementation

In internal/agent/admin.go PushVCL:

  1. After vcl.use <new>, call vcl.state <old> cold
  2. Before discard, query vcl.list and discard all but the 3 most recent
  3. Add vinyl_vcl_versions_loaded Prometheus gauge

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions