heshiming / ibga

IB Gateway in a headless docker container.
GNU General Public License v3.0
24 stars 3 forks source link

Fail to connect to port 4000 of ibga docker #12

Open forhonourlx opened 3 months ago

forhonourlx commented 3 months ago

Hi,

After build ibga container, I cannot connect to port:4000. And vnc shows no API connection on IB Gateway and Timeout Error of ib_insync. Is there anything wrong? Could somebody help? Thanks inadvance.

2024-08-03 02:29:44  Manager Startup / Fri Aug  2 14:29:44 EDT 2024
2024-08-03 02:29:44 ------------------------------------------------
2024-08-03 02:29:44 • starting xvfb (/usr/bin/Xvfb :0 -ac -screen 0 1024x768x16 +extension RANDR) ...
2024-08-03 02:29:44   pid: 63
2024-08-03 02:29:45   display :0 is ready
2024-08-03 02:29:45 • starting x11vnc (/usr/bin/x11vnc -forever -rfbport 5900 -o /var/log/x11vnc.log -display :0) ...
2024-08-03 02:29:45   pid: 160
2024-08-03 02:29:45 • starting novnc (/opt/noVNC-1.3.0/utils/novnc_proxy --listen 5800 --vnc localhost:5900) ...
2024-08-03 02:29:45   pid: 175
2024-08-03 02:29:45 • starting socat (/usr/bin/socat TCP-LISTEN:4000,fork,reuseaddr TCP:localhost:9000,forever,shut-down) ...
2024-08-03 02:29:45   pid: 187
2024-08-03 02:29:45 • found IBG at /home/ibg/Jts/ibgateway/ibgateway.
2024-08-03 02:29:45 ---------------------------------------------------
2024-08-03 02:29:45  IB Gateway Startup / Fri Aug  2 14:29:45 EDT 2024
2024-08-03 02:29:45 ---------------------------------------------------
2024-08-03 02:29:45 • time: Fri Aug  2 14:29:45 EDT 2024
2024-08-03 02:29:45 • starting IB Gateway ...
2024-08-03 02:29:45   pid: 216
2024-08-03 02:29:45 • waiting for jauto availability ...
2024-08-03 02:29:52   jauto is ready
2024-08-03 02:29:52 • waiting for main window ...
2024-08-03 02:29:53   found: IBKR Gateway at 117,79
2024-08-03 02:29:53 • filling in login form ...
2024-08-03 02:29:56   - skipping combobox Region since persisted state (/home/ibg_settings/skip_login_combobox_Region) indicates it already matches China
2024-08-03 02:29:56   - skipping combobox Time Zone since persisted state (/home/ibg_settings/skip_login_combobox_Time Zone) indicates it already matches America/New York
2024-08-03 02:29:56 • logging in ...
2024-08-03 02:29:57 • entered maintenance cycle
2024-08-03 02:29:58   - welcome: 16% Build 10.30.1j Authenticating... Logging in xxx
2024-08-03 02:29:59 !!! IB Gateway is waiting for two-factor authentication !!!
2024-08-03 02:30:03   - welcome: 28% Build 10.30.1j Authenticating... Logging in xxx
2024-08-03 02:30:04 !!! IB Gateway is waiting for two-factor authentication !!!
2024-08-03 02:30:08 !!! IB Gateway is waiting for two-factor authentication !!!
2024-08-03 02:30:13 !!! IB Gateway is waiting for two-factor authentication !!!
2024-08-03 02:30:18 !!! IB Gateway is waiting for two-factor authentication !!!
2024-08-03 02:30:22 !!! IB Gateway is waiting for two-factor authentication !!!
2024-08-03 02:30:27 !!! IB Gateway is waiting for two-factor authentication !!!
2024-08-03 02:30:31 !!! IB Gateway is waiting for two-factor authentication !!!
2024-08-03 02:30:35   - welcome: 54% Build 10.30.1j Requesting startup parameters... Logging in xxx
2024-08-03 02:30:36 LogModuleConfigurator-Init: Log4j Ver2.x found on classpath
2024-08-03 02:30:36 LogModuleConfigurator-Init: LogModuleConfigurator initialized with Log4j Verd.x
2024-08-03 02:30:40   - option check skipped, to perform again remove /home/ibg_settings/skip_option_check2
2024-08-03 01:45:40 java.lang.InterruptedException
2024-08-03 01:45:40     at java.util.concurrent.locks.AbstractQueuedSynchronizer.doAcquireSharedInterruptibly(AbstractQueuedSynchronizer.java:998)
2024-08-03 01:45:40     at java.util.concurrent.locks.AbstractQueuedSynchronizer.acquireSharedInterruptibly(AbstractQueuedSynchronizer.java:1304)
2024-08-03 01:45:40     at java.util.concurrent.CountDownLatch.await(CountDownLatch.java:231)
2024-08-03 01:45:40     at com.sun.javafx.application.PlatformImpl.waitForStart(PlatformImpl.java:256)
2024-08-03 01:45:40     at com.sun.javafx.application.PlatformImpl.runLater(PlatformImpl.java:277)
2024-08-03 01:45:40     at com.sun.javafx.application.PlatformImpl.runLater(PlatformImpl.java:268)
2024-08-03 01:45:40     at com.sun.javafx.application.PlatformImpl.checkIdle(PlatformImpl.java:392)
2024-08-03 01:45:40     at com.sun.javafx.application.PlatformImpl.setImplicitExit(PlatformImpl.java:346)
2024-08-03 01:45:40     at javafx.application.Platform.setImplicitExit(Platform.java:138)
2024-08-03 01:45:40     at twslaunch.gstat.j.a(j.java:88)
2024-08-03 01:45:40     at twslaunch.gstat.a.d(a.java:215)
2024-08-03 01:45:40     at twslaunch.gstat.a.g(a.java:117)
2024-08-03 01:45:40     at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
2024-08-03 01:45:40     at java.util.concurrent.FutureTask.runAndReset(FutureTask.java:308)
2024-08-03 01:45:40     at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$301(ScheduledThreadPoolExecutor.java:180)
2024-08-03 01:45:40     at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:294)
2024-08-03 01:45:40     at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
2024-08-03 01:45:40     at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
2024-08-03 01:45:40     at java.lang.Thread.run(Thread.java:748)
2024-08-03 01:48:54 java.lang.InterruptedException
2024-08-03 01:48:54     at java.util.concurrent.locks.AbstractQueuedSynchronizer.doAcquireSharedInterruptibly(AbstractQueuedSynchronizer.java:998)
2024-08-03 01:48:54     at java.util.concurrent.locks.AbstractQueuedSynchronizer.acquireSharedInterruptibly(AbstractQueuedSynchronizer.java:1304)
2024-08-03 01:48:54     at java.util.concurrent.CountDownLatch.await(CountDownLatch.java:231)
2024-08-03 01:48:54     at com.sun.javafx.application.PlatformImpl.waitForStart(PlatformImpl.java:256)
2024-08-03 01:48:54     at com.sun.javafx.application.PlatformImpl.runLater(PlatformImpl.java:277)
2024-08-03 01:48:54     at com.sun.javafx.application.PlatformImpl.runLater(PlatformImpl.java:268)
2024-08-03 01:48:54     at com.sun.javafx.application.PlatformImpl.checkIdle(PlatformImpl.java:392)
2024-08-03 01:48:54     at com.sun.javafx.application.PlatformImpl.setImplicitExit(PlatformImpl.java:346)
2024-08-03 01:48:54     at javafx.application.Platform.setImplicitExit(Platform.java:138)
2024-08-03 01:48:54     at twslaunch.gstat.j.a(j.java:88)
2024-08-03 01:48:54     at twslaunch.gstat.a.d(a.java:215)
2024-08-03 01:48:54     at twslaunch.gstat.a.g(a.java:117)
2024-08-03 01:48:54     at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
2024-08-03 01:48:54     at java.util.concurrent.FutureTask.runAndReset(FutureTask.java:308)
2024-08-03 01:48:54     at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$301(ScheduledThreadPoolExecutor.java:180)
2024-08-03 01:48:54     at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:294)
2024-08-03 01:48:54     at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
2024-08-03 01:48:54     at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
2024-08-03 01:48:54     at java.lang.Thread.run(Thread.java:748)
2024-08-03 01:51:49 java.util.concurrent.CompletionException: java.lang.UnsatisfiedLinkError: /tmp/JxBrowser/7.29/libtoolkit.so: libgobject-2.0.so.0: cannot open shared object file: No such file or directory
2024-08-03 01:51:49     at java.util.concurrent.CompletableFuture.encodeThrowable(CompletableFuture.java:273)
2024-08-03 01:51:49     at java.util.concurrent.CompletableFuture.completeThrowable(CompletableFuture.java:280)
2024-08-03 01:51:49     at java.util.concurrent.CompletableFuture$AsyncSupply.run(CompletableFuture.java:1592)
2024-08-03 01:51:49     at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
2024-08-03 01:51:49     at java.util.concurrent.FutureTask.run(FutureTask.java:266)
2024-08-03 01:51:49     at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$201(ScheduledThreadPoolExecutor.java:180)
2024-08-03 01:51:49     at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:293)
2024-08-03 01:51:49     at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
2024-08-03 01:51:49     at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
2024-08-03 01:51:49     at java.lang.Thread.run(Thread.java:748)
2024-08-03 01:51:49 Caused by: java.lang.UnsatisfiedLinkError: /tmp/JxBrowser/7.29/libtoolkit.so: libgobject-2.0.so.0: cannot open shared object file: No such file or directory
2024-08-03 01:51:49     at java.lang.ClassLoader$NativeLibrary.load(Native Method)
2024-08-03 01:51:49     at java.lang.ClassLoader.loadLibrary0(ClassLoader.java:1941)
2024-08-03 01:51:49     at java.lang.ClassLoader.loadLibrary(ClassLoader.java:1824)
2024-08-03 01:51:49     at java.lang.Runtime.load0(Runtime.java:809)
2024-08-03 01:51:49     at java.lang.System.load(System.java:1086)
2024-08-03 01:51:49     at com.teamdev.jxbrowser.internal.JniLibrary.loadLibrary(JniLibrary.java:53)
2024-08-03 01:51:49     at com.teamdev.jxbrowser.internal.JniLibrary.lambda$new$0(JniLibrary.java:47)
2024-08-03 01:51:49     at java.security.AccessController.doPrivileged(Native Method)
2024-08-03 01:51:49     at com.teamdev.jxbrowser.internal.JniLibrary.<init>(JniLibrary.java:45)
2024-08-03 01:51:49     at com.teamdev.jxbrowser.internal.ToolkitLibrary.<init>(ToolkitLibrary.java:37)
2024-08-03 01:51:49     at com.teamdev.jxbrowser.internal.ToolkitLibrary.instance(ToolkitLibrary.java:27)
2024-08-03 01:51:49     at com.teamdev.jxbrowser.internal.xz.JniResourceExtractor.extract(JniResourceExtractor.java:47)
2024-08-03 01:51:49     at com.teamdev.jxbrowser.internal.xz.XzExtractor.extract(XzExtractor.java:51)
2024-08-03 01:51:49     at com.teamdev.jxbrowser.internal.ChromiumExtractor.lambda$extract$0(ChromiumExtractor.java:38)
2024-08-03 01:51:49     at java.security.AccessController.doPrivileged(Native Method)
2024-08-03 01:51:49     at com.teamdev.jxbrowser.internal.ChromiumExtractor.extract(ChromiumExtractor.java:35)
2024-08-03 01:51:49     at com.teamdev.jxbrowser.engine.internal.EngineImpl.extractChromiumBinariesIfNecessary(EngineImpl.java:427)
2024-08-03 01:51:49     at com.teamdev.jxbrowser.engine.internal.EngineImpl.newInstance(EngineImpl.java:149)
2024-08-03 01:51:49     at com.teamdev.jxbrowser.engine.Engine.newInstance(Engine.java:163)
2024-08-03 01:51:49     at feature.webapp.A.b(A.java:822)
2024-08-03 01:51:49     at feature.webapp.A.a(A.java:723)
2024-08-03 01:51:49     at feature.webapp.A.c(A.java:686)
2024-08-03 01:51:49     at java.util.concurrent.CompletableFuture$AsyncSupply.run(CompletableFuture.java:1590)
2024-08-03 01:51:49     ... 7 more
2024-08-03 02:14:46 chown: cannot access '/home/ibg_settings/exported_logs': No such file or directory
2024-08-03 02:14:57 /sbin/start-stop-daemon: warning: failed to kill 63: No such process
2024-08-03 02:15:10 java.lang.InterruptedException
2024-08-03 02:15:10     at java.util.concurrent.locks.AbstractQueuedSynchronizer.doAcquireSharedInterruptibly(AbstractQueuedSynchronizer.java:998)
2024-08-03 02:15:10     at java.util.concurrent.locks.AbstractQueuedSynchronizer.acquireSharedInterruptibly(AbstractQueuedSynchronizer.java:1304)
2024-08-03 02:15:10     at java.util.concurrent.CountDownLatch.await(CountDownLatch.java:231)
2024-08-03 02:15:10     at com.sun.javafx.application.PlatformImpl.waitForStart(PlatformImpl.java:256)
2024-08-03 02:15:10     at com.sun.javafx.application.PlatformImpl.runLater(PlatformImpl.java:277)
2024-08-03 02:15:10     at com.sun.javafx.application.PlatformImpl.runLater(PlatformImpl.java:268)
2024-08-03 02:15:10     at com.sun.javafx.application.PlatformImpl.checkIdle(PlatformImpl.java:392)
2024-08-03 02:15:10     at com.sun.javafx.application.PlatformImpl.setImplicitExit(PlatformImpl.java:346)
2024-08-03 02:15:10     at javafx.application.Platform.setImplicitExit(Platform.java:138)
2024-08-03 02:15:10     at twslaunch.gstat.j.a(j.java:88)
2024-08-03 02:15:10     at twslaunch.gstat.a.d(a.java:215)
2024-08-03 02:15:10     at twslaunch.gstat.a.g(a.java:117)
2024-08-03 02:15:10     at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
2024-08-03 02:15:10     at java.util.concurrent.FutureTask.runAndReset(FutureTask.java:308)
2024-08-03 02:15:10     at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$301(ScheduledThreadPoolExecutor.java:180)
2024-08-03 02:15:10     at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:294)
2024-08-03 02:15:10     at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
2024-08-03 02:15:10     at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
2024-08-03 02:15:10     at java.lang.Thread.run(Thread.java:748)
2024-08-03 02:29:44 chown: cannot access '/home/ibg_settings/exported_logs': No such file or directory
2024-08-03 02:29:57 java.lang.InterruptedException
2024-08-03 02:29:57     at java.util.concurrent.locks.AbstractQueuedSynchronizer.doAcquireSharedInterruptibly(AbstractQueuedSynchronizer.java:998)
2024-08-03 02:29:57     at java.util.concurrent.locks.AbstractQueuedSynchronizer.acquireSharedInterruptibly(AbstractQueuedSynchronizer.java:1304)
2024-08-03 02:29:57     at java.util.concurrent.CountDownLatch.await(CountDownLatch.java:231)
2024-08-03 02:29:57     at com.sun.javafx.application.PlatformImpl.waitForStart(PlatformImpl.java:256)
2024-08-03 02:29:57     at com.sun.javafx.application.PlatformImpl.runLater(PlatformImpl.java:277)
2024-08-03 02:29:57     at com.sun.javafx.application.PlatformImpl.runLater(PlatformImpl.java:268)
2024-08-03 02:29:57     at com.sun.javafx.application.PlatformImpl.checkIdle(PlatformImpl.java:392)
2024-08-03 02:29:57     at com.sun.javafx.application.PlatformImpl.setImplicitExit(PlatformImpl.java:346)
2024-08-03 02:29:57     at javafx.application.Platform.setImplicitExit(Platform.java:138)
2024-08-03 02:29:57     at twslaunch.gstat.j.a(j.java:88)
2024-08-03 02:29:57     at twslaunch.gstat.a.d(a.java:215)
2024-08-03 02:29:57     at twslaunch.gstat.a.g(a.java:117)
2024-08-03 02:29:57     at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
2024-08-03 02:29:57     at java.util.concurrent.FutureTask.runAndReset(FutureTask.java:308)
2024-08-03 02:29:57     at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$301(ScheduledThreadPoolExecutor.java:180)
2024-08-03 02:29:57     at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:294)
2024-08-03 02:29:57     at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
2024-08-03 02:29:57     at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
2024-08-03 02:29:57     at java.lang.Thread.run(Thread.java:748)
2024-08-03 02:30:41 java.util.concurrent.CompletionException: java.lang.UnsatisfiedLinkError: /tmp/JxBrowser/7.29/libtoolkit.so: libgobject-2.0.so.0: cannot open shared object file: No such file or directory
2024-08-03 02:30:41     at java.util.concurrent.CompletableFuture.encodeThrowable(CompletableFuture.java:273)
2024-08-03 02:30:41     at java.util.concurrent.CompletableFuture.completeThrowable(CompletableFuture.java:280)
2024-08-03 02:30:41     at java.util.concurrent.CompletableFuture$AsyncSupply.run(CompletableFuture.java:1592)
2024-08-03 02:30:41     at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
2024-08-03 02:30:41     at java.util.concurrent.FutureTask.run(FutureTask.java:266)
2024-08-03 02:30:41     at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$201(ScheduledThreadPoolExecutor.java:180)
2024-08-03 02:30:41     at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:293)
2024-08-03 02:30:41     at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
2024-08-03 02:30:41     at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
2024-08-03 02:30:41     at java.lang.Thread.run(Thread.java:748)
2024-08-03 02:30:41 Caused by: java.lang.UnsatisfiedLinkError: /tmp/JxBrowser/7.29/libtoolkit.so: libgobject-2.0.so.0: cannot open shared object file: No such file or directory
2024-08-03 02:30:41     at java.lang.ClassLoader$NativeLibrary.load(Native Method)
2024-08-03 02:30:41     at java.lang.ClassLoader.loadLibrary0(ClassLoader.java:1941)
2024-08-03 02:30:41     at java.lang.ClassLoader.loadLibrary(ClassLoader.java:1824)
2024-08-03 02:30:41     at java.lang.Runtime.load0(Runtime.java:809)
2024-08-03 02:30:41     at java.lang.System.load(System.java:1086)
2024-08-03 02:30:41     at com.teamdev.jxbrowser.internal.JniLibrary.loadLibrary(JniLibrary.java:53)
2024-08-03 02:30:41     at com.teamdev.jxbrowser.internal.JniLibrary.lambda$new$0(JniLibrary.java:47)
2024-08-03 02:30:41     at java.security.AccessController.doPrivileged(Native Method)
2024-08-03 02:30:41     at com.teamdev.jxbrowser.internal.JniLibrary.<init>(JniLibrary.java:45)
2024-08-03 02:30:41     at com.teamdev.jxbrowser.internal.ToolkitLibrary.<init>(ToolkitLibrary.java:37)
2024-08-03 02:30:41     at com.teamdev.jxbrowser.internal.ToolkitLibrary.instance(ToolkitLibrary.java:27)
2024-08-03 02:30:41     at com.teamdev.jxbrowser.internal.xz.JniResourceExtractor.extract(JniResourceExtractor.java:47)
2024-08-03 02:30:41     at com.teamdev.jxbrowser.internal.xz.XzExtractor.extract(XzExtractor.java:51)
2024-08-03 02:30:41     at com.teamdev.jxbrowser.internal.ChromiumExtractor.lambda$extract$0(ChromiumExtractor.java:38)
2024-08-03 02:30:41     at java.security.AccessController.doPrivileged(Native Method)
2024-08-03 02:30:41     at com.teamdev.jxbrowser.internal.ChromiumExtractor.extract(ChromiumExtractor.java:35)
2024-08-03 02:30:41     at com.teamdev.jxbrowser.engine.internal.EngineImpl.extractChromiumBinariesIfNecessary(EngineImpl.java:427)
2024-08-03 02:30:41     at com.teamdev.jxbrowser.engine.internal.EngineImpl.newInstance(EngineImpl.java:149)
2024-08-03 02:30:41     at com.teamdev.jxbrowser.engine.Engine.newInstance(Engine.java:163)
2024-08-03 02:30:41     at feature.webapp.A.b(A.java:822)
2024-08-03 02:30:41     at feature.webapp.A.a(A.java:723)
2024-08-03 02:30:41     at feature.webapp.A.c(A.java:686)
2024-08-03 02:30:41     at java.util.concurrent.CompletableFuture$AsyncSupply.run(CompletableFuture.java:1590)
2024-08-03 02:30:41     ... 7 more
API connection failed: TimeoutError()
Traceback (most recent call last):
  File "C:\miniconda3\lib\asyncio\tasks.py", line 234, in __step
    result = coro.throw(exc)
  File "C:\miniconda3\lib\asyncio\tasks.py", line 650, in _wrap_awaitable
    return (yield from awaitable.__await__())
  File "C:\miniconda3\lib\asyncio\futures.py", line 285, in __await__
    yield self  # This tells Task to wait for completion.
  File "C:\miniconda3\lib\asyncio\tasks.py", line 304, in __wakeup
    future.result()
  File "C:\miniconda3\lib\asyncio\futures.py", line 196, in result
    raise exc
