diff --git a/src-tauri/src/sidecar.rs b/src-tauri/src/sidecar.rs index 89704a9..8d93756 100644 --- a/src-tauri/src/sidecar.rs +++ b/src-tauri/src/sidecar.rs @@ -110,6 +110,12 @@ impl SidecarHandle { let api_port = pick_port()?; let tcp_port = pick_port_skip(&[api_port])?; let quic_port = pick_port_skip(&[api_port, tcp_port])?; + // mycelium also opens an internal JSON-RPC / metrics endpoint on + // 127.0.0.1:8990 by default; if 8990 is already taken (e.g. by an + // orphan from a previous run we couldn't SIGKILL because it ran as + // root) the new instance dies a few seconds after start. Pin this + // to a fresh ephemeral port too. + let metrics_port = pick_port_skip(&[api_port, tcp_port, quic_port])?; let data_dir = app .path() @@ -126,6 +132,8 @@ impl SidecarHandle { tcp_port.to_string(), "--quic-listen-port".to_string(), quic_port.to_string(), + "--metrics-api-address".to_string(), + format!("127.0.0.1:{metrics_port}"), "--key-file".to_string(), key_path.display().to_string(), ]; @@ -149,7 +157,7 @@ impl SidecarHandle { info!( ?bin, - api_port, tcp_port, quic_port, + api_port, tcp_port, quic_port, metrics_port, "spawning mycelium sidecar via pkexec" );