From 1505432d5d00770c3391fb2d53dc585de59f3e6e Mon Sep 17 00:00:00 2001 From: dotcom07 Date: Thu, 19 Nov 2026 23:28:04 +0900 Subject: [PATCH] [FIX][Web] Read the time evaluator handle from the RPC return encoding LocalSession::EncodeReturn passes an object return as (type_index, handle) since the RPC moved to the new FFI ABI. The wasm session's time evaluator path still read the first value as the function, so it always got null and the browser runtime aborted on the check. Any time_evaluator call over the WebSocket RPC hung on the Python side. Read the handle from the second value, where EncodeReturn puts it. --- web/emcc/tvmjs_support.cc | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/web/emcc/tvmjs_support.cc b/web/emcc/tvmjs_support.cc index e04fd755e863..025fa4806760 100644 --- a/web/emcc/tvmjs_support.cc +++ b/web/emcc/tvmjs_support.cc @@ -176,10 +176,11 @@ class AsyncLocalSession : public LocalSession { ffi::Any rv; rv = retfunc; this->EncodeReturn(std::move(rv), [&](ffi::PackedArgs encoded_args) { - const void* pf = encoded_args[0].as(); + // EncodeReturn passes (type_index, handle) for objects. + void* pf = encoded_args[1].cast(); TVM_FFI_ICHECK(pf != nullptr); // mark as async. - async_func_set_.insert(const_cast(pf)); + async_func_set_.insert(pf); callback(RPCCode::kReturn, encoded_args); }); } catch (const std::runtime_error& e) {