Skip to content

No periodic cleanup of orphaned pending connections in dynamic engine #289

@staging-devin-ai-integration

Description

Problem

In the dynamic engine actor (crates/engine/src/dynamic_actor.rs), if a background node creation task's NodeCreatedEvent send fails (e.g., because the actor's receiver has been dropped during shutdown), the pending connections referencing that node would remain in self.pending_connections indefinitely.

Details

The spawned creation task uses let _ = tx.send(...).await which silently drops send failures. While spawn_blocking panics are caught and converted to error results, the send itself could fail if the actor loop has moved on. In practice this is unlikely since the actor loop runs until explicit shutdown (which clears pending connections), but there's no defense-in-depth mechanism.

Suggested fix

Consider adding:

  • A periodic sweep that removes pending connections referencing nodes no longer in node_states
  • Or a timeout on pending connections (e.g., if a connection has been pending for > 60s, log a warning and drain it)

Context

Identified during review of PR #286 (async AddNode). Low priority — the current code handles the common failure paths correctly (creation failure, initialization failure, RemoveNode while Creating, Shutdown).

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions