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

[fix] tower: "buffer full; poll_ready must be called first" #14

Merged
merged 1 commit into from
Apr 5, 2024

Conversation

nguquen
Copy link
Contributor

@nguquen nguquen commented Apr 5, 2024

When using AsyncInterceptor for tonic client through tower service, example:

let client_interceptor = ClientInterceptor::new().await?;
let auth_channel = tower::ServiceBuilder::new()
    .layer(async_interceptor(client_interceptor))
    .service(channel);
let client = ServiceClient::new(auth_channel.clone());

let response = client.get_user(Request::new(...)).await?;

it will face this error:

thread 'tokio-runtime-worker' panicked at 'buffer full; poll_ready must be called first', 
.../tower-0.4.13/src/buffer/service.rs:146:14

This fix use the same solution mentioned in here hyperium/tonic#624 (comment)

@jdahlq
Copy link
Member

jdahlq commented Apr 5, 2024

@nguquen Thanks for the PR, I appreciate you tracking down the issue and fixing it. I vaguely remember seeing this issue when I first wrote this utility, but I can't remember why I didn't end up using mem::replace. Maybe because the tests passed and my use case worked without it.

Anyway, I'll merge this and publish a new version.

@jdahlq jdahlq merged commit ab6e0f6 into arcanyx-pub:main Apr 5, 2024
@jdahlq
Copy link
Member

jdahlq commented Apr 5, 2024

@nguquen v0.11.1 has been published to Cargo

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

Successfully merging this pull request may close these issues.

2 participants