Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

async enclave.run function that does not create a new tokio runtime #534

Open
DragonDev1906 opened this issue Oct 18, 2023 · 0 comments
Open

Comments

@DragonDev1906
Copy link

Description
I'm creating a custom runner that does more than just running the enclave. It also has other async code (network communication). At the moment the only way to use the custom runner is to call the (blocking) enclave.run method, which starts its own tokio runtime (unfortunately with an old version of tokio, see #403).

Problem or Motivation:
Because I'm using async code outside of the enclave runner I currently need two tokio runtimes:

  • Create a tokio runtime for the non-enclave related things in main (or with #[tokio::main])
  • Call spawn_blocking in my runtime
  • Call enclave.run in it
  • Which creates another tokio runtime for the enclave

Proposed solution:
Add a new async fn run_async() (or something similar), which uses an already existing runtime, does otherwise the same as enclave.run and returns a future representing the enclave running in the background. It could be almost the same as enclave.run, just not creating a runtime and returning the future instead of calling rt.block_on.

If there are restrictions of which runtime (version) this async fn can be used in: State the documentation of this function should state those.

Benefits:

  • No need to have two runtimes (although there may be restrictions on which version of tokio can be used on the outside, though ideally it would allow newer versions)
  • There can be a clear way to force stop the enclave (if that's possible), by just dropping the future or calling a function on it.

Additional context:
As stated above, ideally the enclave_runner would work with the newest tokio version, but I think this can be implemented without major impacts on other big PRs like the async usercall interface (#515)

@DragonDev1906 DragonDev1906 changed the title async enclave.run function not creating a new tokio runtime async enclave.run function that does not create a new tokio runtime Oct 20, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant