fix(fxt): default broker check port 4002 → 4004 (socat)

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 <noreply@anthropic.com>
This commit is contained in:
jgrusewski
2026-03-02 14:43:32 +01:00
parent d0b896b01c
commit 47cea06e86
3 changed files with 6 additions and 6 deletions

View File

@@ -55,7 +55,7 @@ pub struct CheckArgs {
#[arg(long, env = "IBKR_HOST")]
pub host: Option<String>,
/// IB Gateway port (4002 = paper, 4001 = live)
/// IB Gateway socat port (4004 = paper, 4003 = live)
#[arg(long, env = "IBKR_PORT")]
pub port: Option<u16>,
@@ -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);

View File

@@ -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);
}
}

View File

@@ -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 {