Skip to content

InspectionTaskRunner instances are never deleted or cleaned up #808

Open

Description

@kyasbal

Problem Statement

Currently, once an inspection is created via POST /api/v3/inspection/types/:typeID, the generated InspectionTaskRunner instance remains in the server's memory indefinitely until the backend restarts.
Furthermore, GET /api/v3/inspection (the list endpoint used by the UI) filters instances using if inspection.Started() (pkg/server/server.go). Since an inspection's Started() status only becomes true when a full Run() is initiated, any inspections that were created solely for DryRun() validation (or abandoned prior to running) are invisible in the UI, yet they permanently occupy space in the backend's memory map.

Current Behavior

  • When an inspection is created, InspectionTaskServer registers it in inspections map[string]*InspectionTaskRunner (pkg/core/inspection/server.go).
  • There is no delete() operation or cleanup endpoint for the inspections map.
  • Running DryRun() does not set the runner field or prune the runner.
  • As a result, abandoned or dry-run inspections accumulate silently in memory without any visibility in the UI.

Proposed Solutions

We should introduce a lifecycle management mechanism for inspection runners. Ideas include:

  1. Explicit Deletion API: Provide a DELETE /api/v3/inspection/:inspectionID endpoint.
  2. Automatic Cleanup (TTL / GC): Implement a background worker in InspectionTaskServer to purge idle or un-started inspection runners after a configurable duration of inactivity.

Activity

  1. added
    type:bug
    area:backend-core
    on Jun 25, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    area:backend-coretype:bug

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions