mvberg / ib-gateway-docker

Interactive Brokers Trading Gateway running in Docker
MIT License
224 stars 105 forks source link

error after stop and rerun docker-compose up #11

Open Macfly opened 5 years ago

Macfly commented 5 years ago

the first start works fine but if I kill the process with ctrl + C and rerun docker-compose up I have the following error:

co@ub  ~/project/IBproject/ib-gateway-docker   master ●  docker-compose up
Starting ibgatewaydocker_tws_1 ... done
Attaching to ibgatewaydocker_tws_1
tws_1  | Starting virtual X frame buffer: Xvfb.
tws_1  | 22:55:36:156 IBController: detected frame entitled: IB Gateway; event=Activated
tws_1  | 22:55:36:163 IBController: detected frame entitled: IB Gateway; event=Opened
tws_1  | 22:55:36:165 IBController: Setting Trading mode = paper
tws_1  | 22:55:36:196 IBController: Click button: Login
tws_1  | 22:55:37:518 IBController: detected frame entitled: IB Gateway.  API Account: fdemo; event=Activated
tws_1  | 22:55:37:523 IBController: detected frame entitled: IB Gateway.  API Account: fdemo; event=Opened
tws_1  | 22:55:37:524 IBController: Found Gateway main window
tws_1  | 22:55:37:734 IBController: detected frame entitled: IB Gateway; event=Activated
tws_1  | 22:55:37:736 IBController: detected dialog entitled: IB Gateway; event=Opened
tws_1  | 22:55:37:738 IBController: detected dialog entitled: IB Gateway; event=Activated
tws_1  | mkdir: cannot create directory '/.vnc': File exists
tws_1  | stored passwd in file: /.vnc/passwd
tws_1  | Starting x11vnc.
tws_1  |
tws_1  | +==============================================================================
tws_1  | +
tws_1  | + IBController version 3.2.0.5
tws_1  | +
tws_1  | + Running GATEWAY 974
tws_1  | +
tws_1  | + Diagnostic information is logged in:
tws_1  | +
tws_1  | + /opt/IBController/Logs/ibc-3.2.0.5_GATEWAY-974_Friday.txt
tws_1  | +
tws_1  | +
tws_1  |
tws_1  | ================================================================================
tws_1  |
tws_1  | Starting IBController version 3.2.0.5 on 2019-05-24 at 23:00:36
tws_1  |
tws_1  | Operating system: Linux 5c7438496b9a 4.15.0-48-generic #51-Ubuntu SMP Wed Apr 3 08:28:49 UTC 2019 x86_64 x86_64 x86_64 GNU/Linux
tws_1  |
tws_1  | Arguments:
tws_1  |
tws_1  | TWS version = 974
tws_1  | Entry point = ibcontroller.IBGatewayController
tws_1  | --tws-path = /root/Jts
tws_1  | --tws-settings-path = /root/Jts
tws_1  | --ibc-path = /opt/IBController
tws_1  | --ibc-ini = /root/IBController/IBController.ini
tws_1  | --mode = paper
tws_1  | --java-path = /opt/i4j_jres/1.8.0_152/bin
tws_1  | --user = ***
tws_1  | --pw = ***
tws_1  | --fix-user =
tws_1  | --fix-pw =
tws_1  |
tws_1  | =================================
tws_1  | Generating the classpath
tws_1  | Classpath=/root/Jts/ibgateway/974/jars/jts4launch-974.jar:/root/Jts/ibgateway/974/jars/locales.jar:/root/Jts/ibgateway/974/jars/log4j-api-2.5.jar:/root/Jts/ibgateway/974/jars/log4j-core-2.5.jar:/root/Jts/ibgateway/974/jars/total-2018.jar:/root/Jts/ibgateway/974/jars/twslaunch-974.jar:/root/Jts/ibgateway/974/jars/twslaunch-install4j-1.9.jar:/opt/IBController/IBController.jar
tws_1  |
tws_1  | Generating the JAVA VM options
tws_1  | Java VM Options=-Xmx768m -XX:+UseG1GC -XX:MaxGCPauseMillis=200 -XX:ParallelGCThreads=20 -XX:ConcGCThreads=5 -XX:InitiatingHeapOccupancyPercent=70
tws_1  |
tws_1  | Determining the location of java executable
tws_1  | Location of java executable=/opt/i4j_jres/1.8.0_152/bin
tws_1  |
tws_1  | Starting IBGateway with this command:
tws_1  | /opt/i4j_jres/1.8.0_152/bin/java -cp /root/Jts/ibgateway/974/jars/jts4launch-974.jar:/root/Jts/ibgateway/974/jars/locales.jar:/root/Jts/ibgateway/974/jars/log4j-api-2.5.jar:/root/Jts/ibgateway/974/jars/log4j-core-2.5.jar:/root/Jts/ibgateway/974/jars/total-2018.jar:/root/Jts/ibgateway/974/jars/twslaunch-974.jar:/root/Jts/ibgateway/974/jars/twslaunch-install4j-1.9.jar:/opt/IBController/IBController.jar -Xmx768m -XX:+UseG1GC -XX:MaxGCPauseMillis=200 -XX:ParallelGCThreads=20 -XX:ConcGCThreads=5 -XX:InitiatingHeapOccupancyPercent=70 ibcontroller.IBGatewayController /root/IBController/IBController.ini *** *** paper
tws_1  |
tws_1  | System Properties
tws_1  | ------------------------------------------------------------
tws_1  | java.runtime.name = Java(TM) SE Runtime Environment
tws_1  | sun.boot.library.path = /opt/i4j_jres/1.8.0_152/lib/amd64
tws_1  | java.vm.version = 25.152-b16
tws_1  | java.vm.vendor = Oracle Corporation
tws_1  | java.vendor.url = http://java.oracle.com/
tws_1  | path.separator = :
tws_1  | java.vm.name = Java HotSpot(TM) 64-Bit Server VM
tws_1  | file.encoding.pkg = sun.io
tws_1  | user.country = US
tws_1  | sun.java.launcher = SUN_STANDARD
tws_1  | sun.os.patch.level = unknown
tws_1  | java.vm.specification.name = Java Virtual Machine Specification
tws_1  | user.dir = /root/Jts
tws_1  | java.runtime.version = 1.8.0_152-b16
tws_1  | java.awt.graphicsenv = sun.awt.X11GraphicsEnvironment
tws_1  | java.endorsed.dirs = /opt/i4j_jres/1.8.0_152/lib/endorsed
tws_1  | os.arch = amd64
tws_1  | java.io.tmpdir = /tmp
tws_1  | line.separator =
tws_1  |
tws_1  | java.vm.specification.vendor = Oracle Corporation
tws_1  | os.name = Linux
tws_1  | sun.jnu.encoding = ANSI_X3.4-1968
tws_1  | java.library.path = /usr/java/packages/lib/amd64:/usr/lib64:/lib64:/lib:/usr/lib
tws_1  | java.specification.name = Java Platform API Specification
tws_1  | java.class.version = 52.0
tws_1  | sun.management.compiler = HotSpot 64-Bit Tiered Compilers
tws_1  | os.version = 4.15.0-48-generic
tws_1  | user.home = /root
tws_1  | user.timezone = America/Chicago
tws_1  | java.awt.printerjob = sun.print.PSPrinterJob
tws_1  | file.encoding = ANSI_X3.4-1968
tws_1  | java.specification.version = 1.8
tws_1  | java.class.path = /root/Jts/ibgateway/974/jars/jts4launch-974.jar:/root/Jts/ibgateway/974/jars/locales.jar:/root/Jts/ibgateway/974/jars/log4j-api-2.5.jar:/root/Jts/ibgateway/974/jars/log4j-core-2.5.jar:/root/Jts/ibgateway/974/jars/total-2018.jar:/root/Jts/ibgateway/974/jars/twslaunch-974.jar:/root/Jts/ibgateway/974/jars/twslaunch-install4j-1.9.jar:/opt/IBController/IBController.jar
tws_1  | user.name = root
tws_1  | java.vm.specification.version = 1.8
tws_1  | sun.java.command = ibcontroller.IBGatewayController /root/IBController/IBController.ini fdemo demouser paper
tws_1  | java.home = /opt/i4j_jres/1.8.0_152
tws_1  | sun.arch.data.model = 64
tws_1  | user.language = en
tws_1  | java.specification.vendor = Oracle Corporation
tws_1  | awt.toolkit = sun.awt.X11.XToolkit
tws_1  | java.vm.info = mixed mode
tws_1  | java.version = 1.8.0_152
tws_1  | java.ext.dirs = /opt/i4j_jres/1.8.0_152/lib/ext:/usr/java/packages/lib/ext
tws_1  | sun.boot.class.path = /opt/i4j_jres/1.8.0_152/lib/resources.jar:/opt/i4j_jres/1.8.0_152/lib/rt.jar:/opt/i4j_jres/1.8.0_152/lib/sunrsasign.jar:/opt/i4j_jres/1.8.0_152/lib/jsse.jar:/opt/i4j_jres/1.8.0_152/lib/jce.jar:/opt/i4j_jres/1.8.0_152/lib/charsets.jar:/opt/i4j_jres/1.8.0_152/lib/jfr.jar:/opt/i4j_jres/1.8.0_152/classes
tws_1  | java.vendor = Oracle Corporation
tws_1  | file.separator = /
tws_1  | java.vendor.url.bug = http://bugreport.sun.com/bugreport/
tws_1  | sun.io.unicode.encoding = UnicodeLittle
tws_1  | sun.cpu.endian = little
tws_1  | sun.cpu.isalist =
tws_1  | ------------------------------------------------------------
tws_1  | 23:00:37:155 IBController: using default settings provider: ini file is /root/IBController/IBController.ini
tws_1  | 23:00:37:156 IBController: using default login manager: getting username and password from args
tws_1  | 23:00:37:156 IBController: using default config dialog manager: constructor parameter isGateway=true
tws_1  | 23:00:37:156 IBController: using default trading mode manager: constructor parameter args: tradingMode=paper
tws_1  | 23:00:37:158 IBController: using default config dialog manager
tws_1  | 23:00:37:167 IBController: IBControllerServer is started.
tws_1  | 23:00:37:304 IBController: IBControllerServer listening on address: 5c7438496b9a/172.18.0.2 port: 7462
tws_1  | Exception in thread "main" java.awt.AWTError: Can't connect to X11 window server using ':0' as the value of the DISPLAY variable.
tws_1  |        at sun.awt.X11GraphicsEnvironment.initDisplay(Native Method)
tws_1  |        at sun.awt.X11GraphicsEnvironment.access$200(X11GraphicsEnvironment.java:65)
tws_1  |        at sun.awt.X11GraphicsEnvironment$1.run(X11GraphicsEnvironment.java:115)
tws_1  |        at java.security.AccessController.doPrivileged(Native Method)
tws_1  |        at sun.awt.X11GraphicsEnvironment.<clinit>(X11GraphicsEnvironment.java:74)
tws_1  |        at java.lang.Class.forName0(Native Method)
tws_1  |        at java.lang.Class.forName(Class.java:264)
tws_1  |        at java.awt.GraphicsEnvironment.createGE(GraphicsEnvironment.java:103)
tws_1  |        at java.awt.GraphicsEnvironment.getLocalGraphicsEnvironment(GraphicsEnvironment.java:82)
tws_1  |        at sun.awt.X11.XToolkit.<clinit>(XToolkit.java:126)
tws_1  |        at java.lang.Class.forName0(Native Method)
tws_1  |        at java.lang.Class.forName(Class.java:264)
tws_1  |        at java.awt.Toolkit$2.run(Toolkit.java:860)
tws_1  |        at java.awt.Toolkit$2.run(Toolkit.java:855)
tws_1  |        at java.security.AccessController.doPrivileged(Native Method)
tws_1  |        at java.awt.Toolkit.getDefaultToolkit(Toolkit.java:854)
tws_1  |        at ibcontroller.IBController.createToolkitListener(Unknown Source)
tws_1  |        at ibcontroller.IBController.load(Unknown Source)
tws_1  |        at ibcontroller.IBGatewayController.main(Unknown Source)
tws_1  | Forking :::4001 onto 0.0.0.0:4003\n

Is it normal? What should I do to stop the container and relaunch it?

krumware commented 5 years ago

Its possible your shell is not properly terminating the container, it could be an issue with docker. I'd recommend seeing if the same behavior happens after running docker-compose down prior to re-running, or using docker-compose up --force-recreate the next time you start the containers. I think what you're seeing may be related to a second instance of the container running against a shared volume, but that's speculating. The above commands are a good place to start. Are you able to share your docker-compose files?

Macfly commented 5 years ago

I don't have the same behavior when I run docker-compose down prior to re-running. The docker-compose files are the stock ones, I didn't change anything.

PhilippeFerreiraDeSousa commented 5 years ago

I cloned the repo, docker pulled the image from DockekrHub and added the missing image: mvberg/ib-gateway-docker in docker-compose.yaml. Then I tried to reproduce this issue to check. I don't get any java error but still some errors on the second retry:

[philippe@localhost ib-gateway-docker]$ docker-compose up
Creating network "ib-gateway-docker_default" with the default driver
Creating ib-gateway-docker_tws_1 ... done
Attaching to ib-gateway-docker_tws_1
tws_1  | Starting virtual X frame buffer: Xvfb.
tws_1  | find: '/opt/IBController/Logs': No such file or directory
tws_1  | stored passwd in file: /.vnc/passwd
tws_1  | Starting x11vnc.
tws_1  | 
tws_1  | +==============================================================================
tws_1  | +
tws_1  | + IBController version 3.2.0.5
tws_1  | +
tws_1  | + Running GATEWAY 974
tws_1  | +
tws_1  | + Diagnostic information is logged in:
tws_1  | +
tws_1  | + /opt/IBController/Logs/ibc-3.2.0.5_GATEWAY-974_Sunday.txt
tws_1  | +
tws_1  | +
tws_1  | 
tws_1  | +==============================================================================
tws_1  | +
tws_1  | +                       **** An error has occurred ****
tws_1  | +
tws_1  | +                     Please look in the diagnostics file 
tws_1  | +                   mentioned above for further information
tws_1  | +
tws_1  | +==============================================================================
tws_1  | 
tws_1  | Stopping x11vnc.
tws_1  | Stopping virtual X frame buffer: Xvfb.
^CGracefully stopping... (press Ctrl+C again to force)
Stopping ib-gateway-docker_tws_1 ... done
[philippe@localhost ib-gateway-docker]$ docker-compose up
Starting ib-gateway-docker_tws_1 ... done
Attaching to ib-gateway-docker_tws_1
tws_1  | Starting virtual X frame buffer: Xvfb.
tws_1  | --pw = ***
tws_1  | --fix-user =
tws_1  | --fix-pw =
tws_1  | 
tws_1  | 
tws_1  | =========================== An error has occurred =============================
tws_1  | 
tws_1  | 
tws_1  | 
tws_1  | Error: IBController configuration file: /root/IBController/IBController.ini  does not exist
tws_1  | mkdir: cannot create directory '/.vnc': File exists
tws_1  | stored passwd in file: /.vnc/passwd
tws_1  | Starting x11vnc.
tws_1  | 
tws_1  | +==============================================================================
tws_1  | +
tws_1  | + IBController version 3.2.0.5
tws_1  | +
tws_1  | + Running GATEWAY 974
tws_1  | +
tws_1  | + Diagnostic information is logged in:
tws_1  | +
tws_1  | + /opt/IBController/Logs/ibc-3.2.0.5_GATEWAY-974_Sunday.txt
tws_1  | +
tws_1  | +
tws_1  | 
tws_1  | +==============================================================================
tws_1  | +
tws_1  | +                       **** An error has occurred ****
tws_1  | +
tws_1  | +                     Please look in the diagnostics file 
tws_1  | +                   mentioned above for further information
tws_1  | +
tws_1  | +==============================================================================
tws_1  | 
tws_1  | Stopping x11vnc.
tws_1  | Stopping virtual X frame buffer: Xvfb.
tws_1  | 
tws_1  | ================================================================================
tws_1  | 
tws_1  | Starting IBController version 3.2.0.5 on 2019-06-02 at 21:26:52
tws_1  | 
tws_1  | Operating system: Linux 3d4a293c715d 4.18.16-300.fc29.x86_64 #1 SMP Sat Oct 20 23:24:08 UTC 2018 x86_64 x86_64 x86_64 GNU/Linux
tws_1  | 
tws_1  | Arguments:
tws_1  | 
tws_1  | TWS version = 974
tws_1  | Entry point = ibcontroller.IBGatewayController
tws_1  | --tws-path = /root/Jts
tws_1  | --tws-settings-path = /root/Jts
tws_1  | --ibc-path = /opt/IBController
tws_1  | --ibc-ini = /root/IBController/IBController.ini
tws_1  | --mode = paper
tws_1  | --java-path = /opt/i4j_jres/1.8.0_152/bin
tws_1  | --user = ***
tws_1  | --pw = ***
tws_1  | --fix-user =
tws_1  | --fix-pw =
tws_1  | 
tws_1  | 
tws_1  | =========================== An error has occurred =============================
tws_1  | 
tws_1  | 
tws_1  | 
tws_1  | Error: IBController configuration file: /root/IBController/IBController.ini  does not exist
tws_1  | Forking :::4001 onto 0.0.0.0:4003\n
PhilippeFerreiraDeSousa commented 5 years ago

Ok so my issue is totally unrelated to Macfly's one

root@ece7f89a7a8f:/# ls -la /root/IBController                  
ls: cannot access '/root/IBController/IBController.ini': Permission denied
total 16
drwxr-xr-x. 1 root root 4096 May 21 13:04 .
drwx------. 1 root root 4096 Jun  2 22:11 ..
-?????????? ? ?    ?       ?            ? IBController.ini
drwxr-xr-x. 2 root root 4096 May 21 12:03 Logs
sjconst2 commented 4 years ago

I was having the same issue, and @krumware 's suggestion of docker-compose down worked for me.

ignacioaranguren1 commented 1 year ago

Any update on this @Macfly? Did you manage to solve the issue?