[Interactive Brokers] v2.0.0rc2 historical client connect leaves IB Gateway 10.41 API unresponsive (accept-queue wedge requiring Gateway restart)

Author: sachinprCreated Aug 18, 2026Updated Sep 29, 2026

Bug report

HistoricalInteractiveBrokersClient (2.0.0rc2, Python bindings) times out connecting to IB Gateway 10.41, and after the failed attempt the Gateway's API socket stops serving all clients until the Gateway is restarted.

Environment

  • nautilus_trader 2.0.0rc2 (PyPI wheel, cp312, manylinux_2_34_x86_64)
  • Python 3.12.12 · Ubuntu 24.04 (kernel 6.8) · x86_64
  • IB Gateway 10.41.1c (paper account), IBC 3.23.0, headless (Xvfb)
  • Plain TCP to 127.0.0.1:4002 (also reproduced through a TCP relay from a container)

Reproduction (observed 4/4 times, 2026-08-16 → 2026-08-17)

  1. Fresh Gateway login. Health verified with a raw TWS-API probe (API\0 + v100..187 handshake, then startApi): server version 187, managedAccounts, nextValidId all returned.
  2. Construct HistoricalInteractiveBrokersClient with InteractiveBrokersDataClientConfig(host="127.0.0.1", port=4002, client_id=<unique>, connection_timeout=10).
  3. The client raises RuntimeError: Timed out connecting to IB Gateway/TWS after 10s.
  4. From that point the Gateway API is wedged for every client: new TCP connections complete (kernel backlog) but the application never reads — ss -tln shows Recv-Q growing on :4002 (observed up to 37) — and raw handshakes get no reply. Only a Gateway restart recovers it.

Evidence it is the rc2 client, not the Gateway/account/network

On the same freshly-restarted Gateway, immediately before/after nautilus attempts:

  • Official ibapi 9.81 (PyPI): connects, receives managedAccounts/nextValidId (historical request refused only due to that package's old protocol version). Gateway healthy afterwards.
  • ib_async 2.1.0: connects, fetches 104 × 1-hour EUR/USD MIDPOINT bars, disconnects cleanly. Gateway healthy afterwards.
  • nautilus 2.0.0rc2 connect attempt: timeout, then the Gateway API is unresponsive for all clients (verified with the raw probe).

Notes

  • Reproduced from host loopback and through a TCP relay, with several distinct client ids (183–186), which rules out client-id conflicts.
  • We could not find a documented minimum Gateway version for the rc2 adapter. If 10.41 is below the supported range, a hard version check with a clear error would prevent this being misdiagnosed (we initially blamed IB weekend maintenance).
  • Related closed issues checked and believed distinct: #4193 (connect-timeout socket leak, closed pre-rc2), #4210, #4412/#4418/#4457 (data-farm handling).

Workaround

Historical fetching via ib_async; nautilus retained for backtesting.

Source: nautechsystems/nautilus_trader