:hedgehog: PostHog is the leading platform for building self-driving products. Our developer tools – AI observability, analytics, session replay, flags, experiments, error tracking, logs, and more – capture all the context agents need to diagnose problems, uncover opportunities, and ship fixes. Steer it all from Slack, web, desktop, or the MCP.
Python ab-testingai-analyticsanalyticscdpdata-warehouseexperimentsfeature-flagsjavascriptproduct-analyticspythonreactsession-replaysurveystypescriptweb-analytics
fix(cymbal): increase resolution message size limit (#115019)
Hugues Pouillotaac34e51fe12
diff --git a/rust/cymbal-proto/src/lib.rs b/rust/cymbal-proto/src/lib.rsindex 627c741fb44b..a41254ea70dd 100644--- a/rust/cymbal-proto/src/lib.rs+++ b/rust/cymbal-proto/src/lib.rs@@ -1,3 +1,5 @@+pub const CYMBAL_RESOLUTION_MAX_MESSAGE_SIZE_BYTES: usize = 8 * 1024 * 1024;+pub mod cymbal {pub mod resolution {pub mod v1 {diff --git a/rust/cymbal/src/modes/processing/stages/resolution/remote/mux.rs b/rust/cymbal/src/modes/processing/stages/resolution/remote/mux.rsindex 50a25c24e5da..27216c435d1d 100644--- a/rust/cymbal/src/modes/processing/stages/resolution/remote/mux.rs+++ b/rust/cymbal/src/modes/processing/stages/resolution/remote/mux.rs@@ -16,6 +16,7 @@ use cymbal_proto::cymbal::resolution::v1::cymbal_resolution_client::CymbalResoluuse cymbal_proto::cymbal::resolution::v1::{resolve_outcome, Error, ErrorKind, ResolveItem, ResolveOutcome,};+use cymbal_proto::CYMBAL_RESOLUTION_MAX_MESSAGE_SIZE_BYTES;use futures::StreamExt;use tokio::sync::mpsc;use tokio::task::JoinHandle;@@ -333,7 +334,9 @@ async fn run_stream(}};- let mut client = CymbalResolutionClient::new(channel);+ let mut client = CymbalResolutionClient::new(channel)+ .max_decoding_message_size(CYMBAL_RESOLUTION_MAX_MESSAGE_SIZE_BYTES)+ .max_encoding_message_size(CYMBAL_RESOLUTION_MAX_MESSAGE_SIZE_BYTES);let response = client.resolve(request).await;let mut response_stream = match response {diff --git a/rust/cymbal/src/modes/resolution/README.md b/rust/cymbal/src/modes/resolution/README.mdindex 3b2a72b4cfaf..c62547cbb4ba 100644--- a/rust/cymbal/src/modes/resolution/README.md+++ b/rust/cymbal/src/modes/resolution/README.md@@ -48,6 +48,8 @@ The contract is intentionally split across two streams:- **`Resolve`** is bidirectional work traffic. The caller sends independent `ResolveItem`s, each with a per-stream id, `team_id`, serialized exception JSON, JSON `metadata` bytes, and an item deadline. The server emits an `Accepted` outcome when it admits an item, then exactly one terminal `ResolveOutcome` with the same id: `Done`, `Retry`, or `Error`. A `Done` carries the resolved exception JSON plus a `release_id`: the newest release bound to a symbol set the item's frames reference. It is empty when no referenced symbol set has a release, and on servers that predate the field, so callers treat empty as "no release".- **`Subscribe`** is endpoint freshness, draining, and soft load state. The cymbal-side `EndpointPool` opens one long-lived stream per pod and treats the latest `LoadEvent` as a freshness snapshot plus an `in_flight` / `max_in_flight` routing bias. `LoadEvent` does not carry overload state or suggested batch sizing.+Resolve requests and responses accept encoded messages up to 8 MiB. The processing client and resolution server use the same limit from `cymbal-proto`.+`Error.kind` is the shared control-flow surface:- `ERROR_KIND_INVALID_PAYLOAD` means the exception payload or `metadata` bytes do not match the wire convention.diff --git a/rust/cymbal/src/modes/resolution/mod.rs b/rust/cymbal/src/modes/resolution/mod.rsindex 25e8befcf5cc..c87aa0b6a358 100644--- a/rust/cymbal/src/modes/resolution/mod.rs+++ b/rust/cymbal/src/modes/resolution/mod.rs@@ -12,9 +12,11 @@ use std::time::Duration;use axum::{http::StatusCode, routing::get, Router};use cymbal_proto::cymbal::resolution::v1::cymbal_resolution_server::CymbalResolutionServer;+use cymbal_proto::CYMBAL_RESOLUTION_MAX_MESSAGE_SIZE_BYTES;use personhog_common::grpc::{tracked_tcp_incoming, GrpcLoadShedLayer, GrpcMetricsLayer};use tokio::sync::watch;use tokio::task::JoinHandle;+use tonic::service::interceptor::InterceptedService;use tonic::transport::Server;use tracing::{info, warn};@@ -85,19 +87,19 @@ pub async fn serve(info!("gRPC server listening on {}", res.grpc_address);+ let grpc_service = CymbalResolutionServer::new(service)+ .max_decoding_message_size(CYMBAL_RESOLUTION_MAX_MESSAGE_SIZE_BYTES)+ .max_encoding_message_size(CYMBAL_RESOLUTION_MAX_MESSAGE_SIZE_BYTES);+ let grpc_service = InterceptedService::new(grpc_service, move |request| {+ auth_interceptor.authenticate(request)+ });+let server_result = Server::builder().http2_keepalive_interval(Some(Duration::from_secs(30))).http2_keepalive_timeout(Some(Duration::from_secs(20))).layer(GrpcMetricsLayer::default().with_processing_time_header()).layer(GrpcLoadShedLayer::new(res.max_concurrent_requests))- // The cymbal client submits exception-level ResolveItems. The server- // relies on tonic's 4 MiB per-message default; an oversized item- // surfaces as `InvalidArgument`. Future: signal "send smaller" back- // via `LoadEvent`.- .add_service(CymbalResolutionServer::with_interceptor(- service,- move |request| auth_interceptor.authenticate(request),- ))+ .add_service(grpc_service).serve_with_incoming_shutdown(incoming, wait_for_shutdown(shutdown_rx)).await;diff --git a/rust/cymbal/tests/resolution_service_tests.rs b/rust/cymbal/tests/resolution_service_tests.rsindex fe4f8afd9be9..edd258b4562b 100644--- a/rust/cymbal/tests/resolution_service_tests.rs+++ b/rust/cymbal/tests/resolution_service_tests.rs@@ -20,6 +20,7 @@ use cymbal_proto::cymbal::resolution::v1::cymbal_resolution_server::CymbalResoluuse cymbal_proto::cymbal::resolution::v1::{resolve_outcome, ErrorKind, ResolveItem, ResolveOutcome, SubscribeRequest,};+use cymbal_proto::CYMBAL_RESOLUTION_MAX_MESSAGE_SIZE_BYTES;use futures::StreamExt;use tokio::sync::Semaphore;use tonic::transport::{Channel, Server};@@ -179,7 +180,11 @@ async fn spawn_test_channel(service: CymbalResolutionService) -> Channel {tokio::spawn(async move {Server::builder()- .add_service(CymbalResolutionServer::new(service))+ .add_service(+ CymbalResolutionServer::new(service)+ .max_decoding_message_size(CYMBAL_RESOLUTION_MAX_MESSAGE_SIZE_BYTES)+ .max_encoding_message_size(CYMBAL_RESOLUTION_MAX_MESSAGE_SIZE_BYTES),+ ).serve_with_incoming(incoming).await.expect("test gRPC server exits cleanly");@@ -213,7 +218,9 @@ async fn resolve_items_with_accepted(items: Vec<ResolveItem>,) -> Vec<ResolveOutcome> {let channel = spawn_test_channel(service).await;- let mut client = CymbalResolutionClient::new(channel);+ let mut client = CymbalResolutionClient::new(channel)+ .max_decoding_message_size(CYMBAL_RESOLUTION_MAX_MESSAGE_SIZE_BYTES)+ .max_encoding_message_size(CYMBAL_RESOLUTION_MAX_MESSAGE_SIZE_BYTES);let response = client.resolve(Request::new(futures::stream::iter(items))).await@@ -302,6 +309,27 @@ async fn bidi_resolve_stream_resolves_multiple_items_and_echoes_ids() {}}+#[tokio::test]+async fn bidi_resolve_stream_accepts_messages_larger_than_tonic_default() {+ let service = make_service(FakeResolver::default());+ let mut exc = raw_exception("RuntimeError");+ exc.exception_message = "x".repeat(5 * 1024 * 1024);+ let item = make_item(41, &exc);++ assert!(item.exception_json.len() > 4 * 1024 * 1024);+ assert!(item.exception_json.len() < CYMBAL_RESOLUTION_MAX_MESSAGE_SIZE_BYTES);++ let outcomes = resolve_items(service, vec![item]).await;++ assert_eq!(outcomes.len(), 1);+ let resolve_outcome::Result::Done(done) = outcome_result(&outcomes[0]) else {+ panic!("expected Done outcome, got {:?}", outcomes[0]);+ };+ let resolved: Exception =+ serde_json::from_slice(&done.resolved_exception_json).expect("valid resolved exception");+ assert_eq!(resolved.exception_message.len(), 5 * 1024 * 1024);+}+#[tokio::test]async fn admitted_items_emit_accepted_before_terminal_outcome() {let service = make_service(FakeResolver::default());