asyncio.exceptions.CancelledError

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "C:\miniconda3\lib\asyncio\tasks.py", line 456, in wait_for
    return fut.result()
  File "C:\miniconda3\lib\asyncio\futures.py", line 196, in result
    raise exc
asyncio.exceptions.CancelledError

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "c:\Users\Administrator\Desktop\IB\IBGA\backtrader_ib_insync-main\examples\ibdemo.py", line 125, in <module>
    run()
  File "c:\Users\Administrator\Desktop\IB\IBGA\backtrader_ib_insync-main\examples\ibdemo.py", line 94, in run
    ibstore = ibnew.IBStore(**storekwargs)
  File "c:\users\administrator\desktop\ib\ibga\backtrader_ib_insync-main\backtrader_ib_insync\ibstore.py", line 104, in __call__
    super(MetaSingleton, cls).__call__(*args, **kwargs))
  File "C:\Users\Administrator\AppData\Roaming\Python\Python310\site-packages\backtrader\metabase.py", line 88, in __call__
    _obj, args, kwargs = cls.doinit(_obj, *args, **kwargs)
  File "C:\Users\Administrator\AppData\Roaming\Python\Python310\site-packages\backtrader\metabase.py", line 78, in doinit
    _obj.__init__(*args, **kwargs)
  File "c:\users\administrator\desktop\ib\ibga\backtrader_ib_insync-main\backtrader_ib_insync\ibstore.py", line 268, in __init__
    self.ib.connect(
  File "C:\Users\Administrator\AppData\Roaming\Python\Python310\site-packages\ib_insync\ib.py", line 279, in connect
    return self._run(self.connectAsync(
  File "C:\Users\Administrator\AppData\Roaming\Python\Python310\site-packages\ib_insync\ib.py", line 318, in _run
    return util.run(*awaitables, timeout=self.RequestTimeout)
  File "C:\Users\Administrator\AppData\Roaming\Python\Python310\site-packages\ib_insync\util.py", line 341, in run
    result = loop.run_until_complete(task)
  File "C:\miniconda3\lib\site-packages\nest_asyncio.py", line 90, in run_until_complete
    return f.result()
  File "C:\miniconda3\lib\asyncio\futures.py", line 201, in result
    raise self._exception.with_traceback(self._exception_tb)
  File "C:\miniconda3\lib\asyncio\tasks.py", line 232, in __step
    result = coro.send(None)
  File "C:\Users\Administrator\AppData\Roaming\Python\Python310\site-packages\ib_insync\ib.py", line 1748, in connectAsync
    await self.client.connectAsync(host, port, clientId, timeout)
  File "C:\Users\Administrator\AppData\Roaming\Python\Python310\site-packages\ib_insync\client.py", line 217, in connectAsync
    await asyncio.wait_for(self.apiStart, timeout)
  File "C:\miniconda3\lib\asyncio\tasks.py", line 458, in wait_for
    raise exceptions.TimeoutError() from exc
asyncio.exceptions.TimeoutError
heshiming commented 3 months ago

Can you provide your docker-compose.yml file (remove sensitive info such as passwords)?

You can try to verify the port mapping setting in docker-compose against the IB Gateway API port setting (via VNC), to see if they match. If not, you can remove the program file dir and let it try again. If the issue persists, please report back, I'll see if I can reproduce it.

forhonourlx commented 3 months ago

Thank you, Mr He. image image image When I try to connect to port 4000, still no api respond... And my config is docker-compose.yml:

version: '2'
services:
  my-ibga:
    image: heshiming/ibga
    restart: unless-stopped
    environment:
      - TERM=xterm
      - IB_USERNAME=xxx
      - IB_PASSWORD=xxx
      - IB_REGION=China
      - IB_TIMEZONE=America/New York
      - IB_LOGINTAB=IB API
      - IB_LOGINTYPE=Live Trading
      - IB_APILOG=data
      - IB_LOGLEVEL=Error
      - IB_LOGOFF=4:30 AM
    volumes:
      - ./run/program:/home/ibg
      - ./run/settings:/home/ibg_settings
    ports:
      - "15800:5800"
      - "4000:4000"

Can you provide your docker-compose.yml file (remove sensitive info such as passwords)?

You can try to verify the port mapping setting in docker-compose against the IB Gateway API port setting (via VNC), to see if they match. If not, you can remove the program file dir and let it try again. If the issue persists, please report back, I'll see if I can reproduce it.

heshiming commented 3 months ago

Ok I can reproduce it. Let me fix it.

forhonourlx commented 3 months ago

That's very helpful! Thank you indeed!

heshiming commented 3 months ago

It should be fixed now. It had actually been fixed a while ago, but for some reason the official docker image did not contain the change.

forhonourlx commented 3 months ago

Rebuilt and get API connection failed: TimeoutError() at this moment. How should I do to get the latest update?

heshiming commented 3 months ago

If you are using the official docker hub image, just issue docker pull heshiming/ibga to update the image. Be aware at the moment IBKR servers are off due to hours long Friday/Saturday maintenance.

As far as I know, it is only reproducible with an older docker image of heshiming/ibga on docker hub. But if you built your own version, I'm not sure why it didn't work in the first place.

If you are interested in debugging, you can observe the log of the docker container. Since your screenshot shows that the script didn't change anything in the settings screen (i.e. Read-only API is still checked, and port is not 9000), the script might be stuck at:

- option check, clicking menu Configure/Settings ...

If this step is successful, it then goes on to

  - option check, clicking tree item Configuration/Lock and Exit ...
  - option check, changing logoff time from 11:45 to 05:25 ...
  - option check, clicking Auto restart ...
  - option check, double clicking tree item Configuration/API ...
  - option check, clicking tree item Configuration/API/Settings ...

The corresponding line is https://github.com/heshiming/ibga/blob/caec7a5e61d75ba0c97f407fd4f57ce6f6c214f9/scripts/_run_ibg.sh#L240 , where it searches for the menu item and click it.

I've previously noticed that the IBG window title is different for different account types. For example, Advisor Master accounts and institutional accounts have "IB Gateway", while individual accounts may have "IBKR Gateway" as window title.

So if you can confirm that the script stuck at this "menu click Config/Settings" step, you can further help me analyze it. Go into the container docker exec -ti container-name bash. At command prompt, type:

$ echo "/tmp/test.txt|list_menu" > /tmp/ibg-jauto.in
$ cat /tmp/test.txt

This will show your window title together with the menu positions. With this information, I might have a clue why it's stuck.

forhonourlx commented 3 months ago

If I build with docker-compose up -d, it does not conduct '- option check' (like off Read-only API, and later) Whatsmore, I notice that there comes a notification in the front( it could be closed by right-click), does it prevent the coming option-check scripts? image

If I build with docker build --progress plain --rm -f ./dockerfile -t ibga ./ , auto inputs off username and password does not work correctly? So, where should I define username and password?

Here's the debug info:

PS C:\Users\Administrator> docker exec -ti ibga_my-ibga_1 bash
ibg@0dacffbda358:~$ echo "/tmp/test.txt|list_menu" > /tmp/ibg-jauto.in
ibg@0dacffbda358:~$ cat /tmp/test.txt
javax.swing.JFrame,ibgateway.aB,window:0,x:162,y:109,w:700,h:550,act:1,title:IBKR Gateway
File,x:0,y:0,w:27,h:21,mx:383,my:121,pop:n
File/Gateway Logs,x:0,y:0,w:27,h:21,mx:13,my:10
File/API Logs,x:0,y:0,w:27,h:21,mx:13,my:10
File/Gateway Layout/Settings,x:0,y:0,w:27,h:21,mx:13,my:10
File/Close,x:0,y:0,w:27,h:21,mx:13,my:10
Configure,x:32,y:0,w:63,h:21,mx:433,my:121,pop:n
Configure/Settings,x:32,y:0,w:63,h:21,mx:31,my:10
Configure/Automatic Encryption,x:32,y:0,w:63,h:21,mx:31,my:10,selected:1
Help,x:100,y:0,w:33,h:21,mx:486,my:121,pop:n
Help/About Gateway,x:100,y:0,w:33,h:21,mx:16,my:10
Help/Redundant Backup Status,x:100,y:0,w:33,h:21,mx:16,my:10

If you are using the official docker hub image, just issue to update the image. Be aware at the moment IBKR servers are off due to hours long Friday/Saturday maintenance.docker pull heshiming/ibga

As far as I know, it is only reproducible with an older docker image of on docker hub. But if you built your own version, I'm not sure why it didn't work in the first place.heshiming/ibga

If you are interested in debugging, you can observe the log of the docker container. Since your screenshot shows that the script didn't change anything in the settings screen (i.e. Read-only API is still checked, and port is not 9000), the script might be stuck at:

- option check, clicking menu Configure/Settings ...

If this step is successful, it then goes on to

  - option check, clicking tree item Configuration/Lock and Exit ...
  - option check, changing logoff time from 11:45 to 05:25 ...
  - option check, clicking Auto restart ...
  - option check, double clicking tree item Configuration/API ...
  - option check, clicking tree item Configuration/API/Settings ...

The corresponding line is

https://github.com/heshiming/ibga/blob/caec7a5e61d75ba0c97f407fd4f57ce6f6c214f9/scripts/_run_ibg.sh#L240

, where it searches for the menu item and click it. I've previously noticed that the IBG window title is different for different account types. For example, Advisor Master accounts and institutional accounts have "IB Gateway", while individual accounts may have "IBKR Gateway" as window title.

So if you can confirm that the script stuck at this "menu click Config/Settings" step, you can further help me analyze it. Go into the container . At command prompt, type:docker exec -ti container-name bash

$ echo "/tmp/test.txt|list_menu" > /tmp/ibg-jauto.in
$ cat /tmp/test.txt

This will show your window title together with the menu positions. With this information, I might have a clue why it's stuck.

heshiming commented 3 months ago

The debug info appears to be ok.

However, the "Login Messages" window is a problem. The mechanism simulates mouse clicks, which won't work if a window is blocking the menu. I've never seen this. Is there any setup in your account that I can replicate? If you are using TWS or IBG on your desktop for example, what's the content in this message, any way for me to turn it on?

forhonourlx commented 3 months ago

The "Login Messages" window is quite odd, with no contents on this window. If I directly login on windows ver IB Gateway 10.19 stable, no "Login Messages" window would show. image Do you have any opinion about why "API Server" is not activated on ibga ib gateway UI?

The debug info appears to be ok.

However, the "Login Messages" window is a problem. The mechanism simulates mouse clicks, which won't work if a window is blocking the menu. I've never seen this. Is there any setup in your account that I can replicate? If you are using TWS or IBG on your desktop for example, what's the content in this message, any way for me to turn it on?

heshiming commented 3 months ago

Their servers are offline for extended maintenance period from Friday night to Saturday US ET. Try again later.

forhonourlx commented 3 months ago

I will further report after the maintenance time. Thank you for your help!

forhonourlx commented 3 months ago

Hi Mr. He. Same account do not have "Login Messages" on windows ver IB Gateway 10.19 stable... 1722858279239

Their servers are offline for extended maintenance period from Friday night to Saturday US ET. Try again later.

heshiming commented 3 months ago

Can you try the latest though? The current implementation only downloads the latest version, which is 10.30.1j now. Perhaps if you try the latest version you'll see that message box.

forhonourlx commented 3 months ago

Emmmm.... For IB reasons and bugs, I cannot finish these tasks windows, it would show again and again. 1722861171715 Could you add some code to close optional "Login Messages" window? Or can you upload a "stable" tag of ibga docker, that would be very useful? Many Thanks!

heshiming commented 3 months ago

I can only close it if I can reproduce the window. Right now none of my accounts have this. So you might as well try to login at web portal, I'm sure you'll see the same tasks to finish.

forhonourlx commented 3 months ago

After I finish form on web portal, "Login Messages" window no longer shows. And I notice that TCP:localhost:9000 should be filled in Socket Port. Finally it works! Thank you for your help! Thanks! image

2024-08-06 12:30:51 ------------------------------------------------
2024-08-06 12:30:51  Manager Startup / Tue Aug  6 00:30:51 EDT 2024
2024-08-06 12:30:51 ------------------------------------------------
2024-08-06 12:30:51 • starting xvfb (/usr/bin/Xvfb :0 -ac -screen 0 1024x768x16 +extension RANDR) ...
2024-08-06 12:30:51   pid: 209
2024-08-06 12:30:56     still waiting for display :0 to be ready ...
2024-08-06 12:31:02     display timed out, will try again ...
2024-08-06 12:31:02   stopping xvfb ...
2024-08-06 12:31:02 1 pids were not killed
2024-08-06 12:31:02 No process in pidfile '/var/run/xvfb.pid' found running; none killed.
2024-08-06 12:31:02 • starting xvfb (/usr/bin/Xvfb :0 -ac -screen 0 1024x768x16 +extension RANDR) ...
2024-08-06 12:31:02   pid: 273
2024-08-06 12:31:02   display :0 is ready
2024-08-06 12:31:03 • starting x11vnc (/usr/bin/x11vnc -forever -rfbport 5900 -o /var/log/x11vnc.log -display :0) ...
2024-08-06 12:31:03   pid: 295
2024-08-06 12:31:03 • starting novnc (/opt/noVNC-1.3.0/utils/novnc_proxy --listen 5800 --vnc localhost:5900) ...
2024-08-06 12:31:03   pid: 309
2024-08-06 12:31:03 • starting socat (/usr/bin/socat TCP-LISTEN:4000,fork,reuseaddr TCP:localhost:9000,forever,shut-down) ...
2024-08-06 12:31:03   pid: 331
2024-08-06 12:31:03 • found IBG at /home/ibg/Jts/ibgateway/ibgateway.
2024-08-06 12:31:03 ---------------------------------------------------
2024-08-06 12:31:03  IB Gateway Startup / Tue Aug  6 00:31:03 EDT 2024
2024-08-06 12:31:03 ---------------------------------------------------
2024-08-06 12:31:03 • time: Tue Aug  6 00:31:03 EDT 2024
2024-08-06 12:31:03 • starting IB Gateway ...
2024-08-06 12:31:03   pid: 359
2024-08-06 12:31:03 • waiting for jauto availability ...
2024-08-06 12:31:04   jauto is ready
2024-08-06 12:31:04 • waiting for main window ...
2024-08-06 12:31:12   found: IBKR Gateway at 117,79
2024-08-06 12:31:12 • filling in login form ...
2024-08-06 12:31:16   - skipping combobox Region since persisted state (/home/ibg_settings/skip_login_combobox_Region) indicates it already matches China
2024-08-06 12:31:16   - skipping combobox Time Zone since persisted state (/home/ibg_settings/skip_login_combobox_Time Zone) indicates it already matches America/New York
2024-08-06 12:31:16 • logging in ...
2024-08-06 12:31:17 • entered maintenance cycle
2024-08-06 12:31:18   - welcome: 28% Build 10.30.1j Authenticating... Logging in xxx
2024-08-06 12:31:19 !!! IB Gateway is waiting for two-factor authentication !!!
2024-08-06 12:31:23 !!! IB Gateway is waiting for two-factor authentication !!!
2024-08-06 12:31:27   - welcome: 50% Build 10.30.1j Requesting startup parameters... Logging in xxx
2024-08-06 12:31:29 LogModuleConfigurator-Init: Log4j Ver2.x found on classpath
2024-08-06 12:31:29 LogModuleConfigurator-Init: LogModuleConfigurator initialized with Log4j Verd.x
2024-08-06 12:31:32   - option check skipped, to perform again remove /home/ibg_settings/skip_option_check2
2024-08-06 12:35:02 addLogConsole Client 1
2024-08-06 12:35:02 JTS-EServerSocket-104: Couldn't write to log file - java.io.IOException: write beyond end of stream
2024-08-06 12:35:02 JTS-EServerSocket-104: Couldn't write to log file - java.io.IOException: write beyond end of stream

I can only close it if I can reproduce the window. Right now none of my accounts have this. So you might as well try to login at web portal, I'm sure you'll see the same tasks to finish.

heshiming commented 3 months ago

No problemo. Sometimes it takes a trading day for those "tasks" to disappear. I've seen them, primarily via email notifications. But somehow I've never seen it during IBG login. If I did reproduce it, it would be a 5 minute job to fix it. So I'll keep watching.

forhonourlx commented 3 months ago

Great job! Thank you on behalf of all users. Wish you earn big money!