tdryer / hangups

the first third-party instant messaging client for Google Hangouts
https://hangups.readthedocs.io/
MIT License
1.71k stars 191 forks source link

Hangup Logs Blows Up To Several GB #370

Open balajeerc opened 6 years ago

balajeerc commented 6 years ago

Today I found that hangups logs blew up to several GB (9.9 GB), nearly exhausting the space on my HDD.

This isn't the first time this occurred. It occurred a couple of times before this. Am not able to reproduce exactly what conditions it happens under, but it has something to do with halting an existing instance and starting a new one.

Ubuntu 16.04 x64 Hangups 0.4.3

The log seems to be a repetition of the error shown below:

2017-11-11 18:33:00,375 - asyncio - ERROR - Exception in callback Screen.hook_event_loop.<locals>.<lambda>() at /home/balajeerc/.local/lib/python3.5/site-packages/urwid/raw_display.py:392
handle: <Handle Screen.hook_event_loop.<locals>.<lambda>() at /home/balajeerc/.local/lib/python3.5/site-packages/urwid/raw_display.py:392>
Traceback (most recent call last):
  File "/usr/lib/python3.5/asyncio/events.py", line 126, in _run
    self._callback(*self._args)
  File "/home/balajeerc/.local/lib/python3.5/site-packages/urwid/raw_display.py", line 393, in <lambda>
    event_loop, callback, self.get_available_raw_input())
  File "/home/balajeerc/.local/lib/python3.5/site-packages/urwid/raw_display.py", line 427, in get_available_raw_input
    codes = self._get_gpm_codes() + self._get_keyboard_codes()
  File "/home/balajeerc/.local/lib/python3.5/site-packages/urwid/raw_display.py", line 501, in _get_keyboard_codes
    code = self._getch_nodelay()
  File "/home/balajeerc/.local/lib/python3.5/site-packages/urwid/raw_display.py", line 635, in _getch_nodelay
    return self._getch(0)
  File "/home/balajeerc/.local/lib/python3.5/site-packages/urwid/raw_display.py", line 545, in _getch
    return ord(os.read(self._term_input_file.fileno(), 1))
TypeError: ord() expected a character, but string of length 0 found
2017-11-11 18:33:00,376 - asyncio - ERROR - Exception in callback Screen.hook_event_loop.<locals>.<lambda>() at /home/balajeerc/.local/lib/python3.5/site-packages/urwid/raw_display.py:392
handle: <Handle Screen.hook_event_loop.<locals>.<lambda>() at /home/balajeerc/.local/lib/python3.5/site-packages/urwid/raw_display.py:392>
Traceback (most recent call last):
  File "/usr/lib/python3.5/asyncio/events.py", line 126, in _run
    self._callback(*self._args)
  File "/home/balajeerc/.local/lib/python3.5/site-packages/urwid/raw_display.py", line 393, in <lambda>
    event_loop, callback, self.get_available_raw_input())
  File "/home/balajeerc/.local/lib/python3.5/site-packages/urwid/raw_display.py", line 427, in get_available_raw_input
    codes = self._get_gpm_codes() + self._get_keyboard_codes()
  File "/home/balajeerc/.local/lib/python3.5/site-packages/urwid/raw_display.py", line 501, in _get_keyboard_codes
    code = self._getch_nodelay()
  File "/home/balajeerc/.local/lib/python3.5/site-packages/urwid/raw_display.py", line 635, in _getch_nodelay
    return self._getch(0)
  File "/home/balajeerc/.local/lib/python3.5/site-packages/urwid/raw_display.py", line 545, in _getch
    return ord(os.read(self._term_input_file.fileno(), 1))

Is this a known issue?

das7pad commented 6 years ago

This seems to be an upstream issue for urwid. Can you provide a pip3.5 freeze output? Which terminal are you using?

tdryer commented 6 years ago

There are previous reports of log spam in #119.

Urwid is using select to check that the input file descriptor is ready to read. The exception occurs because Urwid always expects to read 1 byte, but instead the end of the file is reached. According to the man page for select, this is expected behavior:

Those listed in readfds will be watched to see if characters become available for reading (more precisely, to see if a read will not block; in particular, a file descriptor is also ready on end-of-file)

I can reproduce the log spam by closing stdin immediately when hangups starts:

echo "" | hangups

But I don't know how else stdin could be closed while hangups is running.