influxdata / influxdata/datafusion-udf-wasm

Check that IO runtime != CPU runtime

Open
#174 0 comments 0 reactions 0 assignees View on GitHub
blocked by upstream
Dominant language
Rust
Stars
20
Forks
3
Avg merge
6h 20m
Merged PRs (30d)
24

Description

# What
Add a check that makes sure that calls to async host methods and to [`async_in_sync_context`](https://github.com/influxdata/datafusion-udf-wasm/blob/968838c1893db90ab228d675e085f6c85aec9135/host/src/tokio_helpers.rs#L8C15-L8C36) are never done from the tokio I/O runtime.

# Why
With #173 it becomes somewhat important that the I/O runtime stays responsive. In general it's somewhat a footgun if people mix these two runtimes, even without #173.

# How
The only way to reason about the identity of a tokio runtime seems to be [`tokio::runtime::Handle::id`](https://docs.rs/tokio/latest/tokio/runtime/struct.Handle.html#method.id) -- which is currently marked as "unstable". Hence we need to wait til it is available without compiling tokio with `tokio_unstable`.

Contributor guide

Open the contributing guide

Research direction

Start in host/src/tokio_helpers.rs, especially async_in_sync_context, and trace the async host-method call sites. Confirm when tokio::runtime::Handle::id becomes available without tokio_unstable, then define checks that reject calls made from the I/O runtime while keeping that runtime responsive; the issue is done when those runtime-mixing checks are enforced.

Written by the indexing model from the issue text.

Assessment

Tech stack
rust
Domain
backend
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.