Iapetus-11 / aio-mc-rcon

An asynchronous RCON client/wrapper for Minecraft Java Edition
MIT License
38 stars 4 forks source link

Task Destroyed #7

Closed FroostySnoowman closed 8 months ago

FroostySnoowman commented 10 months ago

Error:


[2023-10-30 19:34:03] [ERROR   ] discord.ui.view: Ignoring exception in view <LogsDropdownView timeout=None children=2> for item <LogsDropdown placeholder='What log do you wish to upload?' min_values=1 max_values=1 disabled=False>
Traceback (most recent call last):
  File "/usr/local/lib/python3.10/dist-packages/aiomcrcon/client.py", line 93, in _send_msg
    in_len = struct.unpack("<i", await self._read(4))[0]
  File "/usr/local/lib/python3.10/dist-packages/aiomcrcon/client.py", line 66, in _read
    received = await self._reader.read(n - len(out))
  File "/usr/lib/python3.10/asyncio/streams.py", line 669, in read
    await self._wait_for_data('read')
  File "/usr/lib/python3.10/asyncio/streams.py", line 502, in _wait_for_data
    await self._waiter
asyncio.exceptions.CancelledError

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/usr/lib/python3.10/asyncio/tasks.py", line 456, in wait_for
    return fut.result()
asyncio.exceptions.CancelledError

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

Traceback (most recent call last):
  File "/usr/local/lib/python3.10/dist-packages/discord/ui/view.py", line 430, in _scheduled_task
    await item.callback(interaction)
  File "/bot2/records-bot/cogs/commands/logs.py", line 81, in callback
    url = await upload_log(self.values[0], self.server_address, self.rcon_port)
  File "/bot2/records-bot/cogs/commands/logs.py", line 62, in upload_log
    resp = await mcr.send_cmd(cmd)
  File "/usr/local/lib/python3.10/dist-packages/aiomcrcon/client.py", line 118, in send_cmd
    return await asyncio.wait_for(self._send_msg(MessageType.COMMAND, cmd), timeout)
  File "/usr/lib/python3.10/asyncio/tasks.py", line 458, in wait_for
    raise exceptions.TimeoutError() from exc
asyncio.exceptions.TimeoutError
Task was destroyed but it is pending!
task: <Task pending name='discord-ui-view-dispatch-fe001fdcbb96b8023cca94f88000b3ff' coro=<View._scheduled_task() done, defined at /usr/local/lib/python3.10/dist-packages/discord/ui/view.py:419> wait_for=<Future pending cb=[Task.task_wakeup()]>>```

Code (logs.py): https://beta.mystb.in/DosageWeightInjured
Iapetus-11 commented 10 months ago

The error doesn't help much on its own, could you share how you're using this library?

FroostySnoowman commented 10 months ago

The error doesn't help much on its own, could you share how you're using this library?

Here is a logs.py file: https://beta.mystb.in/DosageWeightInjured Here is a dispatch.py file: https://beta.mystb.in/DifficultyInvestigatedSystem

Iapetus-11 commented 10 months ago

It looks like the server you're trying to connect to isn't available because the code is timing out. You could set the timeout to a higher value using the timeout= kwarg, and if that doesn't work I'd make sure your server is online with rcon enabled and port forwarded.