riker icon indicating copy to clipboard operation
riker copied to clipboard

`Running Futures` example is invalid

Open berkus opened this issue 4 years ago • 1 comments

As displayed in the example code:

let handle = system.run(async move {
    "someval".to_string()
});

assert_eq!(block_on(handle), "someval".to_string());

This will not even build because run() returns Result<RemoteHandle...> and block_on() expects a non-Result argument.

berkus avatar Oct 10 '21 16:10 berkus

If you try to unwrap() and run block_on(handle.unwrap()) then riker will crash with:

thread 'pool-thread-#0' panicked at 'cannot execute LocalPool executor from within another executor: EnterError', stack backtrace: thread 'pool-thread-#4' panicked at 'there is no reactor running, must be called from the context of a Tokio 1.x runtime'

berkus avatar Oct 10 '21 16:10 berkus

Any news on this? I'm having the exact same issue

knepe avatar Oct 03 '23 17:10 knepe

@knepe the riker project is abandoned. The original maintainer vanished without saying anything. It's probably better to migrate towards a different actor framework.

For the problem itself: block_on must be called from a tokio context. That means, you need to run your app as a tokio app and run block_on from there.

hardliner66 avatar Oct 04 '23 18:10 hardliner66

Ah damn :( Thanks!

knepe avatar Oct 04 '23 20:10 knepe

@knepe https://github.com/slawlor/ractor perhaps :)

berkus avatar Oct 05 '23 16:10 berkus