From fcd69926a76217c219b56b715ba6e7cc98de6aed Mon Sep 17 00:00:00 2001 From: xxchan Date: Wed, 25 Oct 2023 14:28:53 +0800 Subject: [PATCH] fix s3 stuck --- src/expr/src/expr/expr_udf.rs | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/src/expr/src/expr/expr_udf.rs b/src/expr/src/expr/expr_udf.rs index a748dfd059df1..db069a03763bd 100644 --- a/src/expr/src/expr/expr_udf.rs +++ b/src/expr/src/expr/expr_udf.rs @@ -174,10 +174,14 @@ impl<'a> TryFrom<&'a ExprNode> for UdfExpression { }, Some(PbExtra::Wasm(PbWasmUdfExtra { wasm_storage_url })) => { let wasm_engine = WasmEngine::get_or_create(); - let component = futures::executor::block_on({ - wasm_engine - .load_component(wasm_storage_url, &udf.identifier) - .instrument(tracing::info_span!("load_component", %udf.identifier)) + // Use `block_in_place` as an escape hatch to run async code here in sync context. + // Calling `block_on` directly will panic. + let component = tokio::task::block_in_place(|| { + tokio::runtime::Handle::current().block_on({ + wasm_engine + .load_component(wasm_storage_url, &udf.identifier) + .instrument(tracing::info_span!("load_component", %udf.identifier)) + }) })?; UdfImpl::Wasm { component }