gnzsnz / ib-gateway-docker

Docker image with IB Gateway/TWS and IBC
https://github.com/users/gnzsnz/packages/container/package/ib-gateway
MIT License
262 stars 48 forks source link

Out of memory when plenty available #149

Closed acrespillo closed 2 months ago

acrespillo commented 2 months ago

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:

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

gnzsnz commented 2 months ago

Please try with the Java heap setting, #51