Skip to content

bug: a failed node start can leave the running node without an event loop #1399

Description

@ovitrif

Follow-ups from #1395, to fix in the ldk-node rc.82 bump PR:

  • A failed start() cancels whichever event loop is current, possibly one a concurrent start() on the same node installed, leaving a running node with no loop. Fix: listenForEvents returns the task it installs, and the catch cancels it only if eventLoopTask is still that task (compared under eventLoopLock). review
  • waitForEnd can return false for a finished task: cancelling the timer wakes its sleep, and try? lets resume(false) race resume(true), giving false shutdown warnings. Fix: resume false only when the sleep did not throw.
  • A stopped node's write that lands after stop()'s 5 s wait is fenced only once the app pins an ldk-node release with fix: fence a replaced vss store's writes ldk-node#140 (bug: a stopped node's last event can be delivered twice after a restart #1397).

Activity

  1. self-assigned this
    on Nov 23, 2026
  2. added theissue type on Nov 23, 2026
  3. added this to the 3.2.0 milestone on Nov 23, 2026
  4. ovitrif commented on Nov 23, 2026

    @ovitrif
    CollaboratorAuthor

    In 3.2.0: these are follow-ups to the node restart fix in #1395, part of the 3.2.0 stability work, and land in the ldk-node rc.82 bump PR before the release.

  5. ovitrif commented on Nov 24, 2026

    @ovitrif
    CollaboratorAuthor

    Two more gaps in the same area, from @pwltr's review of #1395 (#1395 (review)). Both predate that PR:

    • A failed start() cancels the event loop without waiting for it, so an acknowledgement or delivery the loop already took can still be in flight when a retry or wipe follows.
    • restart() and the previous-configuration recovery release the node with no wait when native stop() throws (for example PersistenceFailed), so a rebuild can load the wallet's event queue while the old loop's iteration still acknowledges or delivers.

    Fix both with the start() catch change above: wait for the loop being cancelled, bounded like stop(), before releasing or rebuilding.

  6. ovitrif commented on Nov 24, 2026

    @ovitrif
    CollaboratorAuthor

    Two more cases with the same root, from @pwltr's review of #1395 (#1395 (review)): a wallet graph or routing-cache reset still stopping the old node, or a wallet retry that read the old node, can cancel the listener a settings restart just installed for the replacement, leaving it running without a listener until another start.

    Fix with the rest of this issue: the event-loop slot records which node its loop serves, and a cancel or replace only takes the loop of the node it was asked about.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

Projects

No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions