Closed iman38 closed 2 months ago
Hi @iman38, you are getting error above because it's not safe for async to be running across multiple threads. You need to use a function such as block_in_place
. See #112.
@iman38 Closing issue for now, feel free to re-open if problem still persists.
Hi @stefan-gorules ,
I found that I cannot evaluate inside an async fn having + Send trait (for thread safety). Below is a simple snippet to reproduce the issue. It's complaining about QuickJS runtime. I tried forking and changing the runtime (and context) to AsyncRuntime & AsyncContext, but found the problem on bumpalo as well. I would like to know if I miss anything I cannot find on the doc to do this properly, or if this is not supported yet.
p.s. please ignore the fact that the JSON file is not attached. However, this should reproduce a compile error.
Some errors I saw:
mut bumpalo::Bump
cannot be sent between threads safely [E0277] Help: within
{async block@src/bin/ts_zen.rs:26:58: 38:6}, the trait
std::marker::Sendis not implemented for
mut bumpalo::Bump, which is required by
{async block@src/bin/ts_zen.rs:26:58: 38:6}: std::marker::SendHelp: the trait
std::marker::Sendis implemented for
bumpalo::BumpNote: required because it appears within the type
zenexpression::arena::UnsafeArena<'>Note: required because it appears within the type
zenexpression::isolate::Isolate<'>Note: required because it appears within the type
zenengine::handler::table::zen::DecisionTableHandler<'>Note: required because it's used within this
asyncfn body Note: required because it's used within this
asyncfn body Note: required because it's used within this
asyncfn body Note: required because it's used within this
asyncblock Note: required for the cast from
std::pin::Pin<std::boxed::Box<{async block@src/bin/ts_zen.rs:26:58: 38:6}>>to
Pin<Box<dyn Future<Output = Result<bool, AirlineError>> + Send>>`