IbcAlpha / IBC

Automation of Interactive Brokers TWS. You can download the latest release here: https://github.com/ibcalpha/ibc/releases/latest
GNU General Public License v3.0
1.03k stars 181 forks source link

IBC Task ends with error After Windows Update #51

Closed andreas-it-dev closed 4 years ago

andreas-it-dev commented 5 years ago

Hi all,

after installing the latest windows updates over the weekend the IBC task still starts the TWS but is unable to sign in and exits with the error:

IBC: Could not login: could not find control: Use/store settings on server

it does however start without any issues when executing the bat file.

the following updates were installed:

https://www.catalog.update.microsoft.com/Search.aspx?q=KB4497936 (cumulative update for Windows 10) https://www.catalog.update.microsoft.com/Search.aspx?q=KB4497932 (proly unrelated as it updates flash) https://www.catalog.update.microsoft.com/Search.aspx?q=KB4495620 (also proly unrelated as it updates .NET)

any help is highly appreciated!

thanks a lot for this great product.

Andreas

andreas-it-dev commented 5 years ago

never mind, i thought i give the bat file a direct try and it starts right away..

so, the bad news is: its not working as written in the docs, the (way) better news is though: its now working as pre windows 10 with just using the bat file as the action and not fiddling around with that whole parameter string out of the log file.

rlktradewright commented 5 years ago

Andreas

Apologies for taking so long to respond to this. Busy times...

First, I'm not experiencing any problems with starting TWS using Task Scheduler with the command taken from the log file., so as far as I'm concerned the documentation is still correct.

Regarding the 'Could not login' message, if it works ok with the .bat file, then I suspect it's picking up an old configuration somehow when you run the task. Make sure the Start in (optional) setting in the task's Action is not inconsistent with the IbDir setting in `config.ini'. And if neither of these are specified, that might explain what you're seeing, as the Task Scheduler may be starting the task in a different working directory than before the update: so make sure that one of these is set.

I'm afraid the 'better news' is an illusion. The problem with Windows 10's Task Scheduler (and in Windows Server 2016/2019) is still there. This problem does not prevent Task Scheduler successfully running the .bat files: that has always worked ok. It's that in some circumstances Task Scheduler thinks the task is finished when TWS is actually still running, so it repeatedly tries to restart it (as per the task's definition) and this fails because the logfile is already in use.

You can easily demonstrate this by starting the task, then use Task Manager to kill the associated cmd.exe process (but not the conhost.exe process). TWS will continue running, but Task Scheduler will show it as 'Ready'.

The reason for this is that as far as Task Scheduler is concerned the task is only the cmd.exe process: it takes no notice whatsoever of the conhost.exe process or the java.exe process.

So while TWS runs fine if started with the .bat file from Task Scheduler, problems can arise if certain events occur that the task's definition is supposed to recover from. The only way I could find to avoid these problems is to not use the .bat files and instead run Java directly in the way described in the User Guide.

andreas-it-dev commented 5 years ago

Hi Richard,

no need to apologize..

the thing is, it worked flawlessly until that said update.. and then, over the weekend, i installed the windows updates and it stopped working.. other machines where i have not installed these updates are still working without any issues.

that particular machine runs windows 10 1903 which was still working without issues, just after installing the 3 updates mentioned above it didnt anymore.

so my guess is, you are using an "older" version of W10 and that is the reason why you arent (yet) experiencing these issues.

i agree on the issue with the task scheduler not realizing that the task is still running.. i experienced it today and had to turn off the "continuously run the job for x minutes" setting or my pc would've died on gazillions of command windows popping up.

rlktradewright commented 5 years ago

It's true that my main server is running Server 2016 (hence 'old'), but I have also tried this on the latest Windows 10 Insider Preview release dated 15 May 2019 (ie after the cumulative update you refer to, and thus almost certainly containing the same updates). As expected, it works fine.

There is no reason at all that the updates you mentioned should affect anything to do with IBC in any way, EXCEPT that Microsoft may have changed the way Task Scheduler sets the working directory for tasks that don't have the Start in (optional) specified in the task definition.

And in fact I did experience a similar thing on Windows Server 2016 today (which was last updated yesterday). I realised that since I upgraded to Server 2016 a couple of months back, I was still running the task using the .bat file rather than the explicit command (I had overlooked it at the time and forgotten all about it). When I changed the task today to use the command, it ran ok, but it did indeed pick up an old configuration that I had presumably used some time back, rather the one that was used when starting with the .bat file.

So there's no doubt in my mind that using the direct command still works fine: you'll need to check carefully that everything in your command is correct and that EITHER the working directory that TWS is being started in is correct, OR you're using the IbDir setting in config.ini to specify the location for TWS's settings. You could also try deleting the Jts.ini file from the TWS settings folder: IBC will recreate it and ensure it contains the required minimal information, and TWS will also update it as required.

If you still can't make it work, then please do the following:

andreas-it-dev commented 5 years ago

Richard,

i dont get it to work and as i said it was working fine until the said update.. there were zero issues... i also had already set the working dir in the task..

anyway, here's the output i get on the command line:

Microsoft Windows [Version 10.0.18362.113] (c) 2019 Microsoft Corporation. Alle Rechte vorbehalten.

C:\Users\Andreas>cd c:\IBC_Live

c:\IBC_Live>C:\Users\Andreas.i4j_jres\1.8.0_152_64\bin\java.exe -cp "C:\Jts\975\jars\jts4launch-975.jar;C:\Jts\975\jars\locales.jar;C:\Jts\975\jars\log4j-api-2.5.jar;C:\Jts\975\jars\log4j-core-2.5.jar;C:\Jts\975\jars\total-2018.jar;C:\Jts\975\jars\twslaunch-975.jar;C:\Jts\975\jars\twslaunch-install4j-1.9.jar;C:\IBC_Live\IBC.jar" -XX:+UseG1GC -XX:MaxGCPauseMillis=200 -XX:ParallelGCThreads=20 -XX:ConcGCThreads=5 -XX:InitiatingHeapOccupancyPercent=70 -Dinstaller.uuid=cf117dd0-3599-49db-9ec2-b9c26e4a3319 -DvmOptionsPath=C:\Jts\975\tws.vmoptions -Dsun.awt.nopixfmt=true -Dsun.java2d.noddraw=true -Dswing.boldMetal=false -Dsun.locale.formatasdefault=true -Xmx768m ibcalpha.ibc.IbcTws "C:\IBC_Live\config_paper.ini" 2019-05-20 18:56:57:700 IBC: Properties file C:\Users\Andreas\Documents\IBC\config.ini not found System Properties

swing.boldMetal = false java.runtime.name = Java(TM) SE Runtime Environment sun.boot.library.path = C:\Users\Andreas.i4j_jres\1.8.0_152_64\bin java.vm.version = 25.152-b16 sun.awt.nopixfmt = true vmOptionsPath = C:\Jts\975\tws.vmoptions java.vm.vendor = Oracle Corporation java.vendor.url = http://java.oracle.com/ path.separator = ; java.vm.name = Java HotSpot(TM) 64-Bit Server VM file.encoding.pkg = sun.io user.country = DE user.script = sun.java.launcher = SUN_STANDARD sun.os.patch.level = java.vm.specification.name = Java Virtual Machine Specification user.dir = c:\IBC_Live java.runtime.version = 1.8.0_152-b16 java.awt.graphicsenv = sun.awt.Win32GraphicsEnvironment java.endorsed.dirs = C:\Users\Andreas.i4j_jres\1.8.0_152_64\lib\endorsed os.arch = amd64 java.io.tmpdir = C:\Users\Andreas\AppData\Local\Temp\ line.separator =

java.vm.specification.vendor = Oracle Corporation user.variant = os.name = Windows 10 sun.java2d.noddraw = true sun.jnu.encoding = Cp1252 java.library.path = C:\Users\Andreas.i4j_jres\1.8.0_152_64\bin;C:\Windows\Sun\Java\bin;C:\Windows\system32;C:\Windows;C:\Program Files (x86)\Common Files\Oracle\Java\javapath;C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem;C:\Windows\System32\WindowsPowerShell\v1.0\;C:\Windows\System32\OpenSSH\;C:\Users\Andreas\AppData\Local\Microsoft\WindowsApps;;. java.specification.name = Java Platform API Specification java.class.version = 52.0 sun.management.compiler = HotSpot 64-Bit Tiered Compilers os.version = 10.0 user.home = C:\Users\Andreas user.timezone = Europe/Berlin installer.uuid = cf117dd0-3599-49db-9ec2-b9c26e4a3319 java.awt.printerjob = sun.awt.windows.WPrinterJob file.encoding = Cp1252 java.specification.version = 1.8 java.class.path = C:\Jts\975\jars\jts4launch-975.jar;C:\Jts\975\jars\locales.jar;C:\Jts\975\jars\log4j-api-2.5.jar;C:\Jts\975\jars\log4j-core-2.5.jar;C:\Jts\975\jars\total-2018.jar;C:\Jts\975\jars\twslaunch-975.jar;C:\Jts\975\jars\twslaunch-install4j-1.9.jar;C:\IBC_Live\IBC.jar user.name = Andreas java.vm.specification.version = 1.8 sun.java.command = ibcalpha.ibc.IbcTws C:\IBC_Live\config_paper.ini java.home = C:\Users\Andreas.i4j_jres\1.8.0_152_64 sun.arch.data.model = 64 user.language = de java.specification.vendor = Oracle Corporation awt.toolkit = sun.awt.windows.WToolkit java.vm.info = mixed mode java.version = 1.8.0_152 java.ext.dirs = C:\Users\Andreas.i4j_jres\1.8.0_152_64\lib\ext;C:\Windows\Sun\Java\lib\ext sun.boot.class.path = C:\Users\Andreas.i4j_jres\1.8.0_152_64\lib\resources.jar;C:\Users\Andreas.i4j_jres\1.8.0_152_64\lib\rt.jar;C:\Users\Andreas.i4j_jres\1.8.0_152_64\lib\sunrsasign.jar;C:\Users\Andreas.i4j_jres\1.8.0_152_64\lib\jsse.jar;C:\Users\Andreas.i4j_jres\1.8.0_152_64\lib\jce.jar;C:\Users\Andreas.i4j_jres\1.8.0_152_64\lib\charsets.jar;C:\Users\Andreas.i4j_jres\1.8.0_152_64\lib\jfr.jar;C:\Users\Andreas.i4j_jres\1.8.0_152_64\classes java.vendor = Oracle Corporation sun.stderr.encoding = cp850 file.separator = \ java.vendor.url.bug = http://bugreport.sun.com/bugreport/ sun.io.unicode.encoding = UnicodeLittle sun.cpu.endian = little sun.stdout.encoding = cp850 sun.desktop = windows sun.locale.formatasdefault = true sun.cpu.isalist = amd64

2019-05-20 18:56:57:742 IBC: Using default settings provider: ini file is C:\IBC_Live\config_paper.ini 2019-05-20 18:56:57:743 IBC: Using default login manager: getting username and password from args but not found. Will get from settings 2019-05-20 18:56:57:747 IBC: Using default main window manager: constructor parameter isGateway=false 2019-05-20 18:56:57:747 IBC: Using default trading mode manager: constructor parameter args but trading mode not present - will be taken from settings 2019-05-20 18:56:57:749 IBC: Using default config dialog manager 2019-05-20 18:56:57:755 IBC: CommandServer is not started because the port is not configured 2019-05-20 18:56:57:865 IBC: TWS Settings directory is: c:\IBC_Live 2019-05-20 18:56:57:867 IBC: Ensuring c:\IBC_Live\jts.ini contains required minimal lines 2019-05-20 18:56:57:868 IBC: Found section: [Logon] 2019-05-20 18:56:57:868 IBC: Can't find setting: s3store=false 2019-05-20 18:56:57:868 IBC: Found section: [Logon] 2019-05-20 18:56:57:868 IBC: Found setting: s3store=true 2019-05-20 18:56:57:869 IBC: Found section: [IBGateway] 2019-05-20 18:56:57:869 IBC: Found setting: ApiOnly=true 2019-05-20 18:56:57:869 IBC: Confirmed c:\IBC_Live\jts.ini contains required minimal lines 2019-05-20 18:57:01:718 IBC: Detected frame entitled: Login; event=Activated 2019-05-20 18:57:01:735 IBC: Detected frame entitled: Login; event=Opened 2019-05-20 18:57:01:738 IBC: Trading mode from settings: tradingMode=paper 2019-05-20 18:57:01:741 IBC: Setting Trading mode = paper !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! 2019-05-20 18:57:01:742 IBC: Could not login: could not find control: Use/store settings on server !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!

c:\IBC_Live>

andreas-it-dev commented 5 years ago

fwiw thats the log from starting via bat file:

================================================================================

Starting IBC version 3.7.5 on 20.05.2019 at 13:52:40,75

Operating system: Microsoft Windows 10 Pro 64-Bit 10.0.18362

Arguments:

TWS version = 975 Entry point = ibcalpha.ibc.IbcTws /TwsPath = C:\Jts /IbcPath = C:\IBC_Live /Config = C:\IBC_Live\config_paper.ini /Mode = /JavaPath = /User = /PW = /FIXUser = /FIXPW =

=================================

Generating the classpath Classpath=C:\Jts\975\jars\jts4launch-975.jar;C:\Jts\975\jars\locales.jar;C:\Jts\975\jars\log4j-api-2.5.jar;C:\Jts\975\jars\log4j-core-2.5.jar;C:\Jts\975\jars\total-2018.jar;C:\Jts\975\jars\twslaunch-975.jar;C:\Jts\975\jars\twslaunch-install4j-1.9.jar;C:\IBC_Live\IBC.jar

Generating the JAVA VM options Java VM Options= -Xmx768m -XX:+UseG1GC -XX:MaxGCPauseMillis=200 -XX:ParallelGCThreads=20 -XX:ConcGCThreads=5 -XX:InitiatingHeapOccupancyPercent=70 -Dinstaller.uuid=e3b44e5f-f21f-4b2a-aec3-938d13aca28f -DvmOptionsPath=C:\Jts\975\tws.vmoptions -Dsun.awt.nopixfmt=true -Dsun.java2d.noddraw=true -Dswing.boldMetal=false -Dsun.locale.formatasdefault=true

Determining the location of java.exe Location of java.exe=C:\Users\Andreas.i4j_jres\1.8.0_152_64\bin

Starting IBC with this command: "C:\Users\Andreas.i4j_jres\1.8.0_152_64\bin\java.exe" -cp "C:\Jts\975\jars\jts4launch-975.jar;C:\Jts\975\jars\locales.jar;C:\Jts\975\jars\log4j-api-2.5.jar;C:\Jts\975\jars\log4j-core-2.5.jar;C:\Jts\975\jars\total-2018.jar;C:\Jts\975\jars\twslaunch-975.jar;C:\Jts\975\jars\twslaunch-install4j-1.9.jar;C:\IBC_Live\IBC.jar" -Xmx768m -XX:+UseG1GC -XX:MaxGCPauseMillis=200 -XX:ParallelGCThreads=20 -XX:ConcGCThreads=5 -XX:InitiatingHeapOccupancyPercent=70 -Dinstaller.uuid=e3b44e5f-f21f-4b2a-aec3-938d13aca28f -DvmOptionsPath=C:\Jts\975\tws.vmoptions -Dsun.awt.nopixfmt=true -Dsun.java2d.noddraw=true -Dswing.boldMetal=false -Dsun.locale.formatasdefault=true ibcalpha.ibc.IbcTws "C:\IBC_Live\config_paper.ini"

2019-05-20 13:52:44:297 IBC: Properties file C:\Users\Andreas\Documents\IBC\config.ini not found System Properties

swing.boldMetal = false java.runtime.name = Java(TM) SE Runtime Environment sun.boot.library.path = C:\Users\Andreas.i4j_jres\1.8.0_152_64\bin java.vm.version = 25.152-b16 sun.awt.nopixfmt = true vmOptionsPath = C:\Jts\975\tws.vmoptions java.vm.vendor = Oracle Corporation java.vendor.url = http://java.oracle.com/ path.separator = ; java.vm.name = Java HotSpot(TM) 64-Bit Server VM file.encoding.pkg = sun.io user.country = DE user.script = sun.java.launcher = SUN_STANDARD sun.os.patch.level = java.vm.specification.name = Java Virtual Machine Specification user.dir = C:\Jts java.runtime.version = 1.8.0_152-b16 java.awt.graphicsenv = sun.awt.Win32GraphicsEnvironment java.endorsed.dirs = C:\Users\Andreas.i4j_jres\1.8.0_152_64\lib\endorsed os.arch = amd64 java.io.tmpdir = C:\Users\Andreas\AppData\Local\Temp\ line.separator =

java.vm.specification.vendor = Oracle Corporation user.variant = os.name = Windows 10 sun.java2d.noddraw = true sun.jnu.encoding = Cp1252 java.library.path = C:\Users\Andreas.i4j_jres\1.8.0_152_64\bin;C:\Windows\Sun\Java\bin;C:\Windows\system32;C:\Windows;C:\Program Files (x86)\Common Files\Oracle\Java\javapath;C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem;C:\Windows\System32\WindowsPowerShell\v1.0\;C:\Windows\System32\OpenSSH\;C:\Users\Andreas\AppData\Local\Microsoft\WindowsApps;. java.specification.name = Java Platform API Specification java.class.version = 52.0 sun.management.compiler = HotSpot 64-Bit Tiered Compilers os.version = 10.0 user.home = C:\Users\Andreas user.timezone = Europe/Berlin installer.uuid = e3b44e5f-f21f-4b2a-aec3-938d13aca28f java.awt.printerjob = sun.awt.windows.WPrinterJob file.encoding = Cp1252 java.specification.version = 1.8 java.class.path = C:\Jts\975\jars\jts4launch-975.jar;C:\Jts\975\jars\locales.jar;C:\Jts\975\jars\log4j-api-2.5.jar;C:\Jts\975\jars\log4j-core-2.5.jar;C:\Jts\975\jars\total-2018.jar;C:\Jts\975\jars\twslaunch-975.jar;C:\Jts\975\jars\twslaunch-install4j-1.9.jar;C:\IBC_Live\IBC.jar user.name = Andreas java.vm.specification.version = 1.8 sun.java.command = ibcalpha.ibc.IbcTws C:\IBC_Live\config_paper.ini java.home = C:\Users\Andreas.i4j_jres\1.8.0_152_64 sun.arch.data.model = 64 user.language = de java.specification.vendor = Oracle Corporation awt.toolkit = sun.awt.windows.WToolkit java.vm.info = mixed mode java.version = 1.8.0_152 java.ext.dirs = C:\Users\Andreas.i4j_jres\1.8.0_152_64\lib\ext;C:\Windows\Sun\Java\lib\ext sun.boot.class.path = C:\Users\Andreas.i4j_jres\1.8.0_152_64\lib\resources.jar;C:\Users\Andreas.i4j_jres\1.8.0_152_64\lib\rt.jar;C:\Users\Andreas.i4j_jres\1.8.0_152_64\lib\sunrsasign.jar;C:\Users\Andreas.i4j_jres\1.8.0_152_64\lib\jsse.jar;C:\Users\Andreas.i4j_jres\1.8.0_152_64\lib\jce.jar;C:\Users\Andreas.i4j_jres\1.8.0_152_64\lib\charsets.jar;C:\Users\Andreas.i4j_jres\1.8.0_152_64\lib\jfr.jar;C:\Users\Andreas.i4j_jres\1.8.0_152_64\classes java.vendor = Oracle Corporation file.separator = \ java.vendor.url.bug = http://bugreport.sun.com/bugreport/ sun.io.unicode.encoding = UnicodeLittle sun.cpu.endian = little sun.desktop = windows sun.locale.formatasdefault = true sun.cpu.isalist = amd64

2019-05-20 13:52:44:532 IBC: Using default settings provider: ini file is C:\IBC_Live\config_paper.ini 2019-05-20 13:52:44:532 IBC: Using default login manager: getting username and password from args but not found. Will get from settings 2019-05-20 13:52:44:532 IBC: Using default main window manager: constructor parameter isGateway=false 2019-05-20 13:52:44:534 IBC: Using default trading mode manager: constructor parameter args but trading mode not present - will be taken from settings 2019-05-20 13:52:44:535 IBC: Using default config dialog manager 2019-05-20 13:52:44:672 IBC: CommandServer is not started because the port is not configured 2019-05-20 13:52:44:864 IBC: TWS Settings directory is: C:\Jts 2019-05-20 13:52:44:868 IBC: Ensuring C:\Jts\jts.ini contains required minimal lines 2019-05-20 13:52:44:868 IBC: Found section: [Logon] 2019-05-20 13:52:44:868 IBC: Can't find setting: s3store=false 2019-05-20 13:52:44:868 IBC: Found section: [Logon] 2019-05-20 13:52:44:868 IBC: Found setting: s3store=true 2019-05-20 13:52:44:868 IBC: Found section: [IBGateway] 2019-05-20 13:52:44:868 IBC: Found setting: ApiOnly=true 2019-05-20 13:52:44:868 IBC: Confirmed C:\Jts\jts.ini contains required minimal lines 2019-05-20 13:52:55:630 IBC: Detected frame entitled: Login; event=Activated 2019-05-20 13:52:55:662 IBC: Detected frame entitled: Login; event=Opened 2019-05-20 13:52:55:665 IBC: Trading mode from settings: tradingMode=paper 2019-05-20 13:52:55:665 IBC: Setting Trading mode = paper 2019-05-20 13:52:55:955 IBC: Click button: Paper Log In 2019-05-20 13:52:56:765 IBC: Button now disabled: Paper Log In 2019-05-20 13:52:57:437 IBC: Detected frame entitled: Authenticating...; event=Activated 2019-05-20 13:52:57:437 IBC: Detected frame entitled: Authenticating...; event=Opened 2019-05-20 13:53:04:127 IBC: Detected dialog entitled: Downloading settings from server; event=Closed LogModuleConfigurator-Init: Log4j Ver2.x found on classpath LogModuleConfigurator-Init: LogModuleConfigurator initialized with Log4j Verd.x 2019-05-20 13:53:35:537 IBC: Detected frame entitled: DU961741 Interactive Brokers (Simulated Trading); event=Opened 2019-05-20 13:53:35:539 IBC: Found TWS main window 2019-05-20 13:53:35:787 IBC: Detected frame entitled: DU961741 Interactive Brokers (Simulated Trading); event=Activated 2019-05-20 13:53:35:793 IBC: Detected frame entitled: Starting application...; event=Closed 2019-05-20 13:53:36:915 IBC: Detected dialog entitled: Warning; event=Activated 2019-05-20 13:53:36:917 IBC: Detected dialog entitled: Warning; event=Opened 2019-05-20 13:53:36:917 IBC: Click button: I understand and accept 2019-05-20 13:53:38:612 IBC: Detected dialog entitled: Warning; event=Closed 2019-05-20 13:53:38:612 IBC: Detected frame entitled: DU961741 Interactive Brokers (Simulated Trading); event=Activated 2019-05-20 13:54:37:431 IBC: Detected frame entitled: DU961741 Interactive Brokers (Simulated Trading); event=Activated 2019-05-20 14:28:13:362 IBC: Detected frame entitled: DU961741 Interactive Brokers (Simulated Trading); event=Activated 2019-05-20 17:07:45:464 IBC: Detected frame entitled: DU961741 Interactive Brokers (Simulated Trading); event=Activated 2019-05-20 17:25:49:899 IBC: Detected window: type=javax.swing.JWindow; event=Opened 2019-05-20 17:25:57:351 IBC: Detected dialog entitled: ; event=Activated 2019-05-20 17:25:57:352 IBC: Detected dialog entitled: ; event=Opened 2019-05-20 17:26:12:193 IBC: Detected window: type=javax.swing.JWindow; event=Closed 2019-05-20 17:26:42:053 IBC: Detected window: type=javax.swing.Popup$HeavyWeightWindow; event=Opened 2019-05-20 17:26:55:187 IBC: Detected window: type=javax.swing.Popup$HeavyWeightWindow; event=Closed 2019-05-20 17:26:55:188 IBC: Detected frame entitled: DU961741 Interactive Brokers (Simulated Trading); event=Activated 2019-05-20 17:26:55:189 IBC: Detected dialog entitled: ; event=Closed

andreas-it-dev commented 5 years ago

ah, and the TWS version is 975.3e

rlktradewright commented 5 years ago

[Note for future: when I said attach the files, I meant attach, not include the contents inline, which makes it much more difficult to compare them. But not to worry, done it now...]

As I suspected, the two cases are using different directories for the TWS settings. The direct command uses C:\IBC_Live, whereas the .bat file case uses C:\Jts.

So if you do what I said before and either set the Start in (optional) in the task definition to C:\Jts or set `IbDir=C:\Jts' on config.ini, you should find it works ok.

