diff --git a/CHANGELOG.md b/CHANGELOG.md index d6fd5975..c9f3cf39 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -16,6 +16,14 @@ The minor version will be incremented upon a breaking change and the patch versi ### Breaking +## 2025-06-10 + +- yellowstone-grpc-geyser-4.2.3 + +### Fixes + +- geyser: log gRPC server panics ([#515](https://github.com/rpcpool/yellowstone-grpc/pull/519)) + ## 2025-06-01 - @triton-one/yellowstone-grpc@4.1.0 diff --git a/yellowstone-grpc-geyser/src/grpc.rs b/yellowstone-grpc-geyser/src/grpc.rs index 53e6f725..d1434e4f 100644 --- a/yellowstone-grpc-geyser/src/grpc.rs +++ b/yellowstone-grpc-geyser/src/grpc.rs @@ -482,11 +482,18 @@ impl GrpcService { let shutdown = Arc::new(Notify::new()); let shutdown_grpc = Arc::clone(&shutdown); tokio::spawn(async move { + // Add low-overhead panic hook without affecting any hooks added by Solana. + let old_hook = std::panic::take_hook(); + std::panic::set_hook(Box::new(move |panic_info| { + error!("gRPC server task panicked: {:?}", panic_info); + old_hook(panic_info); // Chain to the previous hook + })); + // gRPC Health check service let (mut health_reporter, health_service) = health_reporter(); health_reporter.set_serving::>().await; - server_builder + let result = server_builder .layer(interceptor(move |request: Request<()>| { if let Some(x_token) = &config.x_token { match request.metadata().get("x-token") { @@ -500,7 +507,12 @@ impl GrpcService { .add_service(health_service) .add_service(service) .serve_with_incoming_shutdown(incoming, shutdown_grpc.notified()) - .await + .await; + + match result { + Ok(_) => info!("gRPC server task finished"), + Err(e) => error!("gRPC server task failed: {e}"), + } }); Ok((snapshot_tx, messages_tx, shutdown))