From 056024b4471707d5472f83fc5121e57ce3dce179 Mon Sep 17 00:00:00 2001 From: Selman Date: Fri, 13 Mar 2026 18:40:19 +0300 Subject: [PATCH] fix: Lightpanda engine launch with release binaries (#760) Three issues prevented --engine lightpanda from working with official Lightpanda release builds: 1. Missing --log_level info: Lightpanda release builds default to log_level=warn, which suppresses the info-level "server running" startup message. wait_for_address() blocks forever reading an empty stderr pipe. Pass --log_level info explicitly. 2. --timeout 0 means instant disconnect: Lightpanda interprets 0 as "timeout after 0ms", not "no timeout". Use 604800 (1 week, the documented maximum) instead. 3. extract_address only matched pretty format: Release builds use logfmt (address=HOST:PORT without spaces), but the parser only matched the pretty format (address = HOST:PORT with spaces). Handle both formats. --- cli/src/native/cdp/lightpanda.rs | 40 ++++++++++++++++++++++++-------- 1 file changed, 30 insertions(+), 10 deletions(-) diff --git a/cli/src/native/cdp/lightpanda.rs b/cli/src/native/cdp/lightpanda.rs index 3f2e1f4..92cd545 100644 --- a/cli/src/native/cdp/lightpanda.rs +++ b/cli/src/native/cdp/lightpanda.rs @@ -110,9 +110,16 @@ pub fn launch_lightpanda(options: &LightpandaLaunchOptions) -> Result Option { - // Match "address = HOST:PORT" anywhere in the line - if let Some(idx) = line.find("address = ") { - let addr = line[idx + "address = ".len()..].trim().to_string(); - if !addr.is_empty() { - return Some(addr); + // Lightpanda uses logfmt (`address=...`) in release, pretty (`address = ...`) in debug. + for pattern in &["address=", "address = "] { + if let Some(idx) = line.find(pattern) { + let addr = line[idx + pattern.len()..].trim().to_string(); + // logfmt lines may have subsequent key=value pairs + let addr = addr.split_whitespace().next().unwrap_or("").to_string(); + if !addr.is_empty() { + return Some(addr); + } } } None @@ -234,8 +245,7 @@ mod tests { use super::*; #[test] - fn test_extract_address_standard() { - // Lightpanda outputs the address on a separate indented line + fn test_extract_address_pretty_debug_build() { assert_eq!( extract_address(" address = 127.0.0.1:9222"), Some("127.0.0.1:9222".to_string()) @@ -243,7 +253,17 @@ mod tests { } #[test] - fn test_extract_address_inline() { + fn test_extract_address_logfmt_release_build() { + assert_eq!( + extract_address( + "$time=1234 $scope=app $level=info $msg=\"server running\" address=127.0.0.1:9222" + ), + Some("127.0.0.1:9222".to_string()) + ); + } + + #[test] + fn test_extract_address_pretty_inline() { assert_eq!( extract_address("INFO app : server running address = 127.0.0.1:4567"), Some("127.0.0.1:4567".to_string())