fix(runtime): pin owner task futures before executor handoff

Larger script preparation state exposed a stack overflow while a child message
handler created an external worker. LLDB stopped in spawn_local while reserving
another large copy of the owner task future on the caller stack.

Pin the payload before wrapping it in executor/TLS and spawn futures so nested
owner turns carry a pointer instead of duplicating the task state.
This commit is contained in:
ldm0
2026-11-20 22:47:44 +08:00
parent 67b690fa15
commit 8b697bf0dc
+4
View File
@@ -14,6 +14,10 @@ where
R: 'static,
F: std::future::Future<Output = Result<R>> + 'static,
{
// Page task futures carry script preparation state. Keep that state on the
// heap before wrapping it in executor/TLS and spawn futures, so nested owner
// turns do not repeatedly reserve large copies on the caller's stack.
let future = Box::pin(future);
let (reply_tx, reply_rx) = oneshot::channel();
let timing_enabled = moli_trace::cdp_nav_timing_enabled();
let started = timing_enabled.then(std::time::Instant::now);