Environment:2giosangmitom Sqmeow nvim Tokio Multi Thread Runtime
| Knowledge Sources | |
|---|---|
| Domains | Infrastructure, Async_Runtime |
| Last Updated | 2026-10-16 14:00 GMT |
Overview
Tokio multi-threaded async runtime (1.53+) powering the sqmeow-core engine for concurrent database operations, cooperative cancellation, and RPC message handling.
Description
The sqmeow-core engine binary starts a Tokio multi-thread runtime with enable_all() features. This runtime drives all async work: the MessagePack-RPC connection over stdio, database query execution, SSH tunnel establishment, and cancellation token handling. The multi-thread scheduler allows blocking adapter operations (e.g. SQLite's worker thread, Oracle's blocking driver) to run on a thread pool without stalling the RPC channel.
The runtime is configured with the following Tokio features: rt-multi-thread, macros, process, sync, time, net, and io-util.
Usage
This environment is automatically established when the sqmeow-core engine binary starts. It is the mandatory runtime for every database operation, RPC message, and async task. No user configuration is needed — the runtime is created in main() before serving begins.
System Requirements
| Category | Requirement | Notes |
|---|---|---|
| OS | Linux, macOS, or Windows | Tokio multi-thread runtime is cross-platform |
| Threads | Multiple OS threads available | Multi-thread scheduler spawns worker threads |
| Memory | Sufficient for thread stacks | Default thread stack size per worker |
Dependencies
Rust Crates
tokio>= 1.53 with features:rt-multi-thread,macros,process,sync,time,net,io-utiltokio-util>= 0.7 (CancellationToken, compat)
Credentials
No credentials required. The runtime is configured through environment variable SQMEOW_LOG for tracing output (directed to stderr, not stdout).
Quick Install
# The runtime is built into the engine; no separate install needed.
# Build the engine:
nix develop --command cargo build --release
# Control log output level:
SQMEOW_LOG=debug ./target/release/sqmeow-core
Code Evidence
Runtime creation from core/sqmeow-core/src/main.rs:32-41:
let runtime = match tokio::runtime::Builder::new_multi_thread()
.enable_all()
.build()
{
Ok(runtime) => runtime,
Err(error) => {
eprintln!("sqmeow-core: could not start the async runtime: {error}");
return std::process::ExitCode::FAILURE;
}
};
Tokio feature selection from core/sqmeow-core/Cargo.toml:20-28:
tokio = { workspace = true, features = [
"rt-multi-thread",
"macros",
"process",
"sync",
"time",
"net",
"io-util",
] }
Stdout reserved for RPC, stderr for tracing from core/sqmeow-core/src/main.rs:63-73:
fn init_tracing() {
let filter = EnvFilter::try_from_env("SQMEOW_LOG").unwrap_or_else(|_| EnvFilter::new("warn"));
tracing_subscriber::fmt()
// stdout belongs to the protocol.
.with_writer(std::io::stderr)
// The editor shows stderr as plain text.
.with_ansi(false)
.with_env_filter(filter)
.with_target(false)
.init();
}
Common Errors
| Error Message | Cause | Solution |
|---|---|---|
sqmeow-core: could not start the async runtime |
Thread creation or resource limit failure | Check system resource limits (ulimit) |
| Engine hangs / no output on stdout | Runtime started but RPC frames not flowing | Ensure stdout is not being consumed by tracing; check SQMEOW_LOG level
|
polars: pool deadlock |
Blocking operation on async thread | Code uses spawn_blocking for CPU-heavy Polars work
|
Compatibility Notes
- Multi-thread scheduler: Required for
spawn_blockingto run SQLite/Oracle blocking drivers without stalling async tasks. - Stdout exclusivity: The RPC transport reads/writes MessagePack frames on stdout. Any tracing or debug output to stdout corrupts the protocol. All diagnostics go to stderr.
- SQMEOW_LOG: Controls tracing filter level (e.g.
warn,debug,trace). Defaults towarn. ANSI colors are disabled because the editor shows stderr as plain text. - Version pinning:
tokio>= 1.53 is required by the workspace manifest.