rndusr / stig

TUI and CLI for the BitTorrent client Transmission
GNU General Public License v3.0
554 stars 24 forks source link

Crash when deleting multiple torrents with data #218

Closed Czechball closed 2 years ago

Czechball commented 2 years ago

My system: Debian 4.19.208-1 Python 3.7.3 pip 22.0.4 stig version 0.12.2a0 installed from pip

First, I've filtered out torrents by some criteria using stig ls: stig ls 'size>10G&seeds>5&tracker!~trackername' this resulted in about 10 torrents. So I went ahead and tried to delete them among with their data: stig rm -d 'size>10G&seeds>5&tracker!~trackername' this command listed the previous torrents followed by a question Are you sure you want to remove 12 torrents and their files? [y|n] which was immediately followed by this error:

Exception in callback _CommandBase.__init__.<locals>.<lambda>(<Task finishe...e 'aioloop'")>) at /home/czechball/.local/lib/python3.7/site-packages/stig/commands/cmdbase.py:154
handle: <Handle _CommandBase.__init__.<locals>.<lambda>(<Task finishe...e 'aioloop'")>) at /home/czechball/.local/lib/python3.7/site-packages/stig/commands/cmdbase.py:154>
Traceback (most recent call last):
  File "/usr/lib/python3.7/asyncio/events.py", line 88, in _run
    self._context.run(self._callback, *self._args)
  File "/home/czechball/.local/lib/python3.7/site-packages/stig/commands/cmdbase.py", line 154, in <lambda>
    self._task.add_done_callback(lambda task: self._catch_exceptions(task.result))
  File "/home/czechball/.local/lib/python3.7/site-packages/stig/commands/cmdbase.py", line 164, in _catch_exceptions
    self._finish(exception=e)
  File "/home/czechball/.local/lib/python3.7/site-packages/stig/commands/cmdbase.py", line 178, in _finish
    raise exception
  File "/home/czechball/.local/lib/python3.7/site-packages/stig/commands/cmdbase.py", line 162, in _catch_exceptions
    callabee(*args, **kwargs)
  File "/home/czechball/.local/lib/python3.7/site-packages/stig/commands/base/torrent.py", line 315, in run
    after=self.remove_list_of_hits)
  File "/home/czechball/.local/lib/python3.7/site-packages/stig/commands/cli/_mixin.py", line 51, in ask_yes_no
    answer = await self._get_answer(question)
  File "/home/czechball/.local/lib/python3.7/site-packages/stig/commands/cli/_mixin.py", line 93, in _get_answer
    key = await aiogetch(objects.aioloop)
AttributeError: module 'stig.objects' has no attribute 'aioloop'
Traceback (most recent call last):
  File "/home/czechball/.local/bin/stig", line 10, in <module>
    sys.exit(run())
  File "/home/czechball/.local/lib/python3.7/site-packages/stig/__init__.py", line 25, in run
    main.run()
  File "/home/czechball/.local/lib/python3.7/site-packages/stig/main.py", line 95, in run
    if not run_commands():
  File "/home/czechball/.local/lib/python3.7/site-packages/stig/main.py", line 80, in run_commands
    success = cmdmgr.run_sync(clicmds)
  File "/home/czechball/.local/lib/python3.7/site-packages/stig/commands/cmdmanager.py", line 207, in run_sync
    process.wait_sync()
  File "/home/czechball/.local/lib/python3.7/site-packages/stig/commands/cmdbase.py", line 195, in wait_sync
    self._catch_exceptions(loop.run_until_complete, self._task)
  File "/home/czechball/.local/lib/python3.7/site-packages/stig/commands/cmdbase.py", line 164, in _catch_exceptions
    self._finish(exception=e)
  File "/home/czechball/.local/lib/python3.7/site-packages/stig/commands/cmdbase.py", line 178, in _finish
    raise exception
  File "/home/czechball/.local/lib/python3.7/site-packages/stig/commands/cmdbase.py", line 162, in _catch_exceptions
    callabee(*args, **kwargs)
  File "/usr/lib/python3.7/asyncio/base_events.py", line 584, in run_until_complete
    return future.result()
  File "/usr/lib/python3.7/asyncio/events.py", line 88, in _run
    self._context.run(self._callback, *self._args)
  File "/home/czechball/.local/lib/python3.7/site-packages/stig/commands/cmdbase.py", line 154, in <lambda>
    self._task.add_done_callback(lambda task: self._catch_exceptions(task.result))
  File "/home/czechball/.local/lib/python3.7/site-packages/stig/commands/cmdbase.py", line 164, in _catch_exceptions
    self._finish(exception=e)
  File "/home/czechball/.local/lib/python3.7/site-packages/stig/commands/cmdbase.py", line 178, in _finish
    raise exception
  File "/home/czechball/.local/lib/python3.7/site-packages/stig/commands/cmdbase.py", line 162, in _catch_exceptions
    callabee(*args, **kwargs)
  File "/home/czechball/.local/lib/python3.7/site-packages/stig/commands/base/torrent.py", line 315, in run
    after=self.remove_list_of_hits)
  File "/home/czechball/.local/lib/python3.7/site-packages/stig/commands/cli/_mixin.py", line 51, in ask_yes_no
    answer = await self._get_answer(question)
  File "/home/czechball/.local/lib/python3.7/site-packages/stig/commands/cli/_mixin.py", line 93, in _get_answer
    key = await aiogetch(objects.aioloop)
AttributeError: module 'stig.objects' has no attribute 'aioloop'
Unclosed client session
client_session: <aiohttp.client.ClientSession object at 0x7f9e9c834be0>
Unclosed connector
connections: ['[(<aiohttp.client_proto.ResponseHandler object at 0x7f9e9b5c0ce0>, 3430687.820891812)]']
connector: <aiohttp.connector.TCPConnector object at 0x7f9e9c774828>
rndusr commented 2 years ago

Thanks for the report. Looks like nobody is using the CLI interface. :)

I made a new release that fixes this bug.

Czechball commented 2 years ago

Thanks a lot for the response and the quick fix! I'm actually exclusively using stig's commands instead of the interactive mode since my machine running Transmission isn't powerful enough to handle it comfortably. It has made my life a lot easier and this is literally the first issue I've stumbled upon so far. Keep up the great work

rndusr commented 2 years ago

Thank you for the nice feedback. Glad to hear it's working as intended.

If I ever get to do a rewrite of some major subsystems, these performance issues should be fixable. Just using a different TUI library should shave of a few percent of CPU load.