Skip to content
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

Cannot connect to host #181

Closed
nkorth opened this issue Nov 8, 2015 · 9 comments
Closed

Cannot connect to host #181

nkorth opened this issue Nov 8, 2015 · 9 comments

Comments

@nkorth
Copy link

nkorth commented Nov 8, 2015

I signed into hangups, it said "Connecting...", and then it threw the following exception. This occurred with both my normal Google account and my Google Apps account (I deleted the token file to test the other). The Chrome Hangouts app works fine on this computer/network. I'm using OS X 10.10.3 and Python 3.4.2 (installed through Homebrew).

Traceback (most recent call last):
  File "/usr/local/bin/hangups", line 9, in <module>
    load_entry_point('hangups==0.3.0', 'console_scripts', 'hangups')()
  File "/usr/local/lib/python3.4/site-packages/hangups/ui/__main__.py", line 897, in main
    }, COL_SCHEMES[args.col_scheme], args.disable_notifications)
  File "/usr/local/lib/python3.4/site-packages/hangups/ui/__main__.py", line 80, in __init__
    loop.run_until_complete(self._client.connect())
  File "/usr/local/Cellar/python3/3.4.2_1/Frameworks/Python.framework/Versions/3.4/lib/python3.4/asyncio/base_events.py", line 268, in run_until_complete
    return future.result()
  File "/usr/local/Cellar/python3/3.4.2_1/Frameworks/Python.framework/Versions/3.4/lib/python3.4/asyncio/futures.py", line 277, in result
    raise self._exception
  File "/usr/local/Cellar/python3/3.4.2_1/Frameworks/Python.framework/Versions/3.4/lib/python3.4/asyncio/tasks.py", line 232, in _step
    result = coro.throw(exc)
  File "/usr/local/lib/python3.4/site-packages/hangups/client.py", line 99, in connect
    yield from self._listen_future
  File "/usr/local/Cellar/python3/3.4.2_1/Frameworks/Python.framework/Versions/3.4/lib/python3.4/asyncio/futures.py", line 388, in __iter__
    yield self  # This tells Task to wait for completion.
  File "/usr/local/Cellar/python3/3.4.2_1/Frameworks/Python.framework/Versions/3.4/lib/python3.4/asyncio/tasks.py", line 285, in _wakeup
    value = future.result()
  File "/usr/local/Cellar/python3/3.4.2_1/Frameworks/Python.framework/Versions/3.4/lib/python3.4/asyncio/futures.py", line 277, in result
    raise self._exception
  File "/usr/local/Cellar/python3/3.4.2_1/Frameworks/Python.framework/Versions/3.4/lib/python3.4/asyncio/tasks.py", line 236, in _step
    result = next(coro)
  File "/usr/local/lib/python3.4/site-packages/hangups/channel.py", line 208, in listen
    yield from self._fetch_channel_sid()
  File "/usr/local/lib/python3.4/site-packages/hangups/channel.py", line 278, in _fetch_channel_sid
    res = yield from self.send_maps([])
  File "/usr/local/lib/python3.4/site-packages/hangups/channel.py", line 253, in send_maps
    params=params, data=data_dict,
  File "/usr/local/lib/python3.4/site-packages/hangups/http_utils.py", line 52, in fetch
    raise exceptions.NetworkError(error_msg)
hangups.exceptions.NetworkError: Request connection error: Cannot connect to host 0.client-channel.google.com:443 ssl:True
@nkorth
Copy link
Author

nkorth commented Nov 8, 2015

Here's the complete log file (auth key redacted) from a second try.

