Skip to content

Disconnection issues on both Linux & Windows VPS #20

Description

@Jaddevvv

[Linux Docker 5.9.11] cTrader CLI gets stuck in Login failed reconnect loop

Summary

A cBot running through the official Linux Docker image loses its cTrader connection. The container and cTrader processes remain alive, but the CLI cannot complete account re-authentication.

After several failed login retries, the CLI reports that the connection was restored, but no subsequent Logged in. message appears. The cBot then stops producing normal market-processing logs.

A separate Windows VPS running cTrader CLI version 5.7.14.51420 successfully reconnects and logs in after similar connection interruptions.

Linux Docker environment

  • Image: ghcr.io/spotware/ctrader-console:latest
  • CLI version: 5.9.11.0
  • Image digest: <hash>
  • Linux VPS running Docker
  • Container: <redacted-container-name>
  • cBot: <CbotName>
  • Symbol: <Symbol>
  • Period: <Timeframe>
  • Broker/account details: redacted
  • The VPS SSH connection remained available during the failures.

The cBot was started with the equivalent of:

ctrader-cli run <algo-file> <cbotset-file> \
  --ctid=<redacted> \
  --pwd-file=<redacted> \
  --account=<redacted> \
  --broker=<redacted> \
  --symbol=<Symbol> \
  --period=<Timeframe> \
  --exit-on-stop

Docker state during the problem:

Status=running
Running=true
RestartCount=0
OOMKilled=false

The cTrader CLI process and algohost.netcore process were still running.

Linux startup

The cBot initially started and authenticated successfully:

The connection has been established.
Login to <redacted-account>...
Logged in.
Starting cBot...
Info | CBot instance [XXX] started.

The bot then produced normal trading activity, including successful market orders, position closes and stop-loss placement.

Linux successful reconnects

Some earlier interruptions recovered successfully:

10/09/2026 13:34:55 | The connection has been lost. Reconnecting...
10/09/2026 13:35:04 | Establishing connection...
10/09/2026 13:35:05 | The connection has been restored.
Login to <redacted-account>...
Logged in.

Linux failed reconnect loop

On 14 September 2026, the CLI entered this sequence:

2026-09-14T13:26:25.788Z Establishing connection...
2026-09-14T13:26:26.384Z The connection has been restored.
2026-09-14T13:26:26.480Z Login to <redacted-account>...
2026-09-14T13:26:26.480Z Connection Error: Unknown
2026-09-14T13:26:26.480Z Login failed. Retrying in 1 seconds...
2026-09-14T13:26:27.484Z Login to <redacted-account>...
2026-09-14T13:26:27.484Z Connection Error: Unknown
2026-09-14T13:26:27.484Z Login failed. Retrying in 2 seconds...
2026-09-14T13:26:29.488Z Login to <redacted-account>...
2026-09-14T13:26:29.488Z Connection Error: Unknown
2026-09-14T13:26:29.488Z Login failed. Retrying in 4 seconds...
2026-09-14T13:26:33.492Z Login to <redacted-account>...
2026-09-14T13:26:33.492Z Connection Error: Unknown
2026-09-14T13:26:33.492Z All login retry attempts failed, moving to reconnection state.
2026-09-14T13:26:33.492Z The connection has been lost. Reconnecting...
2026-09-14T13:26:33.492Z Establishing connection...
2026-09-14T13:26:33.540Z The connection has been restored.

After the final The connection has been restored message, no later Logged in. message appeared.

The container remained running and did not restart automatically. A separate read-only cbots query successfully authenticated to the account but returned:

{
  "cbots": [],
  "count": 0
}

Separate Windows comparison — cTrader CLI 5.7.14.51420

A separate Windows VPS, using a different provider and network, runs cTrader CLI version 5.7.14.51420:

PS C:\Users\Administrator> ctrader-cli.exe --version
Version: 5.7.14.51420

The Windows cBot was started using the equivalent command:

ctrader-cli.exe run "<redacted-algo-file>.algo" \
  --ctid=<redacted> \
  --pwd-file=<redacted> \
  --account=<redacted> \
  --symbol=<Symbol> \
  --period=<Timeframe> \
  --environment-variables \
  --full-access

The Windows cBot started normally:

The connection has been established.
Login to <redacted-account>...
Logged in.
Starting cBot...
Info | CBot instance [XXXX] started.
Info | <cBot> started.
Info | Connected: True

Windows reconnect 1

12/09/2026 20:37:39.338 | The connection has been lost. Reconnecting...
12/09/2026 20:37:40.594 | Establishing connection...
12/09/2026 20:37:40.884 | The connection has been restored.
Login to <redacted-account>...
Logged in.
Info | <cBot> CONNECTION RESTORED

Windows reconnect 2

13/09/2026 07:03:40.948 | Info | <cBot> CONNECTION LOST
13/09/2026 07:03:42.173 | The connection has been lost. Reconnecting...
13/09/2026 07:03:44.643 | Establishing connection...
13/09/2026 07:03:44.945 | The connection has been restored.
Login to <redacted-account>...
Logged in.
Info | <cBot> CONNECTION RESTORED

The Windows process successfully re-authenticated after both interruptions without a container or server restart.

Comparison and suspected scope

Both environments experience intermittent cTrader connection interruptions.

The Windows CLI successfully completes the reconnect and account login. The Linux Docker CLI reaches The connection has been restored, then enters repeated Connection Error: Unknown and Login failed messages.

This suggests that the failure may be specific to the Linux Docker reconnect/authentication path or to a version-specific regression. The Windows and Linux CLI versions are different, so this comparison is not intended to claim that both builds use identical code.

Docker sees a running process even though the trading session may no longer be authenticated.

Questions

  1. Is this a known reconnect/authentication issue in cTrader Console 5.9.11?
  2. Why does the CLI report The connection has been restored before account login still fails?
  3. Should the CLI recreate the account authentication/session after a socket reconnect?
  4. Should the CLI exit with a non-zero code after all login retries fail?
  5. Is there a recommended workaround other than manually restarting the container?
  6. Is a healthcheck or authenticated-session status planned for unattended Docker deployments?
  7. Is the reconnect behavior expected to differ between the Windows CLI and Linux Docker CLI?
  8. Is there a known-good CLI version that avoids this Linux/Windows reconnect loop?

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions