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

Login failed - Server disconnected, please try again #142

Open
wsj3000 opened this issue Sep 27, 2021 · 33 comments
Open

Login failed - Server disconnected, please try again #142

wsj3000 opened this issue Sep 27, 2021 · 33 comments

Comments

@wsj3000
Copy link

wsj3000 commented Sep 27, 2021

Sometimes I got this pop-up window it says: 'Login failed - Server disconnected, please try again'. And if I didn't click the button 'OK' to confirm, it seems the TWS will not try to connect again and then the connection lost.
After I anaylisis the log in attached file, I found that it happened in server rset time (such as Second reset: 20:15 - 21:00 HKT ). As my TWS server is in HongKong, so it seems it was coursed by server reset.
Anyway, for this problem, if IBC can add new auto click button behavior to confirm to reconnect to server when login failed?
After all, the connection maybe lost by other reasons and we need keep TWS online again ASAP.
Thank you very much.

BTW, you can found server reset time here: https://www.interactivebrokers.com/cn/index.php?f=2225

ibc-3.10.0_TWS-978_Thursday.txt
ibc-3.10.0_TWS-978_Friday.txt
ibc-3.10.0_TWS-978_Saturday.txt

@rlktradewright
Copy link
Member

TWS 978 is out-of-date, and your version (978.2f) is even more out-of-date (note that 978.2h was dated 7 Oct 2020, and yours is even older). I don't want to spend time catering for a situation that no-one else seems to have encountered and that may not apply to current versions.

So please update to the current stable version of TWS (981.3c at the time of writing) and try again. If it still happens, I'll take a closer look.

Your logfile actually shows up another problem that I do need to address. It shows that you have a 'white label' "Snowball Securities" version of TWS. Unfortunately this results in IBC not recognising the main TWS window, which has a number of potential problems, not least that IBC won't be able to access the Global Configuration dialog. I'll have to amend the main window recognition code to avoid this. I'll do this some time soon, but it probably won't be today.

@deanb2
Copy link

deanb2 commented Sep 27, 2021 via email

@rlktradewright
Copy link
Member

Ok thanks for that info.

I'll do something to handle that dialog when I get have some time. It would be helpful if you could confirm that clicking the 'OK' button does actually cause reconnection to happen: ie you don't have to actually restart TWS/Gateway.

@wsj3000
Copy link
Author

wsj3000 commented Sep 27, 2021

TWS 978 is out-of-date, and your version (978.2f) is even more out-of-date (note that 978.2h was dated 7 Oct 2020, and yours is even older). I don't want to spend time catering for a situation that no-one else seems to have encountered and that may not apply to current versions.

So please update to the current stable version of TWS (981.3c at the time of writing) and try again. If it still happens, I'll take a closer look.

Your logfile actually shows up another problem that I do need to address. It shows that you have a 'white label' "Snowball Securities" version of TWS. Unfortunately this results in IBC not recognising the main TWS window, which has a number of potential problems, not least that IBC won't be able to access the Global Configuration dialog. I'll have to amend the main window recognition code to avoid this. I'll do this some time soon, but it probably won't be today.

(1)New version TWS 981.3c. also has this problem, you can found it in here.
ibc-3.10.0_TWS-981_Friday.txt

(2)My account of IB applied through Snowball, so you can see 'white label' "Snowball Securities". Also I downloaded TWS from IB Official website, nothing changed by Snowball. (Snowball X outsources the clearing and settlement processes of its securities trading business to IB LLC)

@wsj3000
Copy link
Author

wsj3000 commented Sep 30, 2021

Ok thanks for that info.

I'll do something to handle that dialog when I get have some time. It would be helpful if you could confirm that clicking the 'OK' button does actually cause reconnection to happen: ie you don't have to actually restart TWS/Gateway.

I have clicked OK button for times, yes, TWS will try to reconnect to server and online again after a while.

@rlktradewright
Copy link
Member

Fixed in Release 3.11.0

@tredondo
Copy link
Contributor

I still saw this issue with v3.11.0:

image

image

I did use an older Gateway version (972), because the newer ones can't be made to run indefinitely.

@rlktradewright
Copy link
Member

As a first step, please attach (don't quote inline) your IBC logfile.

@tredondo
Copy link
Contributor

tredondo commented Dec 1, 2021

ibc-3.11.0_GATEWAY-972_Tuesday.txt

Here's the log. Thanks for taking a look.

@rlktradewright
Copy link
Member

Thanks for the logfile. As it happened it didn't add any new information, but it ruled out a few possibilities.

But I've been stupid: I didn't look closely enough at your screenshots in comparison with the earlier ones, and it's fairly obvious that IB have changed both the dialog title and the first part of the message itself; or perhaps this is just slightly different circumstances; or it's just different in version 972. Either way, IBC doesn't recognise the dialog and ignores it instead of clicking 'OK'.

I'll try to get a new release out soon. There are some other items for release which need some finalisation, but that won't take too long. In the meantime, apologies for the inconvenience if this problem keeps occurring.

@tredondo
Copy link
Contributor

tredondo commented Dec 1, 2021

No worries, thank you so much for the help and for all your work!

@rlktradewright
Copy link
Member

I've just made a new release, 3.11.1, to address this problem.

Waiting until the other items I intended to release are ready would have taken too long.

@tredondo
Copy link
Contributor

tredondo commented Dec 2, 2021

Thank you! New release has been deployed after the market close. Will update in a few days.

@tredondo
Copy link
Contributor

tredondo commented Dec 7, 2021

Seemed to work fine over the weekend, until it ran into an apparently different issue: #153.

@tredondo
Copy link
Contributor

Just ran again into this issue, with 3.12.0-beta.2, after about a month of running that version without any incident.

image

Logging stopped on Fri Jan 7, at 23:59 NYSE time.

ibc-3.12.0-beta.2_GATEWAY-972_Saturday.txt

@rlktradewright
Copy link
Member

@tredondo

So in spite of everything that IB has been announcing regarding the Log4J issue, you've continued to run Gateway 972 for an entire month? It may be that it is still working well, in spite of what IB said about these old versions not working after 29 December 2021, but surely you can see that the writing is well and truly on the wall and could hardly be writ larger: it's time to upgrade to 981.

From your screen shot and your logfile it seems as though the Gateway was in the process of closing down. I cannot see any reason why IBC did not recognise that dialog and click the OK button, but for some reason it didn't.

I don't propose to spend any more time on this, and in general I don't intend to provide any significant support to users who continue to try and run these old versions. It's just a complete waste of my time.

So please, do yourself a favour and upgrade. If you still encounter the same problem with 981 or 1012, then I'll be happy to take another look.

As an interim piece of advice, if you want to continue with 972 (if indeed it still works at all) while you get yourself sorted out with 981, then just run it for a week at a time at most instead of trying to run it forever.

@mauerdev
Copy link

I have a similar issue. It prompts to confirm reconnect in the middle of the night. I have tried stable and latest. Is there a solution for this?

@rlktradewright
Copy link
Member

@mauerdev IBC logfile please.

@mauerdev
Copy link

mauerdev commented Aug 2, 2022

api-exported-logs.txt
tws-exported-logs.txt
This is happening again on multiple accounts. It seems to be happening with increased frequency. It happens around 10MST almost every night. After clicking Re-login multiple times, it continues to fail to recognize a password. It locked me out after repeated attempts. The only choice is to close the application when this happens.

@rlktradewright
Copy link
Member

Actually it was the IBC logfile I asked for, not the TWS and API logs.

However, the TWS logfile seems to indicate that the session was disconnected at around 2022-08-02 00:15:26, and its attempt to re-login failed because of a competing session (ie another instance of TWS or Gateway running under the same user, or the IBKR Mobile app logged in and using data, or the client portal logged in and using data).

Does that sound like what might be happening?

If so, you can protect against this by setting:

ExistingSessionDetectedAction=primary

in your config.ini. Then, if anything attempts to start a competing session, IBC will handle the relevant dialogs to prevent that new session from proceeding.

@mauerdev
Copy link

mauerdev commented Aug 2, 2022

I am not sure how to export IBC logfile. To my knowledge, there are no other attempts to start a competing session, and this occurs about the same time every night. I will see if changing the setting has any effect.

@rlktradewright
Copy link
Member

Every time you run IBC, there is a big friendly window displayed which tells you exactly where the IBC logfile is. It's just a text file, so there is no need to 'export' anything.

@OakvilleTrading
Copy link

I have the same error with TWS10.26.

@rlktradewright
Copy link
Member

How frequently? Which day(s) of the week? Did it happen with previous TWS versions? Attach IBC logfile please.

@windowshopr
Copy link

I got this same issue today on Windows 10. Currently trying to log in to IB Gateway on a Saturday so that could be an issue in and of itself. The issue started after the weekly scheduled maintenance on Friday night while IB Gateway was still logged in (started doing the "attempting to reconnect" thing as it usually does). IB Gateway shuts itself down after 11:45 PM as per my settings.

See the screenshots below (I can't get past the login screen so there is no log to show):

image

image

I can log in to the IB website (so it's not a credentials issue), just not the TWS or IB Gateway.

I can connect to the Paper Trading version of IB Gateway, but not the Live Trading portion.

The current version information about IB Gateway is below:

image

image

I realize this isn't an issue with this repo, but IB, however I found this thread and wanted to post some of the info I could on it as the OP is not alone! Hopefully it figures itself out for next week.

@rlktradewright
Copy link
Member

There is an IBC logfile as soon as you start IBC. The banner window tells you where it is.

However in this case I don't actually need it because I've already seen some logs from this situation. And in fact I've added an enhancement to IBC to (hopefully) cope with this. It will detect this particular dialog, shut down IBC/TWS/Gateway, and then restart everything (thus requiring full 2FA).

It's a bit difficult to know if this enhancement works properly, because i can't force this to happen, so time will tell. If there's something wrong at the server end, there's a possibility that the same thing will just happen again

I'm not quite ready to release this yet as I have to make some other changes that need a bit more work, but it shouldn't be long.

@OakvilleTrading
Copy link

OakvilleTrading commented Feb 15, 2024

Screenshot 2024-02-15 at 7 50 46 AM I get this screen every time. I do not log in since last Dec. It is version 10.26, offline. Cannot install online version. Always got some java error.

@rlktradewright
Copy link
Member

As I said in my previous post, I've done an update to IBC that addresses this issue, but I haven't released it yet. I will do so soon.

However, if you get this problem every time you run IBC, that suggests to me that there is something fundamentally wrong somewhere. So the chances are that my updated version will handle this dialog by restarting IBC and attempting the login again, but will just fail again in the same way.

By the way, I notice that I asked you on Dec 28th to attach your IBC logfile, but you haven't responded. Sending me screenshots that others have already sent is not going to help. Sending your logfile just might.

@OakvilleTrading
Copy link

OakvilleTrading commented Feb 19, 2024

Here are the log texts. I run 10.26 standalone version

image

Exception found -

java.lang.UnsupportedOperationException: Toolkit.getLockingKeyState
at java.desktop/sun.lwawt.macosx.LWCToolkit.getLockingKeyState(LWCToolkit.java:522)
at twslaunch.jclient.login.a.e(a.java:622)
at twslaunch.jclient.login.a.a(a.java:599)
at jclient.LoginFrame.main(LoginFrame.java:469)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.base/java.lang.reflect.Method.invoke(Method.java:566)
at com.exe4j.runtime.LauncherEngine.launch(LauncherEngine.java:84)
at com.install4j.runtime.launcher.MacLauncher.main(MacLauncher.java:52)

@rlktradewright
Copy link
Member

@OakvilleTrading

I asked you for your IBC logfile, but you've sent me a screen grab of a tiny portion of the TWS logfile, which is completely useless.

When you start IBC you get a nice banner window that tells you exactly where the IBC logfile is. That logfile gives me a large amount of information that is often extremely helpful in diagnosing problems.

So attach that (as a text file): don't quote it inline, and don't edit it.

@OakvilleTrading
Copy link

I have problem with TWS. Not IBC. Now I know I am in the wrong place to fix my issue.

@frucode28
Copy link

@OakvilleTrading Have you managed to solve this issue? I also have the same one.

@rlktradewright
Copy link
Member

I've been reviewing some of the IBC code, and have improved a couple of things that may have a bearing on this issue.

Here's a link to a new beta version of IBC v3.19.0-beta.1:

https://1drv.ms/f/s!AlqfLEOWDJ9Zh-klxayDSKUDSpj0Ow?e=LUbIce

For both Windows and Linux/macOS users, you'll need to extract the updated IBC.jar and version files to your IBC folder.

For Windows users only, you should also extract the StartIBC.bat file to the scripts subfolder in your IBC folder. And also extract the config.ini file, carrying forward your settings to the new version.

You may notice that there is a new ColdRestartTime setting in config.ini. I haven't yet decided whether to keep this feature going forward with IBC, so you can use it if you want but I may remove it (though if people find it useful I'll probably keep it). However note that this feature doesn't work properly on Linux/macOS as the scripts need some updates to support it: I'll do these if I decide to keep the feature.

rlktradewright added a commit that referenced this issue May 22, 2024
rlktradewright added a commit that referenced this issue Jun 27, 2024
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

8 participants