2015-11-07 22:02:00,900 - hangups.auth - INFO - Authenticating with refresh token
2015-11-07 22:02:00,900 - hangups.auth - INFO - Loading refresh_token from '/Users/nkorth/Library/Caches/hangups/refresh_token.txt'
2015-11-07 22:02:00,933 - requests.packages.urllib3.connectionpool - INFO - Starting new HTTPS connection (1): accounts.google.com
2015-11-07 22:02:01,660 - requests.packages.urllib3.connectionpool - DEBUG - "POST /o/oauth2/token HTTP/1.1" 200 None
2015-11-07 22:02:01,668 - hangups.auth - INFO - Authentication successful
2015-11-07 22:02:01,671 - requests.packages.urllib3.connectionpool - INFO - Starting new HTTPS connection (1): accounts.google.com
2015-11-07 22:02:02,265 - requests.packages.urllib3.connectionpool - DEBUG - "GET /accounts/OAuthLogin?source=hangups&issueuberauth=1 HTTP/1.1" 200 547
2015-11-07 22:02:02,445 - requests.packages.urllib3.connectionpool - DEBUG - "GET /MergeSession?service=mail&continue=http://www.google.com&uberauth=[redacted] HTTP/1.1" 302 313
2015-11-07 22:02:02,631 - requests.packages.urllib3.connectionpool - DEBUG - "GET /CheckCookie?chtml=LoginDoneHtml&service=mail&continue=https%3A%2F%2Fwww.google.com&gidl=CAA HTTP/1.1" 302 204
2015-11-07 22:02:02,639 - requests.packages.urllib3.connectionpool - INFO - Starting new HTTPS connection (1): www.google.com
2015-11-07 22:02:03,223 - requests.packages.urllib3.connectionpool - DEBUG - "GET / HTTP/1.1" 200 None
2015-11-07 22:02:03,240 - hangups.channel - INFO - Requesting new gsessionid and SID...
2015-11-07 22:02:03,240 - hangups.http_utils - DEBUG - Sending request post https://0.client-channel.google.com/client-channel/channel/bind:
{'count': 0, 'ofs': 0}
2015-11-07 22:02:03,496 - hangups.http_utils - INFO - Request attempt 0 failed: Request connection error: Cannot connect to host 0.client-channel.google.com:443 ssl:True
2015-11-07 22:02:03,710 - hangups.http_utils - INFO - Request attempt 1 failed: Request connection error: Cannot connect to host 0.client-channel.google.com:443 ssl:True
2015-11-07 22:02:03,927 - hangups.http_utils - INFO - Request attempt 2 failed: Request connection error: Cannot connect to host 0.client-channel.google.com:443 ssl:True
2015-11-07 22:02:03,927 - hangups.http_utils - INFO - Request failed after 3 attempts

@tdryer
Copy link
Owner

tdryer commented Nov 8, 2015

Is this happening consistently? Can you connect to https://0.client-channel.google.com/ in your browser?

@nkorth
Copy link
Author

nkorth commented Nov 8, 2015

Yes, it happens consistently. My browser can connect to the host (HTTPS checks out too), though it produces

<HTML>
<HEAD>
<TITLE>Not Found</TITLE>
</HEAD>
<BODY BGCOLOR="#FFFFFF" TEXT="#000000">
<H1>Not Found</H1>
<H2>Error 404</H2>
</BODY>
</HTML>

@tdryer
Copy link
Owner

tdryer commented Nov 9, 2015

My best guess is that Python is having trouble with the TLS connection. Here's a script to try:
https://gist.github.com/tdryer/b1899a8b958e37fcaa12

Output should be:

<ClientResponse(https://httpbin.org/get) [200 OK]>
<CIMultiDictProxy {'SERVER': 'nginx', 'DATE': 'Mon, 09 Nov 2015 04:27:21 GMT', 'CONTENT-TYPE': 'application/json', 'CONTENT-LENGTH': '268', 'CONNECTION': 'keep-alive', 'ACCESS-CONTROL-ALLOW-ORIGIN': '*', 'ACCESS-CONTROL-ALLOW-CREDENTIALS': 'true'}>

<ClientResponse(https://0.client-channel.google.com/client-channel/channel/bind) [403 unknown client type]>
<CIMultiDictProxy {'CONTENT-TYPE': 'text/html; charset=UTF-8', 'CONTENT-ENCODING': 'gzip', 'DATE': 'Mon, 09 Nov 2015 04:27:21 GMT', 'EXPIRES': 'Mon, 09 Nov 2015 04:27:21 GMT', 'CACHE-CONTROL': 'private, max-age=0', 'X-CONTENT-TYPE-OPTIONS': 'nosniff', 'X-FRAME-OPTIONS': 'SAMEORIGIN', 'X-XSS-PROTECTION': '1; mode=block', 'SERVER': 'GSE', 'ALTERNATE-PROTOCOL': '443:quic,p=1', 'ALT-SVC': 'quic=":443"; p="1"; ma=604800', 'TRANSFER-ENCODING': 'chunked'}>

@nkorth
Copy link
Author

nkorth commented Nov 9, 2015

Output was:

<ClientResponse(https://httpbin.org/get) [200 OK]>
<CIMultiDictProxy {'SERVER': 'nginx', 'DATE': 'Mon, 09 Nov 2015 04:33:31 GMT', 'CONTENT-TYPE': 'application/json', 'CONTENT-LENGTH': '268', 'CONNECTION': 'keep-alive', 'ACCESS-CONTROL-ALLOW-ORIGIN': '*', 'ACCESS-CONTROL-ALLOW-CREDENTIALS': 'true'}>

Traceback (most recent call last):
  File "/usr/local/lib/python3.4/site-packages/aiohttp/connector.py", line 571, in _create_connection
    server_hostname=hinfo['hostname'] if sslcontext else None)
  File "/usr/local/Cellar/python3/3.4.2_1/Frameworks/Python.framework/Versions/3.4/lib/python3.4/asyncio/base_events.py", line 579, in create_connection
    sock, protocol_factory, ssl, server_hostname)
  File "/usr/local/Cellar/python3/3.4.2_1/Frameworks/Python.framework/Versions/3.4/lib/python3.4/asyncio/base_events.py", line 601, in _create_connection_transport
    yield from waiter
  File "/usr/local/Cellar/python3/3.4.2_1/Frameworks/Python.framework/Versions/3.4/lib/python3.4/asyncio/futures.py", line 388, in __iter__
    yield self  # This tells Task to wait for completion.
  File "/usr/local/Cellar/python3/3.4.2_1/Frameworks/Python.framework/Versions/3.4/lib/python3.4/asyncio/tasks.py", line 285, in _wakeup
    value = future.result()
  File "/usr/local/Cellar/python3/3.4.2_1/Frameworks/Python.framework/Versions/3.4/lib/python3.4/asyncio/futures.py", line 277, in result
    raise self._exception
  File "/usr/local/Cellar/python3/3.4.2_1/Frameworks/Python.framework/Versions/3.4/lib/python3.4/asyncio/selector_events.py", line 727, in _on_handshake
    self._sock.do_handshake()
  File "/usr/local/Cellar/python3/3.4.2_1/Frameworks/Python.framework/Versions/3.4/lib/python3.4/ssl.py", line 805, in do_handshake
    self._sslobj.do_handshake()
ssl.SSLError: [SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed (_ssl.c:600)

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "/usr/local/lib/python3.4/site-packages/aiohttp/connector.py", line 292, in connect
    transport, proto = yield from self._create_connection(req)
  File "/usr/local/lib/python3.4/site-packages/aiohttp/connector.py", line 588, in _create_connection
    (req.host, req.port)) from exc
aiohttp.errors.ClientOSError: Can not connect to 0.client-channel.google.com:443

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "test2.py", line 17, in <module>
    asyncio.get_event_loop().run_until_complete(main())
  File "/usr/local/Cellar/python3/3.4.2_1/Frameworks/Python.framework/Versions/3.4/lib/python3.4/asyncio/base_events.py", line 268, in run_until_complete
    return future.result()
  File "/usr/local/Cellar/python3/3.4.2_1/Frameworks/Python.framework/Versions/3.4/lib/python3.4/asyncio/futures.py", line 277, in result
    raise self._exception
  File "/usr/local/Cellar/python3/3.4.2_1/Frameworks/Python.framework/Versions/3.4/lib/python3.4/asyncio/tasks.py", line 232, in _step
    result = coro.throw(exc)
  File "test2.py", line 12, in main
    response = yield from aiohttp.request('get', url)
  File "/usr/local/lib/python3.4/site-packages/aiohttp/client.py", line 466, in request
    read_until_eof=read_until_eof)
  File "/usr/local/lib/python3.4/site-packages/aiohttp/client.py", line 131, in request
    conn = yield from self._connector.connect(req)
  File "/usr/local/lib/python3.4/site-packages/aiohttp/connector.py", line 299, in connect
    'Cannot connect to host %s:%s ssl:%s' % key) from exc
aiohttp.errors.ClientOSError: Cannot connect to host 0.client-channel.google.com:443 ssl:True
Unclosed response
client_response: <ClientResponse(https://httpbin.org/get) [200 OK]>
<CIMultiDictProxy {'SERVER': 'nginx', 'DATE': 'Mon, 09 Nov 2015 04:33:31 GMT', 'CONTENT-TYPE': 'application/json', 'CONTENT-LENGTH': '268', 'CONNECTION': 'keep-alive', 'ACCESS-CONTROL-ALLOW-ORIGIN': '*', 'ACCESS-CONTROL-ALLOW-CREDENTIALS': 'true'}>

@tdryer
Copy link
Owner

tdryer commented Nov 9, 2015

OK, the problem is that Python can't verify Google's certificate for some reason. This might be an issue with the version of Python that you have installed.

@nkorth
Copy link
Author

nkorth commented Nov 9, 2015

I got it to work! Per http://stackoverflow.com/a/30831120/685933, I did

brew install openssl
brew link --force openssl

@ftoulemon
Copy link

I have the same problem.
@nkorth : Which version of openssl fixed your issue?

My openssl version:

$ openssl version
OpenSSL 1.0.2g  1 Mar 2016

My hangups output:

Traceback (most recent call last):
  File "/home/toulemf/.local/bin/hangups", line 11, in <module>
    sys.exit(main())
  File "/home/toulemf/.local/lib/python3.5/site-packages/hangups/ui/__main__.py", line 988, in main
    }, col_scheme, palette_colors, datetimefmt, notifier
  File "/home/toulemf/.local/lib/python3.5/site-packages/hangups/ui/__main__.py", line 98, in __init__
    loop.run_until_complete(self._client.connect())
  File "/usr/lib/python3.5/asyncio/base_events.py", line 387, in run_until_complete
    return future.result()
  File "/usr/lib/python3.5/asyncio/futures.py", line 274, in result
    raise self._exception
  File "/usr/lib/python3.5/asyncio/tasks.py", line 241, in _step
    result = coro.throw(exc)
  File "/home/toulemf/.local/lib/python3.5/site-packages/hangups/client.py", line 108, in connect
    yield from self._listen_future
  File "/usr/lib/python3.5/asyncio/futures.py", line 361, in __iter__
    yield self  # This tells Task to wait for completion.
  File "/usr/lib/python3.5/asyncio/tasks.py", line 296, in _wakeup
    future.result()
  File "/usr/lib/python3.5/asyncio/futures.py", line 274, in result
    raise self._exception
  File "/usr/lib/python3.5/asyncio/tasks.py", line 239, in _step
    result = coro.send(None)
  File "/home/toulemf/.local/lib/python3.5/site-packages/hangups/channel.py", line 203, in listen
    yield from self._fetch_channel_sid()
  File "/home/toulemf/.local/lib/python3.5/site-packages/hangups/channel.py", line 273, in _fetch_channel_sid
    res = yield from self.send_maps([])
  File "/home/toulemf/.local/lib/python3.5/site-packages/hangups/channel.py", line 248, in send_maps
    params=params, data=data_dict,
  File "/home/toulemf/.local/lib/python3.5/site-packages/hangups/http_utils.py", line 52, in fetch
    raise exceptions.NetworkError(error_msg)
hangups.exceptions.NetworkError: Request connection error: Cannot connect to host 0.client-channel.google.com:443 ssl:True
$ hangups --version                  
hangups 0.4.1

@d3ft0uch
Copy link

I've got same problem with hangups, but changing the python runtime from 3.6.2 to 3.5.2 solves the problem.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants