Closed a-sharma11 closed 7 years ago
Some more context here: I have two docker containers here. 1st one is running a python flask app and the other one is a nodejs express server. They both talk to each other via docker linking. This worked great until i added uwsgi layer to my flask container.
I'm not a major contributor, but some advice for posting to Github in general.
If you add ``` before on the lines before and after your stack trace, it formats it as code and makes it easier to read.
Traceback (most recent call last):
File "/usr/local/lib/python3.5/dist-packages/requests/packages/urllib3/contrib/pyopenssl.py", line 436, in wrap_socket
cnx.do_handshake()
File "/usr/local/lib/python3.5/dist-packages/OpenSSL/SSL.py", line 1426, in do_handshake
self._raise_ssl_error(self._ssl, result)
File "/usr/local/lib/python3.5/dist-packages/OpenSSL/SSL.py", line 1167, in _raise_ssl_error
raise SysCallError(-1, "Unexpected EOF")
OpenSSL.SSL.SysCallError: (-1, 'Unexpected EOF')
Verse: Traceback (most recent call last): File "/usr/local/lib/python3.5/dist-packages/requests/packages/urllib3/contrib/pyopenssl.py", line 436, in wrap_socket cnx.do_handshake() File "/usr/local/lib/python3.5/dist-packages/OpenSSL/SSL.py", line 1426, in do_handshake self._raise_ssl_error(self._ssl, result) File "/usr/local/lib/python3.5/dist-packages/OpenSSL/SSL.py", line 1167, in _raise_ssl_error raise SysCallError(-1, "Unexpected EOF") OpenSSL.SSL.SysCallError: (-1, 'Unexpected EOF')
Hrm. This error has been caused by the remote peer shutting the connection in our face, causing us to see an EOF that we weren't previously expecting. What does your code look like? I suspect that you're encountering a problem with forking.
Thanks @Lukasa here is the code that failing
def get(self, token):
response = requests.get(self.url, auth=HTTPBasicAuth(token, ''))
response.raise_for_status()
user = response.json()
logger = get_logger(__name__, user)
logger.info("User token is good.")
return user
Hrm, there is no global state here. You're confident that self.url
is exactly the same each time? Can you add a print statement to your code to print it each time just to confirm it's identical?
@Lukasa Yes it should be the same in this case(hardcoded shown below). Also I made one simple request using postman which should have only triggered this once and got the same error.
self.url = base_url + "/api/platform/v1/session"
and base_url
is const and in this case name of the other linked container
Turned out i was trying to connect using https when the other server only support http. Sorry about creating this confusion. Everything works great now....maybe a better error message would be nice to have.
i have a flask application that need to get some data from other web endpoints. I am getting this error when trying to make a get call using requests Note - This only happens when running with uWSGI. if i run flask app directly, it works fine.