andreas-it-dev commented 5 years ago

aah, C:\JTS as "start in" did the trick.. i always had c:\ibc_live in it and that worked fine until last weekend..

thanks a lot, Richard, especially for the "unagitated" and professional response.. i highly appreciate it.

best, Andreas

rlktradewright commented 5 years ago

Good that it's fixed.

However I'm still puzzled as to what happened here. The error message that you received actually means that the structure of the login dialog that TWS was displaying was different from what IBC was expecting. Since it was the same version of TWS in both cases, and you were using the same command to start them, it doesn’t seem reasonable to believe that TWS actually did display different login dialogs (but see more on this below).

So this morning I wondered whether perhaps the version of IBC in C:\ibc_live is not up-to-date, because the structure of the login dialog did change in TWS 974, but that can’t be the case since IBC is being loaded from C:\ibc_live in both cases.

Thus I'm still in the dark as to exactly why you got this error message. I suspect that it has something to do with the contents of the jts.ini file in C:\ibc_live, which contains configuration information for TWS that is not related to a specific user. There was a case in the past where a particular version of TWS would not show the 'Store settings on server' checkbox if jts.ini did not contain the s3store setting, which is why IBC makes sure that setting is there, but I think IBKR fixed this bug long ago and IBC probably no longer needs to do this. But it's possible that there is some new 'thing' in jts.ini that causes TWS to not show that checkbox.

So I wonder whether you did anything that might have changed C:\ibc_live\jts.ini in some unexpected way over the weekend? Examples might be installing a new version of TWS, or perhaps even running TWS manually from the Tws.exe, or running the self-updating version..

I'm really clutching at straws here, but there must be a reason for what happened, and although your immediate problem is solved, this might come back and bite someone else, perhaps in a different way.

It might be helpful if you could post the contents of C:\ibc_live\jts.ini so I can see if there's anything unusual about it (you can quote it inline, because it's very small).

andreas-it-dev commented 5 years ago

hi Richard,

i havent run the tws manually nor have i installed the self updating version of it.. i also havent updated the tws since i initially installed it. what i did when it didnt start on sunday was to open it via the ibc bat file but that was it..

here is the content of the C:\ibc_live\jts.ini

[IBGateway] ApiOnly=true

[Logon] useRemoteSettings=true UserNameToDirectory=ghiflhcdlbepmaeccbaopfoihhgmlpfboncpfccb,cdndandlnedhiamgdaeniebmhilbflbmamabajlj TimeZone=Europe/Berlin tradingMode=l colorPalletName=dark Steps=20 SupportsSSL=ndc1.ibllc.com:4000,true,20190520,false s3store=true displayedproxymsg=1

[Communication] Peer=ndc1.ibllc.com:4000 Region=usr

rlktradewright commented 5 years ago

Hmmm, well that didn't help much!

I wonder if you'd be willing to try an experiment, perhaps outside market hours to reduce inconvenience since this is your live account.

I suggest stopping the task, then changing the task to start in C:\ibc_live again, but delete C:\ibc_live\jts.ini and C:\ibc_live\ghiflhcdlbepmaeccbaopfoihhgmlpfboncpfccb,cdndandlnedhiamgdaeniebmhilbflbmamabajlj (or rename them so you can get them back again if need be). Then run the task again. jts.ini will be recreated, and so will ghiflhcdl...amabajlj, and your latest stored settings will be downloaded from the IB servers. It should all work properly...

andreas-it-dev commented 5 years ago

i am happy to help Richard..

i did what you suggested and it still didnt work.. however, the jts.ini doesnt seem to be complete now:

[IBGateway] ApiOnly=true

[Logon] tradingMode=l s3store=true TimeZone=Europe/Berlin

andreas-it-dev commented 5 years ago

after setting the start in dir back to c:\jts it works again with the c:\JTS\jts.ini looking normal:

[IBGateway] ApiOnly=true

[Logon] useRemoteSettings=true UserNameToDirectory=ghiflhcdlbepmaeccbaopfoihhgmlpfboncpfccb,cdndandlnedhiamgdaeniebmhilbflbmamabajlj TimeZone=Europe/Berlin FontSize=16 tradingMode=p colorPalletName=dark Steps=14 Locale=en UseSSL=false SupportsSSL=ndc1.ibllc.com:4000,true,20190521,false;cdc1.ibllc.com:4000,true,20190516,false os_titlebar=false s3store=true displayedproxymsg=1

[settings] fmhdbfefojihmdahhhhimkmhjlaommncdobagiml=1557982480322 ghiflhcdlbepmaeccbaopfoihhgmlpfboncpfccb=1558413840031 cdndandlnedhiamgdaeniebmhilbflbmamabajlj=1558414782190

[Communication] Peer=ndc1.ibllc.com:4000 Region=usr

the proile dir hasnt been created in c:\ibc_live, though i guess that is expected, given that it didnt make it through log in..

rlktradewright commented 5 years ago

Weird.

The reason for the small initial jts.ini is that IBC creates it with just enough info for TWS to display the login dialog. Once the login has succeeded, TWS then writes a whole load more stuff into it. But I really don't understand why it won't display the correct login dialog.

There are a couple of things I'd like to investigate further at my end (but I'm going to be away from the computer for some hours).

In the meantime, it would be helpful if you could change the config.ini with this setting (it's right at the end of the file):

LogComponents=yes

Then run the direct command task again, and copy the output window into a file again (please attach).

This will log the structure of the login dialog so I'll be able to see exactly what's being displayed, and perhaps get some idea of why it's different.

After you've done that, don't forget to set LogComponents=no again ('yes' makes logfiles much larger).

Another thing you could try is to copy jts.ini from C:\Jts to C:\ibc_live. If that works (and I really can't imagine how it can't work), then you could try removing stuff from C:\ibc_live\jts.ini until it fails again, at which point we'll know what is causing the problem.

But I have to go now, not sure how long for, but probably at least till this evening GMT.

andreas-it-dev commented 5 years ago

Richard,

i was a little tied up and still am, this evening.. however, i managed to at least enable logging and created that log for you, maybe thats something to work with.

launcher.log

i will try the jts.ini tricks later, most probably not before tomorrow..

hope this helps.

best, Andreas

rlktradewright commented 5 years ago

Sorry, I didn't make myself clear enough. When you've set LogComponents=yes in config.ini, it's the output that's written to the command prompt window that I need (launcher.log doesn't contain anything useful). And to capture this you'll need to run from the command prompt rather than via task scheduler, as you did yesterday.

No rush.

andreas-it-dev commented 5 years ago

ah, i thought it logs into that launcher.log..

ok, i did all the stuff you were asking for.

here's the log:

ibc_log.txt

and i also copied the c:\jts\jts.ini into c:\ibc_live\jts.ini and kept altering the jts.ini until it crashes..

the magic line was:

Locale=en

once i removed this, it started to crash.

hope this helps.

ttyl, Andreas

rlktradewright commented 5 years ago

Thanks very much for that. As you've probably noticed, if jts.ini doesn't contain the Locale setting, it runs in German, and that's why IBC can't find the relevant control: it expects the TWS dialogs to be in English!

So when you first encountered this problem, one of three things must have happened:

I won't speculate as to how one of these might have happened, but I can't see any other possibility.

Anyway, hopefully you'll now be able to get it all working as required.

rlktradewright commented 4 years ago

IBC has been updated to ensure that jts.ini includes this line:

Locale=en

This is included in release 3.8.2.