Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

stable version #250

Open
giulyko00 opened this issue Mar 20, 2024 · 12 comments
Open

stable version #250

giulyko00 opened this issue Mar 20, 2024 · 12 comments

Comments

@giulyko00
Copy link

Hi, I've been trying to understand what was the problem reading the "issues" page but without succeeding.
I downloaded the "tws-stable-standalone-windows-x64" version but through IBC always the LATEST version gets started.
Cattura

@rlktradewright
Copy link
Member

That menu item doesn't show which version is running, it just gives you the option to switch.

If you want to check that the right version is running, look at the Help | About Trader Workstation menu item. That shows you the full version number that's actually running.

I can assure you that if you downloaded the Stable version, that's what you'll get (unless you use the menu item in your screenshot to switch it). IBC has no interest in or knowledge of the TWS version number: it just runs whatever you downloaded.

@giulyko00
Copy link
Author

Ok, I thought that was the reason why my tws crashes or gets restarted at unusual times. Right now for example. Can I share with you my logs?

@rlktradewright
Copy link
Member

Yes, please do. Attach the IBC logfile to your reply (attach using the 'Paste,drop opr click to add files' link blow the editing area) , do not quote it inline.

Don't include the TWS logfile: they are generally only meaningful to IBKR.

@giulyko00
Copy link
Author

Last disconnection happened tonight, at 00:50 CET I received the second factor authentication notification on my phone, so I send you both the wednesday and the thursday logs.
P.S.: I have your task to restart IBC on task scheduler enabled, I just changed the restart time.
IBC-3.18.0_TWS-1019_WEDNESDAY.txt
IBC-3.18.0_TWS-1019_THURSDAY.txt

@rlktradewright
Copy link
Member

I don't see what the problem is here.

It started at 00:50:01 on Wednesday, ran through the day till 23:50 when it did an auro-restart (presumably this is because you have AutoRestart configured for 11:50 PM in the Lock and Exit section of the Global Configuration dialog).

After it restarted, at 23:51:57, you pressed Ctrl-C and killed it.

Then at 00:50:01 on Thursday it started up again, presumably started by Task Scheduler. But because this was a 'cold' restart, it initiated full 2FA again.

So everything worked exactly as it should.

Perhaps you were expecting login to complete automatically without 2FA when it was restarted by Task Scheduler? Well, sorry, that's a misunderstanding. Login without 2FA only happens after TWS has exited as a result of auto-restart, or use of the File | Restart ... menu entry.

@giulyko00
Copy link
Author

Yes I understand but why do you say " you pressed Ctrl-C and killed it"? I didn't (I mean, at least I didn't forget). Maybe my tws crashed?

@rlktradewright
Copy link
Member

Here are the last two l;ines of the Wednesday logfile:

2024-03-20 23:51:57:649 IBC: detected frame entitled: Login; event=Closed
^C

^C is what is recorded when Ctrl-C is pressed. Pressing it causes the Java Virtual Machine to shut down (unless the event is caught and handled, but IBC doesn't do this), and before it exits it writes that text to StdErr, and it's then redirected to the IBC logfile. IBC itself is not involved in this sequence.

I've never seen this as a result of a TWS crash (in fact I haven't had a TWS crash for years), but I suppose it's possible.

I presume ending the task via Task Manager would have the same effect.

@giulyko00
Copy link
Author

It happened again, I didn't do anything and then the task scheduler restarted IBC at 00:50. Can you think of what the cause could be?

@rlktradewright
Copy link
Member

Clearly something is shutting down or killing the IBC/TWS process just after the auto-restart. Here are some reasons this might happen:

  • TWS or IBC crashes
  • File | Exit or any other normal exit method
  • the banner window (ie the one that shows you where the logfile is) is closed
  • Ctrl-C is used on the banner window or the TWS window
  • a STOP command to IBC
  • the time specified in the ClosedownAt setting in cofig.ini is reached
  • the Java process that runs IBC/TWS is terminated via Task Manager
  • the Scheduled Task that runs IBC is not set up correctly

I suspect the last of these is the most likely culprit, so have a careful look at that, and read the detailed description below to make sure you understand how this is all supposed to operate.

By the way I created a new version of the Scheduled Task template a few months back, because there were some things in the previous version that weren't quite right. I don't recall the details, but I advise you to base your task on the new template which you can find at:

https://github.com/IbcAlpha/IBC/blob/master/resources/Start%20TWS%20(autorestart).xml

The whole point of that task is that it's set up to automatically restart IBC if it shuts down. This enables it to keep IBC/TWS running all week even if something fails..

As far as Task Scheduler is concerned, the task is the running .bat file, not the IBC program. When TWS does its auto-restart, it creates the autorestart file that contains encrypted credentials, then shuts itself down (and IBC goes with it because it's in the same process as TWS), but the .bat file is still running, so Task Scheduler doesn't consider that the end of the task. The .bat then reloads IBC which starts a new instance of TWS,, and TWS completes the auto-relogin using the information in the autorestart file to avoid the need for 2FA..

But if TWS stops for any other reason, as listed above, then the .bat file also exits: Task Scheduler now conisders the task completed, so it restarts it after the specified interval. In this case, the autorestart file won't have been created, so TWS will do a full login requiring 2FA.

If you need to shut down TWS for a time for some reason without it restarting (for example to install a new version of TWS or IBC), then it's safest to disable the Schedule Task before closing TWS, do what you need to do, then run the Scheduled Task again to get it all gooing again.

@giulyko00
Copy link
Author

Ok thank you, for the moment.

@giulyko00
Copy link
Author

Now every night an additional instance of IBC gets started as you can see:
image

@rlktradewright
Copy link
Member

It might be helpful if you tell me what has changed. I'm not a mind reader...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants