Open dkharrat opened 1 month ago
You need to provide the whole log file, not just the bits you think might be relevant.
Please attach it to your reply. Don't paste it inline..
What reason do you have for thinking IBC should restart Gateway every time it shuts down? It's not intended to do that.
Sure, here's the log file: ibgateway.log
Any reason why Gateway would shutdown on its own? I couldn't find any indication in the logs to show the cause.
What reason do you have for thinking IBC should restart Gateway every time it shuts down? It's not intended to do that.
How do you recommend one handles cases where Gateway exists for whatever reason (say it crashed)? It would be ideal to restart Gateway if there were any issues for better reliability. In this scenario, I had to manually restart the container to start up Gateway again, but It would be better to have some automatic handling of such cases.
Thanks for the logfile, and apologies for the delay in responding. I've actually soent far too many hours looking at this to make sense of the file and to try and work out what's going on.
First, let me say that I haven't kept up with progress on this Docker implementation, but it certainly looks like a pretty thorough job, so kudos to @gnzsnz. I'll have to look into it more to understand it fully (I'm no Docker expert). The fact that the logs from both Gateway instances are interleaved in the same file took a bit of getting used to! I might change IBC to add something to the log entries to make clear which instance is logging each message.
The short answer to your question why Gateway shut down at 4pm on Saturday afternoon is proably just that, well, it's Saturday afternoon, and IBKR don't commit to continuity of sessions on Saturdays (because they often have maintenance work then). You absolutely cannot expect Gateway or TWS to sail though the weekend, and indeed you are required to shut them down completely at some point during Sunday (see https://www.ibkrguides.com/riskprofile/usersguidebook/configuretws/auto_restart_info.htm).
If you read the IBC User Guide you'll find quite a bit of guidance on ways to restart Gateway/TWS should they fail, for bith Linux and Windows. In practice this is rather unnecessary these days, because they are both very stable, though it still has its uses. This guidance is relevant to normal installations rather than Docker images. As I said, I'm not a Docker expert but I would imagine that Docker plus Kubernetes would be able to provide everything you need.
Below is a summary of what the logfile shows. Don't feel you need to follow it all, but I needed to do this to make sense of things:
autorestart
file which should contain the encrypted credentials needed to re-establish the login sessions actually do not contain valid credentials. The the login sessions cannot be automatically re-establ;ished, and so the IBC instances initiate full login requiring user id and password and (for the live instance) 2FA. This threw me and I'll have more to say about it belowI mentioned that IBC was reporting invalid restart login credentials for both live and paper Gateways, and I've spent hours today trying to work out what the cause of this is. And I was rather surprised that no-one has raised this before for the live Gateway since it would seem to imply a need to do a daily 2FA: but the fact that it did complete the re-login for your live instance makes me suspect that IBC is getting this wrong. I'll need to investigate this more thoroughly, which I'll do at the weekend (I can't upset my live sstem during the week).
I'm using IBC to run both a paper and live of IB Gateway using a docker package.
I noticed for some reason the paper Gateway shutdown and IBC did not restart it (at around 2:01 PM UTC). The Gateway for the live account is still running fine. I'm not sure why the paper Gateway shutdown. Restarting the container worked fine and both paper & live Gateways started fine. Here's the relevant logs (times are UTC):
My settings are:
The interesting part is that the exist status is 0. I believe this indicates a normal shutdown? Based on the ibstart.sh script, it appears that IBC does not attempt to restart Gateway if there's no autorestart file or exist status does not match certain codes.
Any idea why this happened? Also, what's the reason IBC does not attempt to restart Gateway in all cases?