Skip to content

Server-streaming requests block until first message is received #2302

Open
@headassbtw

Description

@headassbtw

Bug Report

Version

tonic v0.13.1
tonic-build v0.13.1

Platform

Linux arbiter 6.14.10-zen1-1-zen #1 ZEN SMP PREEMPT_DYNAMIC Wed, 04 Jun 2025 18:52:21 +0000 x86_64 GNU/Linux

Description

Upon requesting a streaming response, the (let's call it) "initial" call blocks until the first message is received, rather than .next() doing the blocking.

My code goes something like this :

let mut response = client.streaming_request(request.clone()).await?.into_inner();
while let Some(obj) = response.next().await { ... }

I would expect .next() to do all the blocking here (bar establishing the connection), but the blockage is split across .streaming_request() and .next(), the former blocking until the first streamed response, and the latter handling all subsequent responses.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions