-
Notifications
You must be signed in to change notification settings - Fork 100
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
read time out #1
Comments
Thanks for reporting the first issue on IBeam @seismars 🎉😄 From what you wrote I understand that you're running into the Could I ask you to provide us with a little more information first?
Thanks! |
Thanks for this program. I can see clear benefits to me if it work out. |
Fantastic, thanks for all that info! Looking forward to seeing more logs and we'll continue from there 👍 |
I'm running more tests, but I haven't encounter another 'read time out' issue again. Maybe my internet connection or server's response to requests are not bad at the moment. I will update later when I do encounter the same issue again, with the debug option turned on. However, I do encounter another issue. This time I did lost the connection to IBKR's gateway several times. My own program was periodically checking the connect with the gateway using the tickle endpoint. I had several encounters of loosing connection to the gateway. However, everything appeared to be fine on the Ibeam side: it continues to print out the Maintenance message every 60 seconds, without trying to authenticate again. I had to manually stop the ibeam and restart again in order to reconnect to IBKR. |
Thanks for more info. It may be indeed that a weak connection causes that issue you originally described. In such case, it seems like the error message indeed describes the issue at hand correctly - the request simply timing out (due to connectivity issues). Let me know if you encounter this issue again, would be great to read these logs then. As for the second problem you described - could I bother you to open a new issue for it and provide more details? Would love to get to the bottom of it and discover what is causing the discrepancy between IBeam and your client in regard to whether the gateway is authenticated. |
I will open a separate issue for the discrepancy. Here is the new time out issue again with the DEBUG option: |
Thanks for submitting this log, it's good to see the chronology of this error. You marked this issue as 'Enhancement', therefore do I understand well that you're suggesting catching the Given that this is a timeout error (as discussed earlier probably caused by network issues), the other solution I can think of now would be to make multiple validate attempts before going for reauthentication. However I wonder whether it would be better to be 'safe than sorry' and reauthenticate as soon as possible, in order to minimise trading downtime. I also think we could add information to the documentation regarding the two-factor authentication. |
Below are some of my thoughts:
Of course I'm only speaking for myself based on my own situation. I understanding it's your call as to how you want to better address the issue. |
Thanks for sharing your thoughts, very valuable. Indeed, having to do two-factor auth more often than needed is an unwanted behaviour. I can totally see where you're coming from. After reading your thoughts I realised that we can have an easy solution for this - we could introduce an environment variable defining how many times IBeam will attempt to validate before launching restart/reauthentication. This way each user could adjust the behaviour to their needs - if needed reauth as soon as possible, otherwise allow more slack. What's more, we could expose the request timeout value in the same way, increasing the customisability even more. Do I assume correctly this would help your case? |
It will definitely help. |
Fantastic, I'll go ahead with the following:
Thank you for highlighting this issue and working with me on the solution 🙌 Please feel free to suggest other improvements that might make this situation even better. I will update here once the patch is ready. |
Today is Friday Nov 13, 2020. |
Glad to hear :) Going ahead with a merge. Once again, thanks for your help! |
Implement support for reading Docker Secrets
I constantly encountered 'read operation timed out' issue. And when it occurs, the program thinks the gateway is not authenticated and will try to authenticate again. So I have to authenticate on my iPhone whenever it happens. If I didn't notice the request to authenticate on my iPhone the authentication process will fail. Is there a better handling for 'read time out'?
2020-11-08 02:32:54,672|E| The read operation timed out
Traceback (most recent call last):
File "/srv/ibeam/src/gateway_client.py", line 314, in _try_request
self._url_request(url)
File "/srv/ibeam/src/gateway_client.py", line 309, in _url_request
return urllib.request.urlopen(url, context=self._ssl_context, timeout=15)
File "/usr/local/lib/python3.7/urllib/request.py", line 222, in urlopen
return opener.open(url, data, timeout)
File "/usr/local/lib/python3.7/urllib/request.py", line 525, in open
response = self._open(req, data)
File "/usr/local/lib/python3.7/urllib/request.py", line 543, in _open
'_open', req)
File "/usr/local/lib/python3.7/urllib/request.py", line 503, in _call_chain
result = func(*args)
File "/usr/local/lib/python3.7/urllib/request.py", line 1362, in https_open
context=self._context, check_hostname=self._check_hostname)
File "/usr/local/lib/python3.7/urllib/request.py", line 1322, in do_open
r = h.getresponse()
File "/usr/local/lib/python3.7/http/client.py", line 1344, in getresponse
response.begin()
File "/usr/local/lib/python3.7/http/client.py", line 306, in begin
version, status, reason = self._read_status()
File "/usr/local/lib/python3.7/http/client.py", line 267, in _read_status
line = str(self.fp.readline(_MAXLINE + 1), "iso-8859-1")
File "/usr/local/lib/python3.7/socket.py", line 589, in readinto
return self._sock.recv_into(b)
File "/usr/local/lib/python3.7/ssl.py", line 1071, in recv_into
return self.read(nbytes, buffer)
File "/usr/local/lib/python3.7/ssl.py", line 929, in read
return self._sslobj.read(len, buffer)
socket.timeout: The read operation timed out
2020-11-08 02:32:54,673|I| Gateway not authenticated, authenticating...
2020-11-08 02:33:06,098|I| Authentication succeeded.
The text was updated successfully, but these errors were encountered: