groupby / hubot-hangups

Hubot adapter using hangups
39 stars 3 forks source link

Client unexpectedly disconnected #22

Closed szechyjs closed 9 years ago

szechyjs commented 9 years ago

I get the following stack trace...

You're logged in!
Client unexpectedly disconnected:
unsupported operand type(s) for //: 'str' and 'int'
Traceback (most recent call last):
  File "/Users/jared/Dev/newhubot/node_modules/hubot-hangups/HangoutsBot/hangupsbot.py", line 137, in run
    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/site-packages/asyncio-3.4.1-py3.4.egg/asyncio/base_events.py", line 208, 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/site-packages/asyncio-3.4.1-py3.4.egg/asyncio/futures.py", line 243, in result
    raise self._exception
  File "/usr/local/Cellar/python3/3.4.2_1/Frameworks/Python.framework/Versions/3.4/lib/python3.4/site-packages/asyncio-3.4.1-py3.4.egg/asyncio/tasks.py", line 319, in _step
    result = coro.send(value)
  File "/usr/local/Cellar/python3/3.4.2_1/Frameworks/Python.framework/Versions/3.4/lib/python3.4/site-packages/hangups-0.2.4-py3.4.egg/hangups/client.py", line 103, in connect
    initial_data = yield from self._initialize_chat()
  File "/usr/local/Cellar/python3/3.4.2_1/Frameworks/Python.framework/Versions/3.4/lib/python3.4/site-packages/hangups-0.2.4-py3.4.egg/hangups/client.py", line 214, in _initialize_chat
    data_dict['ds:21'][0][1][4]
  File "/usr/local/Cellar/python3/3.4.2_1/Frameworks/Python.framework/Versions/3.4/lib/python3.4/site-packages/hangups-0.2.4-py3.4.egg/hangups/parsers.py", line 72, in from_timestamp
    ).replace(microsecond=(microsecond_timestamp % 1000000))
TypeError: unsupported operand type(s) for //: 'str' and 'int'
...
...
...
Trying to connect again (try 4 of 5)...
Client unexpectedly disconnected:
unsupported operand type(s) for //: 'str' and 'int'
Traceback (most recent call last):
  File "/Users/jared/Dev/newhubot/node_modules/hubot-hangups/HangoutsBot/hangupsbot.py", line 137, in run
    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/site-packages/asyncio-3.4.1-py3.4.egg/asyncio/base_events.py", line 208, 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/site-packages/asyncio-3.4.1-py3.4.egg/asyncio/futures.py", line 243, in result
    raise self._exception
  File "/usr/local/Cellar/python3/3.4.2_1/Frameworks/Python.framework/Versions/3.4/lib/python3.4/site-packages/asyncio-3.4.1-py3.4.egg/asyncio/tasks.py", line 319, in _step
    result = coro.send(value)
  File "/usr/local/Cellar/python3/3.4.2_1/Frameworks/Python.framework/Versions/3.4/lib/python3.4/site-packages/hangups-0.2.4-py3.4.egg/hangups/client.py", line 103, in connect
    initial_data = yield from self._initialize_chat()
  File "/usr/local/Cellar/python3/3.4.2_1/Frameworks/Python.framework/Versions/3.4/lib/python3.4/site-packages/hangups-0.2.4-py3.4.egg/hangups/client.py", line 214, in _initialize_chat
    data_dict['ds:21'][0][1][4]
  File "/usr/local/Cellar/python3/3.4.2_1/Frameworks/Python.framework/Versions/3.4/lib/python3.4/site-packages/hangups-0.2.4-py3.4.egg/hangups/parsers.py", line 72, in from_timestamp
    ).replace(microsecond=(microsecond_timestamp % 1000000))
TypeError: unsupported operand type(s) for //: 'str' and 'int'

Waiting 25 seconds...
Trying to connect again (try 5 of 5)...
Maximum number of retries reached! Exiting...

Also, while it is supposedly connected, it doesn't seem to be receiving messages from hangouts.

EDIT: after looking at the code the You're logged in! is only because I have a cookie set. It appears it never actually connects to hangouts.

ehacke commented 9 years ago

@szechyjs Yup, we've seen this on our side too. It's because Google recently changed their Hangouts protocol and Hangups hasn't pushed out an official fix yet.

It can be fixed by manually installing the latest version of Hangups from github. Though there is a caveat too that too. I'll post a how-to shortly.

ehacke commented 9 years ago

I posted a note to hangups issue https://github.com/tdryer/hangups/issues/61 to see if he can update the Python repo with this fix.

It's possible there are other things blocking that though, in which case I'll come up with a work-around.

ferronrsmith commented 9 years ago

temporary fix

pip install --upgrade https://github.com/endofline/hangups/tree/fix-change-feb7.zip

Think we may need to fork the hangups library to accelerate fixes.

Add a dependency_link declaration in the setup.py, that way we can pull the latest from our fork instead of waiting for a fix.

tdryer commented 9 years ago

[hangups author here] Thanks for your patience, I just pushed release 0.2.5 which has the fix for this.

ehacke commented 9 years ago

@tdryer Thanks!

@ferronrsmith Yup, just pulling the latest directly from the hangups master repo might be the best way to maintain this going forward.

If we wanted to maintain our own fork, we totally could. But in order to get faster fixes, we'd need someone on our team to learn the Hangouts protocol as well as @tdryer has, and I'm not sure if we have someone for that.

tdryer commented 9 years ago

I'd love to be able to get emergency fixes out as fast as possible, especially if they already exist in a PR. Now that Google has broken the API more than a few times, I'll have to start keeping new features off master and automating the release process a bit.

ferronrsmith commented 9 years ago

@ehacke Yeah you're right, maintaining a separate fork might be counterproductive, but at least a snapshot that we can use in the interim until changes are detected.

Wondering if there is a way to implement the protocol with schema detection, that way if it changes, it can adapts. Reflection/detection in python ...