ibeam: Timeout error in 0.4.4 version

Describe the bug This morning, after the update to voyz/ibeam:0.4.4, a local watchtower service restarted the IBeam, and it stopped authenticating with an error, which looks like a timeout. Please, take a look at the stack trace below, as I don’t know Python very well.

To Reproduce Steps to reproduce the behavior:

  1. Pull 0.4.4 docker image
  2. Start it

Expected behavior IBeam docker image works the same as before. I have tested quickly in the same environment with 0.4.3, and it worked just fine.

Environment IBeam version: 0.4.4 Docker image or standalone: docker OS: Ubuntu 22.04.2 LTS (GNU/Linux 5.15.0-71-generic x86_64) as a DigitalOcean droplet, check also on a local macOS machine

Additional context Logs:

logs
2023-05-16 07:55:39,965|I| ############ Starting IBeam version 0.4.4 ############
2023-05-16 07:55:39,975|I| Secrets source: env
2023-05-16 07:55:39,979|I| Health server started at port=5001
2023-05-16 07:55:39,979|I| Environment variable configuration:
{'INPUTS_DIR': '/srv/inputs/', 'OUTPUTS_DIR': '/srv/outputs', 'GATEWAY_DIR': '/srv/clientportal.gw', 'CHROME_DRIVER_PATH': '/usr/bin/chromedriver', 'GATEWAY_STARTUP': 20, 'GATEWAY_PROCESS_MATCH': 'ibgroup.web.core.clientportal.gw.GatewayStart', 'MAINTENANCE_INTERVAL': 60, 'SPAWN_NEW_PROCESSES': False, 'LOG_LEVEL': 'INFO', 'LOG_TO_FILE': True, 'LOG_FORMAT': '%(asctime)s|%(levelname)-.1s| %(message)s', 'REQUEST_RETRIES': 1, 'REQUEST_TIMEOUT': 15, 'RESTART_FAILED_SESSIONS': True, 'RESTART_WAIT': 15, 'IBEAM_HEALTH_SERVER_PORT': 5001, 'GATEWAY_BASE_URL': 'https://localhost:5000', 'ROUTE_AUTH': '/sso/Login?forwardTo=22&RL=1&ip2loc=on', 'ROUTE_USER': '/v1/api/one/user', 'ROUTE_VALIDATE': '/v1/portal/sso/validate', 'ROUTE_REAUTHENTICATE': '/v1/portal/iserver/reauthenticate?force=true', 'ROUTE_AUTH_STATUS': '/v1/api/iserver/auth/status', 'ROUTE_TICKLE': '/v1/api/tickle', 'ROUTE_LOGOUT': '/v1/api/logout', 'USER_NAME_EL': None, 'PASSWORD_EL': 'password', 'SUBMIT_EL': 'button.btn.btn-lg.btn-primary', 'ERROR_EL': None, 'SUCCESS_EL_TEXT': 'Client login succeeds', 'OAUTH_TIMEOUT': 30, 'PAGE_LOAD_TIMEOUT': 60, 'ERROR_SCREENSHOTS': False, 'MAX_FAILED_AUTH': 6, 'MAX_IMMEDIATE_ATTEMPTS': 10, 'IBKEY_PROMO_EL_CLASS': 'ibkey-promo-skip', 'TWO_FA_EL_ID': 'twofactbase', 'TWO_FA_NOTIFICATION_EL': 'login-step-notification', 'TWO_FA_INPUT_EL_ID': 'chlginput', 'TWO_FA_HANDLER': None, 'STRICT_TWO_FA_CODE': True, 'TWO_FA_SELECT_EL_ID': 'sf_select', 'TWO_FA_SELECT_TARGET': 'IB Key'}
2023-05-16 07:55:39,980|I| Gateway not found, starting new one...
2023-05-16 07:55:39,980|I| Note that the Gateway log below may display "Open https://localhost:5000 to login" - ignore this command.
2023-05-16 07:55:39,981|I| Starting Gateway as Linux process with params: ['bash', 'bin/run.sh', 'root/conf.yaml']
running
 runtime path : root:dist/ibgroup.web.core.iblink.router.clientportal.gw.jar:build/lib/runtime/*
 config file  : root/conf.yaml
2023-05-16 07:55:40,984|I| Gateway started with pid: 12
2023-05-16 07:55:40,987|I| Cannot ping Gateway. Retrying for another 20 seconds
2023-05-16 07:55:41,992|I| Cannot ping Gateway. Retrying for another 19 seconds
WARNING: An illegal reflective access operation has occurred
WARNING: Illegal reflective access by io.netty.util.internal.ReflectionUtil (file:/srv/clientportal.gw/build/lib/runtime/netty-common-4.1.15.Final.jar) to constructor java.nio.DirectByteBuffer(long,int)
WARNING: Please consider reporting this to the maintainers of io.netty.util.internal.ReflectionUtil
WARNING: Use --illegal-access=warn to enable warnings of further illegal reflective access operations
WARNING: All illegal access operations will be denied in a future release
2023-05-16 07:55:42,995|I| Cannot ping Gateway. Retrying for another 18 seconds
 -> mount demo on /demo
Java Version: 11.0.18
****************************************************
version: 485dc2d762781c4ff3954ac4fb66a9469a1405f7 Mon, 20 Mar 2023 14:39:35 -0400
****************************************************
This is the Client Portal Gateway
for any issues, please contact api@ibkr.com
and include a copy of your logs
****************************************************
https://www.interactivebrokers.com/api/doc.html
****************************************************
Open https://localhost:5000 to login
App demo is available after you login under: https://localhost:5000/demo#/
2023-05-16 07:55:45,650|I| Gateway connection established
2023-05-16 07:55:45,983|I| No active sessions, logging in...
2023-05-16 07:55:45,985|I| Loading auth webpage at https://localhost:5000/sso/Login?forwardTo=22&RL=1&ip2loc=on
2023-05-16 07:55:47,264|E| Error encountered during authentication
Traceback (most recent call last):
  File "/srv/ibeam/src/authenticate.py", line 243, in authenticate_gateway
    driver = start_driver(base_url, driver_path)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/srv/ibeam/src/authenticate.py", line 432, in start_driver
    driver = new_chrome_driver(driver_path)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/srv/ibeam/src/authenticate.py", line 64, in new_chrome_driver
    driver = webdriver.Chrome(driver_path, options=options)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/venv/lib/python3.11/site-packages/selenium/webdriver/chrome/webdriver.py", line 76, in __init__
    RemoteWebDriver.__init__(
  File "/opt/venv/lib/python3.11/site-packages/selenium/webdriver/remote/webdriver.py", line 157, in __init__
    self.start_session(capabilities, browser_profile)
  File "/opt/venv/lib/python3.11/site-packages/selenium/webdriver/remote/webdriver.py", line 252, in start_session
    response = self.execute(Command.NEW_SESSION, parameters)
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/venv/lib/python3.11/site-packages/selenium/webdriver/remote/webdriver.py", line 319, in execute
    response = self.command_executor.execute(driver_command, params)
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/venv/lib/python3.11/site-packages/selenium/webdriver/remote/remote_connection.py", line 374, in execute
    return self._request(command_info[0], url, body=data)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/venv/lib/python3.11/site-packages/selenium/webdriver/remote/remote_connection.py", line 397, in _request
    resp = self._conn.request(method, url, body=body, headers=headers)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/venv/lib/python3.11/site-packages/urllib3/_request_methods.py", line 118, in request
    return self.request_encode_body(
           ^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/venv/lib/python3.11/site-packages/urllib3/_request_methods.py", line 217, in request_encode_body
    return self.urlopen(method, url, **extra_kw)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/venv/lib/python3.11/site-packages/urllib3/poolmanager.py", line 422, in urlopen
    conn = self.connection_from_host(u.host, port=u.port, scheme=u.scheme)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/venv/lib/python3.11/site-packages/urllib3/poolmanager.py", line 303, in connection_from_host
    return self.connection_from_context(request_context)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/venv/lib/python3.11/site-packages/urllib3/poolmanager.py", line 328, in connection_from_context
    return self.connection_from_pool_key(pool_key, request_context=request_context)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/venv/lib/python3.11/site-packages/urllib3/poolmanager.py", line 351, in connection_from_pool_key
    pool = self._new_pool(scheme, host, port, request_context=request_context)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/venv/lib/python3.11/site-packages/urllib3/poolmanager.py", line 265, in _new_pool
    return pool_cls(host, port, **request_context)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/venv/lib/python3.11/site-packages/urllib3/connectionpool.py", line 196, in __init__
    timeout = Timeout.from_float(timeout)
              ^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/venv/lib/python3.11/site-packages/urllib3/util/timeout.py", line 190, in from_float
    return Timeout(read=timeout, connect=timeout)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/venv/lib/python3.11/site-packages/urllib3/util/timeout.py", line 119, in __init__
    self._connect = self._validate_timeout(connect, "connect")
                    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/venv/lib/python3.11/site-packages/urllib3/util/timeout.py", line 156, in _validate_timeout
    raise ValueError(
ValueError: Timeout value connect was <object object at 0x7f9f97ef47e0>, but it must be an int, float or None.
The above exception was the direct cause of the following exception:
Traceback (most recent call last):
  File "/srv/ibeam/src/authenticate.py", line 412, in authenticate_gateway
    raise RuntimeError('Error encountered during authentication') from e
RuntimeError: Error encountered during authentication
2023-05-16 07:55:47,274|I| Cleaning up the resources. Display: <pyvirtualdisplay.display.Display object at 0x7f9f9798a310> | Driver: None
2023-05-16 07:55:47,288|I| Authentication process failed

About this issue

  • Original URL
  • State: closed
  • Created a year ago
  • Reactions: 3
  • Comments: 55 (24 by maintainers)

Most upvoted comments

I’m also seeing what appears to be a timeout of some sort using the 0.4.4 release (not the latest fixes)

Attaching to ibeam
ibeam    | WARNING: Use --illegal-access=warn to enable warnings of further illegal reflective access operations
ibeam    | WARNING: All illegal access operations will be denied in a future release
ibeam    | 2023-05-17 23:01:09,769|I| Gateway started with pid: 13
ibeam    | 2023-05-17 23:01:09,772|I| Cannot ping Gateway. Retrying for another 20 seconds
ibeam    |  -> mount demo on /demo
ibeam    | Java Version: 11.0.18
ibeam    | ****************************************************
ibeam    | version: 485dc2d762781c4ff3954ac4fb66a9469a1405f7 Mon, 20 Mar 2023 14:39:35 -0400
ibeam    | ****************************************************
ibeam    | This is the Client Portal Gateway
ibeam    | for any issues, please contact api@ibkr.com
ibeam    | and include a copy of your logs
ibeam    | ****************************************************
ibeam    | https://www.interactivebrokers.com/api/doc.html
ibeam    | ****************************************************
ibeam    | Open https://localhost:5000 to login
ibeam    | App demo is available after you login under: https://localhost:5000/demo#/
ibeam    | 2023-05-17 23:01:11,464|I| Gateway connection established
ibeam    | 2023-05-17 23:01:11,706|I| No active sessions, logging in...
ibeam    | 2023-05-17 23:01:11,706|I| Loading auth webpage at https://localhost:5000/sso/Login?forwardTo=22&RL=1&ip2loc=on
ibeam    | 2023-05-17 23:01:12,798|E| Error encountered during authentication
ibeam    | Traceback (most recent call last):
ibeam    |   File "/srv/ibeam/src/authenticate.py", line 243, in authenticate_gateway
ibeam    | 2023-05-17 23:01:12,811|I| Authentication process failed
ibeam    | 2023-05-17 23:01:12,816|I| Starting maintenance with interval 60 seconds
ibeam    | 2023-05-17 23:02:12,817|I| Maintenance
ibeam    | 2023-05-17 23:02:13,796|I| No active sessions, logging in...
ibeam    | 2023-05-17 23:02:13,797|I| Loading auth webpage at https://localhost:5000/sso/Login?forwardTo=22&RL=1&ip2loc=on
ibeam    | 2023-05-17 23:02:14,888|E| Error encountered during authentication
ibeam    | Traceback (most recent call last):
ibeam    |   File "/srv/ibeam/src/authenticate.py", line 243, in authenticate_gateway
ibeam    |     driver = start_driver(base_url, driver_path)
ibeam    |              ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
ibeam    |   File "/srv/ibeam/src/authenticate.py", line 432, in start_driver
ibeam    |     driver = new_chrome_driver(driver_path)
ibeam    |              ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
ibeam    |   File "/srv/ibeam/src/authenticate.py", line 64, in new_chrome_driver
ibeam    |     driver = webdriver.Chrome(driver_path, options=options)
ibeam    |              ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
ibeam    |   File "/opt/venv/lib/python3.11/site-packages/selenium/webdriver/chrome/webdriver.py", line 76, in __init__
ibeam    |     RemoteWebDriver.__init__(
ibeam    |   File "/opt/venv/lib/python3.11/site-packages/selenium/webdriver/remote/webdriver.py", line 157, in __init__
ibeam    |     self.start_session(capabilities, browser_profile)
ibeam    |   File "/opt/venv/lib/python3.11/site-packages/selenium/webdriver/remote/webdriver.py", line 252, in start_session
ibeam    |     response = self.execute(Command.NEW_SESSION, parameters)
ibeam    |                ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
ibeam    |   File "/opt/venv/lib/python3.11/site-packages/selenium/webdriver/remote/webdriver.py", line 319, in execute
ibeam    |     response = self.command_executor.execute(driver_command, params)
ibeam    |                ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
ibeam    |   File "/opt/venv/lib/python3.11/site-packages/selenium/webdriver/remote/remote_connection.py", line 374, in execute
ibeam    |     return self._request(command_info[0], url, body=data)
ibeam    |            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
ibeam    |   File "/opt/venv/lib/python3.11/site-packages/selenium/webdriver/remote/remote_connection.py", line 397, in _request
ibeam    |     resp = self._conn.request(method, url, body=body, headers=headers)
ibeam    |            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
ibeam    |   File "/opt/venv/lib/python3.11/site-packages/urllib3/_request_methods.py", line 118, in request
ibeam    |     return self.request_encode_body(
ibeam    |            ^^^^^^^^^^^^^^^^^^^^^^^^^
ibeam    |   File "/opt/venv/lib/python3.11/site-packages/urllib3/_request_methods.py", line 217, in request_encode_body
ibeam    |     return self.urlopen(method, url, **extra_kw)
ibeam    |            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
ibeam    |   File "/opt/venv/lib/python3.11/site-packages/urllib3/poolmanager.py", line 422, in urlopen
ibeam    |     conn = self.connection_from_host(u.host, port=u.port, scheme=u.scheme)
ibeam    |            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
ibeam    |   File "/opt/venv/lib/python3.11/site-packages/urllib3/poolmanager.py", line 303, in connection_from_host
ibeam    |     return self.connection_from_context(request_context)
ibeam    |            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
ibeam    |   File "/opt/venv/lib/python3.11/site-packages/urllib3/poolmanager.py", line 328, in connection_from_context
ibeam    |     return self.connection_from_pool_key(pool_key, request_context=request_context)
ibeam    |            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
ibeam    |   File "/opt/venv/lib/python3.11/site-packages/urllib3/poolmanager.py", line 351, in connection_from_pool_key
ibeam    |     pool = self._new_pool(scheme, host, port, request_context=request_context)
ibeam    |            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
ibeam    |   File "/opt/venv/lib/python3.11/site-packages/urllib3/poolmanager.py", line 265, in _new_pool
ibeam    |     return pool_cls(host, port, **request_context)
ibeam    |            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
ibeam    |   File "/opt/venv/lib/python3.11/site-packages/urllib3/connectionpool.py", line 196, in __init__
ibeam    |     timeout = Timeout.from_float(timeout)
ibeam    |               ^^^^^^^^^^^^^^^^^^^^^^^^^^^
ibeam    |   File "/opt/venv/lib/python3.11/site-packages/urllib3/util/timeout.py", line 190, in from_float
ibeam    |     return Timeout(read=timeout, connect=timeout)
ibeam    |            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
ibeam    |   File "/opt/venv/lib/python3.11/site-packages/urllib3/util/timeout.py", line 119, in __init__
ibeam    |     self._connect = self._validate_timeout(connect, "connect")
ibeam    |                     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
ibeam    |   File "/opt/venv/lib/python3.11/site-packages/urllib3/util/timeout.py", line 156, in _validate_timeout
ibeam    |     raise ValueError(
ibeam    | ValueError: Timeout value connect was <object object at 0x7fac7de54590>, but it must be an int, float or None.
ibeam    | 
ibeam    | The above exception was the direct cause of the following exception:
ibeam    | 
ibeam    | Traceback (most recent call last):
ibeam    |   File "/srv/ibeam/src/authenticate.py", line 412, in authenticate_gateway
ibeam    |     raise RuntimeError('Error encountered during authentication') from e
ibeam    | RuntimeError: Error encountered during authentication
ibeam    | 2023-05-17 23:02:14,891|I| Cleaning up the resources. Display: <pyvirtualdisplay.display.Display object at 0x7fac7c46fbd0> | Driver: None
ibeam    | 2023-05-17 23:02:14,902|I| Authentication process failed

After that, it seems to get stuck in a loop…

ibeam    | 2023-05-17 23:03:12,818|I| Maintenance
ibeam    | 2023-05-17 23:03:13,027|I| No active sessions, logging in...
ibeam    | 2023-05-17 23:03:13,028|I| Loading auth webpage at https://localhost:5000/sso/Login?forwardTo=22&RL=1&ip2loc=on
ibeam    | 2023-05-17 23:03:14,117|E| Error encountered during authentication
ibeam    | Traceback (most recent call last):
ibeam    |   File "/srv/ibeam/src/authenticate.py", line 243, in authenticate_gateway
ibeam    |              ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
ibeam    |   File "/srv/ibeam/src/authenticate.py", line 432, in start_driver
ibeam    |     driver = new_chrome_driver(driver_path)
ibeam    |              ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
ibeam    |   File "/opt/venv/lib/python3.11/site-packages/selenium/webdriver/remote/webdriver.py", line 319, in execute
ibeam    |     response = self.command_executor.execute(driver_command, params)
ibeam    |     conn = self.connection_from_host(u.host, port=u.port, scheme=u.scheme)
ibeam    |            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
ibeam    |     pool = self._new_pool(scheme, host, port, request_context=request_context)
ibeam    |            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
ibeam    |   File "/opt/venv/lib/python3.11/site-packages/urllib3/poolmanager.py", line 265, in _new_pool
ibeam    | The above exception was the direct cause of the following exception:
ibeam    | 
ibeam    | Traceback (most recent call last):
ibeam    | 2023-05-17 23:03:14,128|I| Authentication process failed

@Voyz Starting this morning i had timeout issues Timeout reached when waiting for authentication. Consider increasing IBEAM_PAGE_LOAD_TIMEOUT. I’ve previously used 0.4.0 for ages now and just upgraded to latest. issue has resolved now image

Didn’t look deeper in what you changed but thanks, works for me now.

@vldmarton many thanks for sharing this here. This bit got my curiosity

It is a common occurrence to log in twice as the initial login will terminate any previously active session and during the second login, you can proceed with the login process as you typically would.

I don’t quite understand it, I’ve got two interpretations of this. Give a 👍 or 👎 if you believe it’s the former or the latter.

👍 Does it mean that logging in twice will somehow log us out? 👎 Or do they recommend for us to be logging in twice?

When the maintenance schedule is running, do you only call /tickle endpoint or also /sso/validate?

Only tickle. They previously said we need to run only one of these endpoints. The docs only speaks of tickle:

A Client Portal API brokerage session will timeout if no requests are received within a period of 5 minutes. In order to prevent the session from timing out, the endpoint /tickle should be called on a regular basis. It is recommended to call this endpoint approximately every minute.

In either case, not sure how calling validate would help. Am I missing something where this could be useful? I’m thinking that when things go badly, the result of tickle is irrelevant anyway, as the biggest issues come from their servers telling us that Client login succeeds indicating a successful login, but then the authenticate still is false, or receiving the 503, or the 2FA resulting in failed for no clear reason. But that’s just my take; point it out if I’m not seeing some application of calling /sso/validate.

I actually asked them about the 1-8 nodes as well and interestingly they did not respond to that. From the response, it seems like the repetitive authentication (even if it’s 10 times in a row) is an expected behavior 🤣

Yeah… I wouldn’t really have much to comment on this 🤷‍♂️😔

@Voyz Yes, definitely, the issue has been solved. Thank you!

You’re absolutely right.

IBKR has multiple products (TWS, API, mobile app, client portal). Judging by the appearance of TWS, it’s very possible that the legacy code (the absolute core - session handling included) is about a 100 years old and would be too hard to rewrite (modernize) in such a way where all of those products would still work. At the same time, creating a modernized version of the core and a modernized version of all of the products would be equally hard (and expensive) and clearly IBKR is holding onto the “if it ain’t broke don’t fix it” methodology.

Although, I’ve read somewhere that they’re developing a new desktop application, which should replace TWS in the future. So there’s little hope. Of course, it depends on what they decide to do, because they can still build it on the top of the same, old legacy code.

Okay, so it looks like the random skipped scheduler runs are not caused by the ibeam code, but rather by my Mac.

Interesting! Can you share how did you figure that out?

After it has happened multiple times during the same test run, I kind of just noticed that it happens when I don’t use my computer for a longer period of time (20-30 minutes). I have sleep mode (and all other optimizations) turned off, I did that specifically to do this test, but still, it was happening, and it was only happening when I was away from my laptop.

I will test it on a linux server some time in the near future,

That’s a good idea, keep us posted

I’ve been extremely busy lately so I still didn’t have time for it yet, but I hope I can get back to it as soon as possible.

@Voyz Sorry for the long no reply. I can confirm that the latest version works fine on both machines. Thanks a lot for the fix 🎉

Great to see you tried this. Let us know what they say.

Hey @Voyz , so they actually got back to me on 26th but I didn’t receive any notification, so I didn’t know about it. Here’s my question (in a nutshell) that I’ve sent to them:

I'm using client portal API gateway to do trades on my account. I have no issues 
starting the gateway, logging in also works fine, and I'm able to obtain gateway 
session without any issues. Although, after logging in, the response from API 
gateway endpoint /iserver/auth/status contains - "authenticated": false - and 
I'm not able to do any actions with my account.

I got this response back:

You can consider doing following steps to resolve the issue.

1. If another Brokerage session is already active ( For instance : TWS-API, Client portal WEB-API or any other platform ).
It is a common occurrence to log in twice as the initial login will terminate any previously active session and during the second login, you can proceed with the login process as you typically would.

2. Try endpoint "/logout" and endpoint "/reauthenticate" several times to achieve the Authenticated: true.

3. in order to maintain an active session, it is crucial to continually invoke the endpoint "/tickle" and endpoint "/sso/validate" every 2-3 minute.

Right, so I’m assuming that you already do the step 2 based on the logs that appear in container console. How about step 3? When the maintenance schedule is running, do you only call /tickle endpoint or also /sso/validate?

EDIT: I actually asked them about the 1-8 nodes as well and interestingly they did not respond to that. From the response, it seems like the repetitive authentication (even if it’s 10 times in a row) is an expected behavior 🤣

I tried to check versions of packages installed in the image - this is the output:

Yes, that seems to be fine. We don’t use chrome anymore, we use chromium. And when you try to launch it from the container it complains about not being able to connect to a display, which sounds fine to me.

root@ffea9bd21020:/srv/ibeam# chromium --no-sandbox
[167:167:0524/155236.915464:ERROR:browser_main_loop.cc(1386)] Unable to open X display.

Can you fire up a container on your side please and let me know if you get the same output?

I’m getting a similar output, but I also am getting similar output on 0.4.3. I’d say this is expected behaviour.

I’m seeing the following on 0.4.3:

root@ffea9bd21020:/srv/ibeam# chromium --version
Chromium 90.0.4430.212 built on Debian 10.9, running on Debian 10.4
root@ffea9bd21020:/srv/ibeam# chromedriver --version
ChromeDriver 90.0.4430.212 (e3cd97fc771b893b7fd1879196d1215b622c2bed-refs/branch-heads/4430@{#1429})

And on 0.4.4:

root@32e8f901ac2e:/srv/ibeam# chromium --version
find: ‘/root/.config/chromium/Crash Reports/pending/’: No such file or directory
Chromium 113.0.5672.126 built on Debian 11.7, running on Debian 11.7
root@32e8f901ac2e:/srv/ibeam# chromedriver --version
ChromeDriver 113.0.5672.126 (c541687b21a73452ab403e2dced7033ddc97ee9d-refs/branch-heads/5672@{#1202})

I suppose one indication that things aren’t right is that on your machine the chromium --version produced the Error: Can't open display:.

Maybe a support ticket would be the number one thing to do,

Great to see you tried this. Let us know what they say.

TLDR: Do not rely on the /iserver/auth/status (docs) endpoint to return authenticated: true,

Right, I can see that, great digging 👍

Seeing that this is from an unofficial source and quite speculative, I’m not sure whether this would be a methodology we’d want to follow. My thoughts are:

  • the API docs state a contradictory thing, and it’s generally a good idea to use these as the source of truth. I can see the benefit of ignoring it here, but there’s an argument here that we should expect this endpoint to work.
  • the authenticated:false returns false for some reason. I’d be worried that potentially some endpoints would work and some wouldn’t, and we couldn’t guarantee whether it’s one or the other.
  • I sort of prefer a system that is more binary in that sense. We either have 100% confidence that we’re authenticated, or we have 0% confidence and have to reauthenticate - even if it means looping over and over. To have this ‘sorta unauthenticated, but maybe yes, so let’s see if it works’ state would not feel quite right.

I’d feel that prompting IBKR to fix things would be the right way to go here.

Eventually it worked 🤷‍♂️

ibeam    | 2023-05-18 22:58:07,495|I| Gateway running and authenticated

Gotcha, thanks for confirming. I’m still gutted it’s breaking up on your dev station. Let me know if I can help you brainstorm about this.

Just FYI - I’ve pushed master branch, so it now has those most recent fixes in case you’d be interested in pulling and fixing things first hand.