Skip to content

Router keeps running after its data directory is gone #486

Description

@kevintseng

A MeMesh router has no idle or orphan exit: it stops only on SIGINT/SIGTERM (src/host-runtime/router.ts). Hosts start one detached when none is running for a data directory, and it reparents to PID 1. When a data directory is deleted or no longer used (a custom MEMESH_DIR that changed, a temporary directory, a test run), its router keeps running forever and serves nothing.

Seen while testing the Codex plugin against throwaway MEMESH_DIRs: six detached routers accumulated, one per directory, including directories that had already been deleted.

Scope: the default single data directory is unaffected (one long-lived router is intended).

Proposed fix: the router checks periodically that its data directory (or its socket path) still exists and exits when it does not. This is safe because hosts already start a replacement when no router answers. An additional idle exit (no registered sessions or pending deliveries for N minutes) is a product decision.

Activity

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

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions