From 47cea06e86cfe05b2e83109f5f0b868803fd84e9 Mon Sep 17 00:00:00 2001 From: jgrusewski Date: Mon, 2 Mar 2026 14:43:32 +0100 Subject: [PATCH] =?UTF-8?q?fix(fxt):=20default=20broker=20check=20port=204?= =?UTF-8?q?002=20=E2=86=92=204004=20(socat)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The IB Gateway JVM uses non-blocking I/O on port 4002, which causes EAGAIN errors with ibapi's blocking Client::connect(). The gnzsnz image provides socat on port 4004 as a stable proxy that bridges blocking clients to the non-blocking gateway socket. Port 4004 is the correct client-facing port for paper mode (4003 for live). The K8s readiness probe stays on 4002 since TCP probes work fine with non-blocking sockets. Co-Authored-By: Claude Opus 4.6 --- bin/fxt/src/commands/broker.rs | 4 ++-- bin/fxt/src/config.rs | 6 +++--- bin/fxt/src/main.rs | 2 +- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/bin/fxt/src/commands/broker.rs b/bin/fxt/src/commands/broker.rs index 5da1be4b3..16cc0ccc7 100644 --- a/bin/fxt/src/commands/broker.rs +++ b/bin/fxt/src/commands/broker.rs @@ -55,7 +55,7 @@ pub struct CheckArgs { #[arg(long, env = "IBKR_HOST")] pub host: Option, - /// IB Gateway port (4002 = paper, 4001 = live) + /// IB Gateway socat port (4004 = paper, 4003 = live) #[arg(long, env = "IBKR_PORT")] pub port: Option, @@ -411,7 +411,7 @@ mod tests { let resolved = resolve_config(&args, &config); assert_eq!(resolved.ibkr_host, "127.0.0.1"); - assert_eq!(resolved.ibkr_port, 4002); + assert_eq!(resolved.ibkr_port, 4004); assert_eq!(resolved.ibkr_client_id, 99); assert_eq!(resolved.gateway_url, "http://localhost:50060"); assert!(!resolved.skip_ibkr); diff --git a/bin/fxt/src/config.rs b/bin/fxt/src/config.rs index a31e7794f..5c6748c69 100644 --- a/bin/fxt/src/config.rs +++ b/bin/fxt/src/config.rs @@ -25,7 +25,7 @@ pub struct IbkrConfig { /// IB Gateway host #[serde(default = "default_ibkr_host")] pub host: String, - /// IB Gateway port (4002 = paper, 4001 = live) + /// IB Gateway socat port (4004 = paper, 4003 = live) #[serde(default = "default_ibkr_port")] pub port: u16, /// TWS client ID (unique per connection) @@ -37,7 +37,7 @@ fn default_ibkr_host() -> String { "127.0.0.1".to_owned() } fn default_ibkr_port() -> u16 { - 4002 + 4004 } fn default_ibkr_client_id() -> i32 { 99 @@ -274,7 +274,7 @@ mod tests { let config: TliConfig = toml::from_str("").unwrap(); assert_eq!(config.broker.gateway_url, "http://localhost:50060"); assert_eq!(config.broker.ibkr.host, "127.0.0.1"); - assert_eq!(config.broker.ibkr.port, 4002); + assert_eq!(config.broker.ibkr.port, 4004); assert_eq!(config.broker.ibkr.client_id, 99); } } diff --git a/bin/fxt/src/main.rs b/bin/fxt/src/main.rs index 3ad363d4a..5d28dcb16 100644 --- a/bin/fxt/src/main.rs +++ b/bin/fxt/src/main.rs @@ -223,7 +223,7 @@ enum Commands { 2. Broker Gateway gRPC: HealthCheck + SessionStatus\n\n\ Examples:\n\ fxt broker check\n\ - fxt broker check --host 10.0.0.5 --port 4002\n\ + fxt broker check --host 10.0.0.5 --port 4004\n\ fxt broker check --skip-ibkr" )] Broker {