Fix task-slot collision when pathfinding scores sync is enabled#986
Fix task-slot collision when pathfinding scores sync is enabled#986jkczyz wants to merge 1 commit into
Conversation
The pathfinding scores sync task claimed the runtime's single background-processor slot, which LDK's background processor also claims later during startup. With a scores sync URL configured, node startup tripped a debug_assert in debug builds; in release builds the second spawn silently dropped the scores-sync task's join handle, so the task was detached and never joined at shutdown. Spawn it as a regular background task instead: it already exits on the general stop signal, so it is now joined gracefully alongside the other background tasks in Node::stop. Developed with assistance from Claude Code. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
|
👋 I see @joostjager was un-assigned. |
| let logger = Arc::clone(&logger); | ||
|
|
||
| runtime.spawn_background_processor_task(async move { | ||
| runtime.spawn_background_task(async move { |
There was a problem hiding this comment.
I think we should even use spawn_cancellable_background_task here, as we don't want to wait for this to finish on shutdown.
There was a problem hiding this comment.
We write both the the scores and the node metrics separately in that task. So the latest_pathfinding_scores_sync_timestamp metric may not be in sync if the task is cancelled between the writes. Maybe doesn't really matter if we'll sync on startup?
There was a problem hiding this comment.
Yeah, I think this is fine. We can't avoid the general issue in case of a panic, and worst case the timestamp in NodeMetrics will be stale, then updated on next node startup.
|
Pls re-request review when ready again |
The pathfinding scores sync task claimed the runtime's single background-processor slot, which LDK's background processor also claims later during startup. With a scores sync URL configured, node startup tripped a
debug_assertin debug builds; in release builds the second spawn silently dropped the scores-sync task's join handle, so the task was detached and never joined at shutdown.Spawn it as a regular background task instead: it already exits on the general stop signal, so it is now joined gracefully alongside the other background tasks in
Node::stop.Developed with assistance from Claude Code.