aio-libs / aiomonitor

aiomonitor is module that adds monitor and python REPL capabilities for asyncio application
https://aiomonitor.aio-libs.org
Apache License 2.0
662 stars 42 forks source link

reuse_port not supported by socket module on Windows + Winloop #412

Open TheRealMkadmi opened 3 days ago

TheRealMkadmi commented 3 days ago

Describe the bug

When running this code:

`async def main_async(file_path: str): loop = asyncio.get_event_loop() async with aiomonitor.start_monitor(loop, hook_task_factory=True):

....... any code

`

This exception is raised:

File "C:\<path>\venv\Lib\site-packages\aiohttp\web_runner.py", line 119, in start self._server = await loop.create_server( ^^^^^^^^^^^^^^^^^^^^^^^^^ File "winloop\loop.pyx", line 1736, in create_server ValueError: reuse_port not supported by socket module

To Reproduce

  1. install winloop on Python 3.11.9
  2. run any monitoring task as per documentation

Expected behavior

Monitoring starts normally.

Logs/tracebacks

Exception in thread Thread-1 (_ui_main):
Traceback (most recent call last):
  File "C:\<path>\Lib\threading.py", line 1038, in _bootstrap_inner
    self.run()
  File "C:\<path>\Lib\threading.py", line 975, in run
    self._target(*self._args, **self._kwargs)
  File "C:\<path>\Lib\site-packages\aiomonitor\monitor.py", line 546, in _ui_main
    asyncio.run(self._ui_main_async())
  File "C:\<path>\Lib\asyncio\runners.py", line 190, in run
    return runner.run(main)
           ^^^^^^^^^^^^^^^^
  File "C:\<path>\Lib\asyncio\runners.py", line 118, in run
    return self._loop.run_until_complete(task)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "winloop\loop.pyx", line 1520, in winloop.loop.Loop.run_until_complete
  File "C:\<path>\Lib\site-packages\aiomonitor\monitor.py", line 574, in _ui_main_async
    await webui_site.start()
  File "C:\<path>\Lib\site-packages\aiohttp\web_runner.py", line 119, in start
    self._server = await loop.create_server(
                   ^^^^^^^^^^^^^^^^^^^^^^^^^
  File "winloop\loop.pyx", line 1736, in create_server
ValueError: reuse_port not supported by socket module

Python Version

$ Python 3.11.0

aiomonitor Version

Name: aiomonitor
Version: 0.7.1
Summary: Adds monitor and Python REPL capabilities for asyncio applications
Home-page: https://github.com/aio-libs/aiomonitor
Author: Nikolay Novik
Author-email: nickolainovik@gmail.com
License: Apache-2.0
Location: C:\Users\Wahib\Desktop\Workbench\repos\cpanel-cracker\venv\Lib\site-packages
Requires: aioconsole, aiohttp, attrs, click, janus, jinja2, prompt-toolkit, telnetlib3, terminaltables, trafaret, typing-extensions
Required-by:

OS

Windows 11 24H2 - Build 26100.2454

Additional context

No response

Code of Conduct