Closed thisIsLoading closed 1 year ago
0.4.5-rc2 seems to fix that but introduces a authentication loop(?)
2023-05-21 13:18:46,900|I| ############ Starting IBeam version 0.4.5-rc1 ############
2023-05-21T13:18:46.902567171Z 2023-05-21 13:18:46,902|I| Secrets source: env
2023-05-21T13:18:46.903228383Z 2023-05-21 13:18:46,903|I| Health server started at port=5001
2023-05-21T13:18:46.903296772Z 2023-05-21 13:18:46,903|I| Environment variable configuration:
2023-05-21T13:18:46.903314466Z {'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': 15, 'PAGE_LOAD_TIMEOUT': 15, 'ERROR_SCREENSHOTS': False, 'MAX_FAILED_AUTH': 5, '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-21T13:18:46.903635393Z 2023-05-21 13:18:46,903|I| Gateway not found, starting new one...
2023-05-21T13:18:46.903678736Z 2023-05-21 13:18:46,903|I| Note that the Gateway log below may display "Open https://localhost:5000 to login" - ignore this command.
2023-05-21T13:18:46.903734671Z 2023-05-21 13:18:46,903|I| Starting Gateway as Linux process with params: ['bash', 'bin/run.sh', 'root/conf.yaml']
2023-05-21T13:18:46.907963087Z running
2023-05-21T13:18:46.907986922Z runtime path : root:dist/ibgroup.web.core.iblink.router.clientportal.gw.jar:build/lib/runtime/*
2023-05-21T13:18:46.907991361Z config file : root/conf.yaml
2023-05-21T13:18:47.178661549Z WARNING: An illegal reflective access operation has occurred
2023-05-21T13:18:47.178690304Z 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)
2023-05-21T13:18:47.178693099Z WARNING: Please consider reporting this to the maintainers of io.netty.util.internal.ReflectionUtil
2023-05-21T13:18:47.178695063Z WARNING: Use --illegal-access=warn to enable warnings of further illegal reflective access operations
2023-05-21T13:18:47.178696866Z WARNING: All illegal access operations will be denied in a future release
2023-05-21T13:18:47.329919535Z -> mount demo on /demo
2023-05-21T13:18:47.337997940Z Java Version: 11.0.18
2023-05-21T13:18:47.338019261Z ****************************************************
2023-05-21T13:18:47.338037545Z version: 485dc2d762781c4ff3954ac4fb66a9469a1405f7 Mon, 20 Mar 2023 14:39:35 -0400
2023-05-21T13:18:47.338044078Z ****************************************************
2023-05-21T13:18:47.338064176Z This is the Client Portal Gateway
2023-05-21T13:18:47.338082050Z for any issues, please contact api@ibkr.com
2023-05-21T13:18:47.338090856Z and include a copy of your logs
2023-05-21T13:18:47.338108520Z ****************************************************
2023-05-21T13:18:47.338132515Z https://www.interactivebrokers.com/api/doc.html
2023-05-21T13:18:47.338140741Z ****************************************************
2023-05-21T13:18:47.338174956Z Open https://localhost:5000 to login
2023-05-21T13:18:47.338195334Z App demo is available after you login under: https://localhost:5000/demo#/
2023-05-21T13:18:47.905037924Z 2023-05-21 13:18:47,904|I| Gateway started with pid: 13
2023-05-21T13:18:49.121062731Z 2023-05-21 13:18:49,120|I| Gateway connection established
2023-05-21T13:18:49.636231549Z 2023-05-21 13:18:49,636|I| No active sessions, logging in...
2023-05-21T13:18:49.636267938Z 2023-05-21 13:18:49,636|I| Loading auth webpage at https://localhost:5000/sso/Login?forwardTo=22&RL=1&ip2loc=on
2023-05-21T13:18:55.126600661Z 2023-05-21 13:18:55,126|I| Gateway auth webpage loaded
2023-05-21T13:18:55.126649233Z 2023-05-21 13:18:55,126|I| Login attempt number 1
2023-05-21T13:19:00.243496893Z 2023-05-21 13:19:00,243|I| Submitting the form
2023-05-21T13:19:01.913134667Z 2023-05-21 13:19:01,913|I| Webpage displayed "Client login succeeds"
2023-05-21T13:19:03.913423740Z 2023-05-21 13:19:03,913|I| Cleaning up the resources. Display: <pyvirtualdisplay.display.Display object at 0x7f9999c32f50> | Driver: <selenium.webdriver.chrome.webdriver.WebDriver (session="ae3101405df6d31af168ae3fad262920")>
2023-05-21T13:19:03.995790906Z 2023-05-21 13:19:03,995|I| Authentication process succeeded
2023-05-21T13:19:07.469798240Z 2023-05-21 13:19:07,469|E| Gateway session active but not authenticated
2023-05-21T13:19:07.469835630Z 2023-05-21 13:19:07,469|I| Logging out and restarting the Gateway
2023-05-21T13:19:07.958406329Z 2023-05-21 13:19:07,958|I| Gateway logout successful
2023-05-21T13:19:08.444244420Z 2023-05-21 13:19:08,444|I| Gateway session found but not authenticated, authenticating...
2023-05-21T13:19:08.444286109Z 2023-05-21 13:19:08,444|I| Loading auth webpage at https://localhost:5000/sso/Login?forwardTo=22&RL=1&ip2loc=on
2023-05-21T13:19:13.061593099Z 2023-05-21 13:19:13,061|I| Gateway auth webpage loaded
2023-05-21T13:19:13.061622484Z 2023-05-21 13:19:13,061|I| Login attempt number 1
2023-05-21T13:19:18.140280332Z 2023-05-21 13:19:18,140|I| Submitting the form
2023-05-21T13:19:20.193602024Z 2023-05-21 13:19:20,193|I| Webpage displayed "Client login succeeds"
2023-05-21T13:19:22.193910990Z 2023-05-21 13:19:22,193|I| Cleaning up the resources. Display: <pyvirtualdisplay.display.Display object at 0x7f9999c4aed0> | Driver: <selenium.webdriver.chrome.webdriver.WebDriver (session="f5d88e8edc8e0d5a3d523b91dc1f06af")>
2023-05-21T13:19:22.237184902Z 2023-05-21 13:19:22,237|I| Authentication process succeeded
2023-05-21T13:19:25.705098442Z 2023-05-21 13:19:25,704|E| Gateway session active but not authenticated
2023-05-21T13:19:25.705138989Z 2023-05-21 13:19:25,705|I| Logging out and restarting the Gateway
2023-05-21T13:19:26.172520596Z 2023-05-21 13:19:26,172|I| Gateway logout successful
2023-05-21T13:19:27.608216482Z 2023-05-21 13:19:27,608|I| Gateway session found but not authenticated, authenticating...
2023-05-21T13:19:27.608245808Z 2023-05-21 13:19:27,608|I| Loading auth webpage at https://localhost:5000/sso/Login?forwardTo=22&RL=1&ip2loc=on
2023-05-21T13:19:32.157488003Z 2023-05-21 13:19:32,157|I| Gateway auth webpage loaded
2023-05-21T13:19:32.157587852Z 2023-05-21 13:19:32,157|I| Login attempt number 1
I thought I was going insane. Have a VNet to run my software and was triple checking my network outbound/inbound rules and port mappings.
Seems issue is also present using latest on Azure.
2023-05-22 05:09:13,975|I| Loading auth webpage at https://localhost:5000/sso/Login?forwardTo=22&RL=1&ip2loc=on 2023-05-22 05:09:15,043|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 0x7f24e7ca87e0>, 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-22 05:09:15,047|I| Cleaning up the resources. Display: <pyvirtualdisplay.display.Display object at 0x7f24e63b1ed0> | Driver: None 2023-05-22 05:09:15,052|I| Authentication process failed
Using Linux Azure Container Instance
Name
ibeam
Image
voyz/ibeam
Ports
5000, 5001
CPU cores
1
Memory
1.5 GiB
GPU SKU
None
GPU count
0
Commands
(no commands)
Unfortunately I can't reproduce this on my M2 Pro MBP using Docker Desktop. On Mac, port 5000 is reserved, so I've remapped to 5001 & 5002.
version: "3.4"
services:
ibeam:
image: voyz/ibeam
container_name: ibeam
env_file:
- env.list
ports:
- 5001:5000
- 5002:5001
network_mode: bridge # Required due to clientportal.gw IP whitelist
restart: 'no' # Prevents IBEAM_MAX_FAILED_AUTH from being exceeded
EDIT: I forced the image to be voyz/ibeam:0.4.5-rc2
Authentication seems to work but it's acting a bit strange:
2023-05-22 05:51:41,180|I| Gateway auth webpage loaded 2023-05-22 05:51:41,181|I| Login attempt number 1 2023-05-22 05:51:46,431|I| Submitting the form 2023-05-22 05:51:47,267|I| Webpage displayed "Client login succeeds" 2023-05-22 05:51:49,268|I| Cleaning up the resources. Display: <pyvirtualdisplay.display.Display object at 0x7fa9b6665390> | Driver: <selenium.webdriver.chrome.webdriver.WebDriver (session="05a51efbe8c70b3c5f8d98dd5b1d24f6")> 2023-05-22 05:51:49,337|I| Authentication process succeeded 2023-05-22 05:51:52,516|E| Gateway session active but not authenticated 2023-05-22 05:51:52,517|I| Logging out and restarting the Gateway 2023-05-22 05:51:52,677|I| Gateway logout successful 2023-05-22 05:51:52,772|I| Gateway session found but not authenticated, authenticating... 2023-05-22 05:51:52,773|I| Loading auth webpage at https://localhost:5000/sso/Login?forwardTo=22&RL=1&ip2loc=on 2023-05-22 05:51:55,217|I| Gateway auth webpage loaded 2023-05-22 05:51:55,218|I| Login attempt number 1 2023-05-22 05:52:00,486|I| Submitting the form 2023-05-22 05:52:01,311|I| Webpage displayed "Client login succeeds" 2023-05-22 05:52:03,311|I| Cleaning up the resources. Display: <pyvirtualdisplay.display.Display object at 0x7fa9b6664550> | Driver: <selenium.webdriver.chrome.webdriver.WebDriver (session="b778cfea8bbbf2a1adb0723efaf48052")> 2023-05-22 05:52:03,366|I| Authentication process succeeded 2023-05-22 05:52:06,472|I| Gateway running and authenticated. 2023-05-22 05:52:06,478|I| Starting maintenance with interval 60 seconds 2023-05-22 05:53:06,479|I| Maintenance 2023-05-22 05:53:06,582|I| Gateway session found but not authenticated, authenticating... 2023-05-22 05:53:06,583|I| Loading auth webpage at https://localhost:5000/sso/Login?forwardTo=22&RL=1&ip2loc=on 2023-05-22 05:53:09,065|I| Gateway auth webpage loaded 2023-05-22 05:53:09,065|I| Login attempt number 1 2023-05-22 05:53:14,323|I| Submitting the form 2023-05-22 05:53:15,108|I| Webpage displayed "Client login succeeds" 2023-05-22 05:53:17,109|I| Cleaning up the resources. Display: <pyvirtualdisplay.display.Display object at 0x7fa9b667d790> | Driver: <selenium.webdriver.chrome.webdriver.WebDriver (session="84d5caade73fae7aaca58f0e6825aff1")> 2023-05-22 05:53:17,166|I| Authentication process succeeded 2023-05-22 05:53:20,287|E| Gateway session active but not authenticated 2023-05-22 05:53:20,287|I| Logging out and restarting the Gateway 2023-05-22 05:53:20,377|I| Gateway logout successful 2023-05-22 05:53:20,504|I| Gateway session found but not authenticated, authenticating... 2023-05-22 05:53:20,505|I| Loading auth webpage at https://localhost:5000/sso/Login?forwardTo=22&RL=1&ip2loc=on 2023-05-22 05:53:22,616|I| Gateway auth webpage loaded 2023-05-22 05:53:22,616|I| Login attempt number 1 2023-05-22 05:53:27,848|I| Submitting the form 2023-05-22 05:53:28,857|I| Webpage displayed "Client login succeeds" 2023-05-22 05:53:30,858|I| Cleaning up the resources. Display: <pyvirtualdisplay.display.Display object at 0x7fa9b68ba450> | Driver: <selenium.webdriver.chrome.webdriver.WebDriver (session="9ce452fe151699fee450df8d12a64c02")> 2023-05-22 05:53:30,905|I| Authentication process succeeded 2023-05-22 05:53:33,990|I| Gateway running and authenticated
No big issues here as everything works fine on my laptop. I'm just trying to deploy my trading strategy to Azure. Might just force v0.4.3 for now since the issue seems to be 0.4.4.
Hey @thisIsLoading many thanks for reporting this issue in so much detail 👍 It is the same issue that's described in #140 therefore I'm going to close this one. Nevertheless, thank you for reporting and providing all the info. Also thanks @demansou for sharing your experience.
Just to clarify:
0.4.5-rc2 seems to fix that but introduces a authentication loop(?)
hey @thisIsLoading and @demansou - there is a new WIP version v0.5.0
of IBeam that introduces a new login logic, which should help reduce some of the issues we've been struggling with.
Run the most recent voyz/ibeam:0.5.0-rc*
tag of v0.5.0 and set IBEAM_AUTHENTICATION_STRATEGY
to B
.
See #147 for more details and report any observations directly there.
Thanks 🙏
Thank you for the hard work! I've been stable with 0.4.5-rc2 so I'll try testing this next weekend!
Describe the bug fresh install, first start, was following the guide, results in:
To Reproduce Create a docker-compose.yml file with the following contents:
Create an env.list file in the same directory with the following contents:
Run the following command:
docker-compose up -d
Expected behavior A clear and concise description of what you expected to happen.
Environment IBeam version: 0.4.4 Docker image or standalone: voyz/ibeam OS: Manjaro Linux
Additional context n/a
Suggest a Fix n/a