We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
Encounter "Service was not ready: transport error" when making gRPC requests on from a client. The client was cloned before each request.
tonic = "0.12"
A grpc client was created at startup before serving my backend APIs. There are a bunch of setups but the following highlighted the gRPC client setup:
pub struct Router { pub gprc_client: Arc<MygRpcClient>, .... } fn main() { let router = { let rt = tokio::runtime::Builder::new_multi_thread() .enable_all() .worker_threads(config.thread_config.total_thread_count) .build() .unwrap(); rt.block_on(async move { let client = get_grpc_client("https://rtse-api-service.rtse.svc.cluster.local/").await.unwrap() let router = Router { gprc_client: Arc::new(client), }; router }) }; let rt = tokio::runtime::Builder::new_multi_thread() .enable_all() .worker_threads(5) .build() .unwrap(); rt.block_on(run_api(router)).unwrap(); } async fn get_grpc_client(url: String) -> Option<MygRpcClient> { let channel = Endpoint::from_shared(url); match channel { Ok(endpoint) => Some( MyServiceClient::new(endpoint.connect_lazy()) .accept_compressed(tonic::codec::CompressionEncoding::Zstd) .send_compressed(tonic::codec::CompressionEncoding::Zstd), ), Err(_) => None, } }
For each request I am cloning the client in order to handle concurrent request:
pub async fn handle_request(&self) { ... let gprc_client = (*self.gprc_client).clone(); let request = Request::new(GetRequest { param_a: ..., param_b: ..., }); let result = gprc_client.handle_grpc_request(request).await; match result { Ok(result) => { ... }, Err(err) => { let error_code = err.code(); let error_message = err.message(); // Got Error: Unknown error: Service was not ready : transport error log::error!("Got Error: {error_code} : {error_message}"); } } }
Could someone help me understand this error better? Thanks!
The text was updated successfully, but these errors were encountered:
try calling grpc_client.ready().await;
grpc_client.ready().await;
Sorry, something went wrong.
@LucioFranco I ran into a similar issue but ready is not an available method. Any other ideas?
ready
No branches or pull requests
Bug Report
Encounter "Service was not ready: transport error" when making gRPC requests on from a client. The client was cloned before each request.
Version
tonic = "0.12"
Description
A grpc client was created at startup before serving my backend APIs. There are a bunch of setups but the following highlighted the gRPC client setup:
For each request I am cloning the client in order to handle concurrent request:
Could someone help me understand this error better? Thanks!
The text was updated successfully, but these errors were encountered: