From bc25e2957bd7bed19b17fdae322511c4a616ec37 Mon Sep 17 00:00:00 2001 From: SAY-5 Date: Sat, 2 May 2026 05:56:50 -0700 Subject: [PATCH 1/2] runtime_service: don't panic if to_background_tx fails to upgrade after chain removal Signed-off-by: SAY-5 --- light-base/src/runtime_service.rs | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/light-base/src/runtime_service.rs b/light-base/src/runtime_service.rs index 49b5e74126..96eaf1a9c1 100644 --- a/light-base/src/runtime_service.rs +++ b/light-base/src/runtime_service.rs @@ -1672,6 +1672,14 @@ async fn run_background( (tx, pending_subscription.max_pinned_blocks.get() - 1), ); + // The chain object can be dropped concurrently; if so, the + // weak reference no longer upgrades and the original task is + // shutting down. Drop the response silently rather than + // panicking — the receiver is going away anyway. + let Some(to_background) = background.to_background_tx.upgrade() else { + continue; + }; + let _ = pending_subscription.result_tx.send(SubscribeAll { finalized_block_scale_encoded_header: finalized_block .scale_encoded_header @@ -1686,7 +1694,7 @@ async fn run_background( new_blocks: Subscription { subscription_id, channel: Box::pin(new_blocks_channel), - to_background: background.to_background_tx.upgrade().unwrap(), + to_background, }, }); } From 8bb13287e40416c42016b5ad233774bd957527a6 Mon Sep 17 00:00:00 2001 From: SAY-5 Date: Mon, 11 May 2026 13:01:45 -0700 Subject: [PATCH 2/2] chore: remove em-dashes from comments --- light-base/src/runtime_service.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/light-base/src/runtime_service.rs b/light-base/src/runtime_service.rs index 96eaf1a9c1..ff9ce2d7cf 100644 --- a/light-base/src/runtime_service.rs +++ b/light-base/src/runtime_service.rs @@ -1675,7 +1675,7 @@ async fn run_background( // The chain object can be dropped concurrently; if so, the // weak reference no longer upgrades and the original task is // shutting down. Drop the response silently rather than - // panicking — the receiver is going away anyway. + // panicking, the receiver is going away anyway. let Some(to_background) = background.to_background_tx.upgrade() else { continue; };