Skip to content

executor::block_on in RpcClient panics inside tokio runtime context #153

@doubleailes

Description

@doubleailes

Summary

futures::executor::block_on in RpcClient is a foot-gun. The client uses it for connection setup inside what may already be a tokio runtime context. This will panic if called inside an active tokio runtime — you cannot nest block_on in tokio.

Details

The service side uses #[tokio::main] correctly, but the client is a landmine for anyone embedding it in an existing async app.

Calling RpcClient methods from within a tokio context (e.g. inside a #[tokio::main] or from a spawned task) triggers:

thread 'main' panicked at 'cannot execute `LocalPool::run_until` after `it has been dropped`'

or similar nested-runtime panics.

Proposed Fix

Make RpcClient natively async — replace futures::executor::block_on with proper async fn signatures, letting the caller drive the executor. Optionally provide a blocking convenience wrapper that spawns its own runtime only if none is detected.

Impact

Any user embedding girolle's RPC client inside an existing async application (actix-web, axum, tonic, etc.) will hit this.

Labels

bug, help wanted

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions