Skip to content
New issue

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

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

Already on GitHub? # to your account

autorestart stopped working with IBC 3.21.0 and IB gateway 10.34.1c #290

Closed
hammerrust opened this issue Feb 21, 2025 · 6 comments
Closed

Comments

@hammerrust
Copy link

It's failed autorestart for me twice now since I've updated. I'm using https://github.com/gnzsnz/ib-gateway-docker . (Sorry, lost the logs because I switched back to an older version and it overwrote the docker logs.)

But the gist of the logs is that it finds the autorestart file, and it seems to be passing the autorestart flag. But it fails to autorestart showing login required, then IBC deletes the autorestart file, restarts IB gateway, and requests two factor auth.

I wonder if it's due to the new flags passed for the java 17 vs java 8 change?

@rlktradewright
Copy link
Member

There's not a lot I can do without the log file.

However there is a situation that can happen, where IBC will start afresh rather than autorestart: this is when the IBKR server decides for some reason that it doesn't trust the encrypted credentials in the autorestart file. In this case the server sends a specific rather cryptic error message: IBC intercepts this and realises that it cannot proceed with the autorestart so it does what you said, and does a full cold start including 2FA.

The most common reason for this is when someone tries to keep IBC/TWS/Gateway running right through Sunday, contrary to IBKR's policy that it must be shut down completely at least once during the course of Sunday. If you try to do this, it will autorestart a couple more days and then throw you out.

However there are also rare occasions where IBKR decides to invaldate your credentials and prevent autorestart. It sends this same message, and IBC reacts in the same way (nothing else it can do). I have absolutely no idea what causes this, but it did happen to me two days ago (probably only the second time I've seen it) myself, though others have reported it occasionally.

If none of this sounds like what happened to you, then you'll just have to get the logfile somehow.

@hammerrust
Copy link
Author

I retested it just now and it had the same behavior. Note that times are in UTC. I've attached the logs.

logs.txt

@rlktradewright
Copy link
Member

I think the problem is that you are setting the autorestarttime too close to the actual start time. You started the run at 21:05:42, and you set the autorestarttime to 21:08 which is less than three minutes later. Long experience has shown that if you want to test autologofftime orautorestarttime, you need to set the relevant time at least 4 minutes into the future. It's not clear why this should be the case, but i have no control over what TWS/Gateway actually do so I just have to accept this as the reality.

So I think if you start at 21:08 and set autrestarttime to say 21:15, it should work fine.

@hammerrust
Copy link
Author

Attached logs with another attempt with a longer wait time, still failed. It's possible it'll work next week since the timing of one of my failures matches yours, but it happened twice at my usual restart time this week.

logs.txt

@hammerrust
Copy link
Author

hammerrust commented Feb 22, 2025

Also just verified that the same thing happens using a basic setup without the docker image:

  1. Downloaded and extracted https://www.interactivebrokers.com/en/trading/ibgateway-latest.php on Linux.
  2. Modified IBC's config.ini to set AutoRestartTime (restart time 10 minutes away), IbLoginId, IbPassword
  3. Set gatewaystart.sh's TWS_MAJOR_VRSN, IBC_INI, IBC_PATH, TWS_PATH, and LOG_PATH.
  4. Run gatewaystart.sh

No other changes, and it fails to autorestart.

@rlktradewright
Copy link
Member

Just to let you all know that I'm looking into this.

I have found a stupid error, but I'm trying to find the best way to fix it. I'll try to publish a new release in good time for tomorrow's (Sunday's) evening session start.

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

No branches or pull requests

2 participants