Skip to content

[bug] governor: control socket read has no idle timeout — a connect-and-stall peer leaks a task per connection forever #937

Description

@kurosawareiji7007-hub

Bug

crates/genie-governor/src/control.rs accepts connections on /run/geniepod/governor.sock and spawns one task per peer. handle_connection awaits read_control_line, which blocks on fill_buf() with no idle-read deadline.

Line size is capped (MAX_CONTROL_LINE_BYTES, #243/#251), but read time is not. A peer that connects and stalls (sends nothing, or bytes with no trailing \n) holds the task and socket fd forever. The accept loop has no concurrency cap, so N stalled peers leak N tasks/fds on the Jetson governor daemon.

Sibling pattern already fixed elsewhere: genie-core HTTP (#195), HA/LLM clients (#173/#181/#655), and this same crate's service_ctl/tegra_reader subprocess timeouts — control socket reads were never given the same treatment.

Expected

An idle peer should hit a read deadline, the connection should close, and the task should exit.

Actual

fill_buf().await parks until the peer closes or sends a newline. Stalled open peers never time out.

Suggested fix

Wrap read_control_line in tokio::time::timeout(CONTROL_READ_TIMEOUT, ...) (e.g. 30s) and break the connection loop on elapsed, matching SERVICE_CTL_TIMEOUT spirit in service_ctl.rs.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions