Skip to content

Out of memory when plenty available #149

@acrespillo

Description

@acrespillo

Describe the bug

I'm running ib-gateway docker image using an AWS t3.xlarge instance (16gb memory). My algorithm always gets disconnected after 2h hours of normal operation after what seems a crash at the ib-gateway container.

At the docker logs can be seen a memory usage issue, but not sure if that comes from any misconfiguration on my end (logs and docker compose config attached).

Expected

A clear and concise description of what you expected to happen.

Docker compose config

`

name: test
services:
ib-gateway:
build:
context: /home/ubuntu/ib-gateway-docker/latest
dockerfile: Dockerfile
tags:
- ghcr.io/gnzsnz/ib-gateway:latest
devices:
- /dev/dri:/dev/dri
environment:
ALLOW_BLIND_TRADING: "no"
AUTO_LOGOFF_TIME: ""
AUTO_RESTART_TIME: 11:59 PM
BYPASS_WARNING: ""
CUSTOM_CONFIG: "NO"
EXISTTING_SESSION_DETECTED_ACTION: primary
JAVA_HEAP_SIZE: ""
READ_ONLY_API: "no"
RELOGIN_AFTER_TWOFA_TIMEOUT: "no"
SAVE_TWS_SETTINGS: ""
SSH_ALIVE_COUNT: ""
SSH_ALIVE_INTERVAL: ""
SSH_OPTIONS: ""
SSH_PASSPHRASE: ""
SSH_REMOTE_PORT: ""
SSH_RESTART: ""
SSH_TUNNEL: ""
SSH_USER_TUNNEL: ""
SSH_VNC_PORT: ""
TIME_ZONE: Europe/Berlin
TRADING_MODE: paper
TWOFA_EXIT_INTERVAL: "60"
TWOFA_TIMEOUT_ACTION: restart
TWS_ACCEPT_INCOMING: manual
TWS_COLD_RESTART: ""
TWS_PASSWORD: xxx
TWS_PASSWORD_PAPER: ""
TWS_SETTINGS_PATH: ""
TWS_USERID: xxx
TWS_USERID_PAPER: ""
TZ: Europe/Berlin
VNC_SERVER_PASSWORD: myVncPassword
image: ghcr.io/gnzsnz/ib-gateway:latest
networks:
default: null
ports:
- mode: ingress
host_ip: 127.0.0.1
target: 4003
published: "4001"
protocol: tcp
- mode: ingress
host_ip: 127.0.0.1
target: 4004
published: "4002"
protocol: tcp
- mode: ingress
host_ip: 127.0.0.1
target: 5900
published: "5900"
protocol: tcp
restart: always
security_opt:
- seccomp:unconfined
shm_size: "1073741824"
volumes:
- type: bind
source: /home/ubuntu/ib-gateway-docker/config
target: /config
bind:
create_host_path: true
- type: volume
source: tws_tmp
target: /tmp
volume: {}
networks:
default:
name: test_default
volumes:
tws_tmp:
name: test_tws_tmp`

Container logs

`

ib-gateway-1 | 2024-08-21 12:02:06:111 IBC: detected dialog entitled: Warning; event=Activated
ib-gateway-1 | 2024-08-21 12:02:06:113 IBC: detected dialog entitled: Warning; event=Focused
ib-gateway-1 | 2024-08-21 12:02:06:114 IBC: detected dialog entitled: Warning; event=Opened
ib-gateway-1 | 2024-08-21 12:02:06:115 IBC: Click button: I understand and accept
ib-gateway-1 | 2024-08-21 12:02:06:219 IBC: Setting ReadOnlyApi
ib-gateway-1 | 2024-08-21 12:02:06:374 IBC: Read-Only API checkbox is now set to: false
ib-gateway-1 | 2024-08-21 12:02:06:374 IBC: Setting Auto restart time
ib-gateway-1 | 2024-08-21 12:02:06:420 IBC: Auto restart time set to 11:59 PM
ib-gateway-1 | 2024-08-21 12:02:06:468 IBC: detected dialog entitled: Warning; event=Lost focus
ib-gateway-1 | 2024-08-21 12:02:06:469 IBC: detected dialog entitled: Warning; event=Deactivated
ib-gateway-1 | 2024-08-21 12:02:06:469 IBC: detected dialog entitled: Warning; event=Closed
ib-gateway-1 | 2024-08-21 12:02:06:470 IBC: Configuration tasks completed
ib-gateway-1 | 2024-08-21 12:02:06:470 IBC: Click button: OK
ib-gateway-1 | 2024-08-21 12:02:06:663 IBC: detected dialog entitled: Pending Tasks; event=Closed
ib-gateway-1 | 2024-08-21 12:02:06:664 IBC: detected dialog entitled: IBKR Gateway; event=Activated
ib-gateway-1 | 2024-08-21 12:02:06:667 IBC: detected dialog entitled: IBKR Gateway; event=Focused
ib-gateway-1 | 2024-08-21 12:02:06:668 IBC: detected dialog entitled: IBKR Gateway; event=Opened
ib-gateway-1 | 2024-08-21 12:02:06:669 IBC: Click button: OK
ib-gateway-1 | 2024-08-21 12:02:06:776 IBC: detected dialog entitled: IBKR Gateway; event=Lost focus
ib-gateway-1 | 2024-08-21 12:02:06:778 IBC: detected dialog entitled: IBKR Gateway; event=Deactivated
ib-gateway-1 | 2024-08-21 12:02:06:780 IBC: detected dialog entitled: IBKR Gateway; event=Closed
ib-gateway-1 | 2024-08-21 12:02:06:781 IBC: detected dialog entitled: DU9160780 Trader Workstation Configuration (Simulated Trading); event=Closed
ib-gateway-1 | remove Client 0
ib-gateway-1 |
ib-gateway-1 | Exception: java.lang.OutOfMemoryError thrown from the UncaughtExceptionHandler in thread "JTS-AsyncNonLocked-43"
ib-gateway-1 |
ib-gateway-1 | Exception: java.lang.OutOfMemoryError thrown from the UncaughtExceptionHandler in thread "JTS-euhmdsDispatcherS10-28817S10-28818"
ib-gateway-1 |
ib-gateway-1 | Exception: java.lang.OutOfMemoryError thrown from the UncaughtExceptionHandler in thread "JTS-secdefilListenerS6-75"
ib-gateway-1 |
ib-gateway-1 | Exception: java.lang.OutOfMemoryError thrown from the UncaughtExceptionHandler in thread "JTS-ushmdsListenerS5-72"
ib-gateway-1 |
ib-gateway-1 | Exception: java.lang.OutOfMemoryError thrown from the UncaughtExceptionHandler in thread "JTS-secdefilServicePingS6-88"
ib-gateway-1 |
ib-gateway-1 | Exception: java.lang.OutOfMemoryError thrown from the UncaughtExceptionHandler in thread "JTS-CCPListenerS3-26"
ib-gateway-1 |
ib-gateway-1 | Exception: java.lang.OutOfMemoryError thrown from the UncaughtExceptionHandler in thread "JTS-usfarmServicePingS4-89"
ib-gateway-1 |
ib-gateway-1 | Exception: java.lang.OutOfMemoryError thrown from the UncaughtExceptionHandler in thread "JTS-ushmdsDispatcherS5-73S5-74"
ib-gateway-1 |
ib-gateway-1 | Exception: java.lang.OutOfMemoryError thrown from the UncaughtExceptionHandler in thread "JTS-ushmdsServicePingS5-87"
ib-gateway-1 |
ib-gateway-1 | Exception: java.lang.OutOfMemoryError thrown from the UncaughtExceptionHandler in thread "JTS-usfarmDispatcherS4-60S4-61"
ib-gateway-1 | 2024-08-21 14:16:10,003 JTS-Clock-40 ERROR An exception occurred processing Appender e org.apache.logging.log4j.core.appender.AppenderLoggingException: java.lang.OutOfMemoryError: Java heap space
ib-gateway-1 | at org.apache.logging.log4j.core.config.AppenderControl.tryCallAppender(AppenderControl.java:165)
ib-gateway-1 | at org.apache.logging.log4j.core.config.AppenderControl.callAppender0(AppenderControl.java:134)
ib-gateway-1 | at org.apache.logging.log4j.core.config.AppenderControl.callAppenderPreventRecursion(AppenderControl.java:125)
ib-gateway-1 | at org.apache.logging.log4j.core.config.AppenderControl.callAppender(AppenderControl.java:89)
ib-gateway-1 | at org.apache.logging.log4j.core.config.LoggerConfig.callAppenders(LoggerConfig.java:542)
ib-gateway-1 | at org.apache.logging.log4j.core.config.LoggerConfig.processLogEvent(LoggerConfig.java:500)
ib-gateway-1 | at org.apache.logging.log4j.core.config.LoggerConfig.log(LoggerConfig.java:483)
ib-gateway-1 | at org.apache.logging.log4j.core.config.LoggerConfig.log(LoggerConfig.java:417)
ib-gateway-1 | at org.apache.logging.log4j.core.config.AwaitCompletionReliabilityStrategy.log(AwaitCompletionReliabilityStrategy.java:82)
ib-gateway-1 | at org.apache.logging.log4j.core.Logger.log(Logger.java:161)
ib-gateway-1 | at org.apache.logging.log4j.spi.AbstractLogger.tryLogMessage(AbstractLogger.java:2205)
ib-gateway-1 | at org.apache.logging.log4j.spi.AbstractLogger.logMessageTrackRecursion(AbstractLogger.java:2159)
ib-gateway-1 | at org.apache.logging.log4j.spi.AbstractLogger.logMessageSafely(AbstractLogger.java:2142)
ib-gateway-1 | at org.apache.logging.log4j.spi.AbstractLogger.logMessage(AbstractLogger.java:2017)
ib-gateway-1 | at org.apache.logging.log4j.spi.AbstractLogger.logIfEnabled(AbstractLogger.java:1983)
ib-gateway-1 | at org.apache.logging.log4j.spi.AbstractLogger.info(AbstractLogger.java:1320)
ib-gateway-1 | at twslaunch.jutils.aM.t(aM.java:441)
ib-gateway-1 | at twslaunch.jutils.aM.u(aM.java:108)
ib-gateway-1 | at twslaunch.jutils.aK.run(aK.java:143)
ib-gateway-1 | Caused by: java.lang.OutOfMemoryError: Java heap space
`

Versions

  • OS: Ubuntu
  • Docker version 24.0.7, build 24.0.7-0ubuntu4
  • Image: gnzsnz/ib-gateway:latest
  • Image Digest: sha256:80083540e2e08bd2095a6c43a387057d15d5bd81911298ec0f16ddc2ac328ddd

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions