Skip to content

vol2: ReteCompiledEngine.disposeUnit() silently ignores double-dispose — consider lifecycle guard #6725

@mdproctor

Description

@mdproctor

Context

After #6715, disposeUnit() decrements the adapter refcount for each DataStore. If disposeUnit() is called twice on the same unit, the second call finds no entry in adapterRefCounts (already removed on first call) and silently no-ops.

Problem

Silent no-op on double-dispose hides lifecycle bugs in callers. A unit disposed twice indicates an error in the caller's lifecycle management, but the engine gives no feedback.

Options

  1. Throw IllegalStateException on double-dispose (strict — forces callers to be correct)
  2. Log a warning (lenient — surfaces the bug without crashing)
  3. Track disposed units in a Set and assert (clearer diagnostics)

Option 1 is preferred — vol2 has no external users, breaking callers is the point.

Refs #6715

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    Status
    📋 Backlog

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions