Describe Bug
when stopping the server, multiple unexpected outcome could occur. these do not seem desirable and are therefore a bug.
To Reproduce
1
- start the server
- type stop
error + screenshot
$ ./startserver.sh
./startserver.sh: line 6: pypy: command not found
python version ok (3.9.0+)
[02/28/21 15:32:35 INFO]: Query server started on 127.0.1.1:25565.
[02/28/21 15:32:35 INFO]: Loading default worlds for level world...
[02/28/21 15:32:35 INFO]: Loaded default worlds: world, world_nether, world_the_end.
[02/28/21 15:32:35 INFO]: PyMine 0.1 started on 127.0.1.1:25565!
> stop
[02/28/21 15:32:39 INFO]: Closing server...
[02/28/21 15:32:39 INFO]: Server closed.
Exception ignored in: <function DatagramStream.__del__ at 0x7fd4ba6cbd30>
Traceback (most recent call last):
File "/home/the456gamer/Projects/PyMine/PyMine-server/venv/lib/python3.9/site-packages/asyncio_dgram/aio.py", line 42, in __del__
File "/usr/lib/python3.9/asyncio/selector_events.py", line 700, in close
File "/usr/lib/python3.9/asyncio/base_events.py", line 746, in call_soon
File "/usr/lib/python3.9/asyncio/base_events.py", line 510, in _check_closed
RuntimeError: Event loop is closed
Unhandled error in exception handler
context: {'message': 'Task was destroyed but it is pending!', 'task': <Task pending name='Task-3' coro=<QueryServer.handle() running at /home/the456gamer/Projects/PyMine/PyMine-server/pymine/logic/query.py:141> wait_for=<Future pending cb=[<TaskWakeupMethWrapper object at 0x7fd4b92a8760>()]>>}
Traceback (most recent call last):
File "/usr/lib/python3.9/asyncio/base_events.py", line 1775, in call_exception_handler
self._exception_handler(self, context)
File "/home/the456gamer/Projects/PyMine/PyMine-server/pymine/api/console.py", line 70, in task_exception_handler
if ctx["exception"]:
KeyError: 'exception'
[02/28/21 15:32:39 ERROR]: Error occurred while handling query packets:
Traceback (most recent call last):
File "/usr/lib/python3.9/asyncio/queues.py", line 166, in get
await getter
GeneratorExit
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/home/the456gamer/Projects/PyMine/PyMine-server/pymine/logic/query.py", line 141, in handle
data, remote = await self._server.recv()
File "/home/the456gamer/Projects/PyMine/PyMine-server/venv/lib/python3.9/site-packages/asyncio_dgram/aio.py", line 106, in recv
data, addr = await self._recvq.get()
File "/usr/lib/python3.9/asyncio/queues.py", line 168, in get
getter.cancel() # Just in case getter is not done yet.
File "/usr/lib/python3.9/asyncio/base_events.py", line 746, in call_soon
self._check_closed()
File "/usr/lib/python3.9/asyncio/base_events.py", line 510, in _check_closed
raise RuntimeError('Event loop is closed')
RuntimeError: Event loop is closed
2
- start the server
- press ctrl+c
- observe how server doesnt stop
- observe how any input is now ignored
- press ctrl + c again
- observe how server now stops
Screenshot
$ ./startserver.sh
./startserver.sh: line 6: pypy: command not found
python version ok (3.9.0+)
[02/28/21 15:41:11 INFO]: Query server started on 127.0.1.1:25565.
[02/28/21 15:41:11 INFO]: Loading default worlds for level world...
[02/28/21 15:41:11 INFO]: Loaded default worlds: world, world_nether, world_the_end.
[02/28/21 15:41:11 INFO]: PyMine 0.1 started on 127.0.1.1:25565!
>
exit
stop
stop
aqnjdnijec
fernjvenjov
^C[02/28/21 15:41:36 INFO]: Closing server...
[02/28/21 15:41:36 INFO]: Server closed.
Expected Behavior
For the server to safely stop without errors
Additional Context
$ python3.9 --version
Python 3.9.0+
$ cat /etc/*-release
โ File: /etc/lsb-release
1 โ DISTRIB_ID=Ubuntu
2 โ DISTRIB_RELEASE=20.04
3 โ DISTRIB_CODENAME=focal
4 โ DISTRIB_DESCRIPTION="Ubuntu 20.04.2 LTS"
---
โ File: /etc/os-release
1 โ NAME="Ubuntu"
2 โ VERSION="20.04.2 LTS (Focal Fossa)"
3 โ ID=ubuntu
4 โ ID_LIKE=debian
5 โ PRETTY_NAME="Ubuntu 20.04.2 LTS"
6 โ VERSION_ID="20.04"
7 โ HOME_URL="https://www.ubuntu.com/"
8 โ SUPPORT_URL="https://help.ubuntu.com/"
9 โ BUG_REPORT_URL="https://bugs.launchpad.net/ubuntu/"
10 โ PRIVACY_POLICY_URL="https://www.ubuntu.com/legal/terms-and-policies/privacy-policy"
11 โ VERSION_CODENAME=focal
12 โ UBUNTU_CODENAME=focal
Bug