Skip to content

uvloop blocks app and not executes aiohttp server #425

Closed

Description

@semakmillev

Hi! I have very strange bug.
On server (only on the one - i cant reproduce error on others) i m tryin to start application using uvloop. Here is the code (i tried using docker, or executing script - result was the same) in console:

Python 3.8.10 (default, Jun 2 2021, 10:49:15)
[GCC 9.4.0] on linux
Type "help", "copyright", "credits" or "license" for more information.

import uvloop
asyncio.set_event_loop_policy(uvloop.EventLoopPolicy()) # here i tried uvloop.install()
from aiohttp import web
app = web.Application()
web.run_app(app, port=17000)

And after that nothing happens! Moreover, i can't stop process using Ctrl+C or Ctrl+D - only kill from other console

*i changed ports and got same results

uvloop version: 0.15.3
OS Version:
NAME="Ubuntu"
VERSION="20.04.1 LTS (Focal Fossa)"

Activity

  1. 1st1 commented on Jul 21, 2021

    @1st1
    Member

    Sounds like the 17000 port is used by something else on that particular server. And most likely aiohttp has some timeout/retry logic in place and waits for it to become available. I don't think this is a uvloop bug. That said, check what happens if you don't activate uvloop -- does vanilla asyncio behave differently?

  2. semakmillev commented on Jul 21, 2021

    @semakmillev
    Author

    Sounds like the 17000 port is used by something else on that particular server. And most likely aiohttp has some timeout/retry logic in place and waits for it to become available. I don't think this is a uvloop bug. That said, check what happens if you don't activate uvloop -- does vanilla asyncio behave differently?

    1. As i mentioned - i used different ports - like 8023, 7091, 17091, 17000, 80 and several another with same result
    2. Yes, if i run just
      from aiohttp import web
      app = web.Application()
      web.run_app(app, port=17000)
      everything works fine.

    It's really strange. Seems that i have some hardware or system problem, because on other machine with same software i don't get this bug. But how to find out it - i dont know(

  3. roman27t commented on Sep 24, 2021

    @roman27t

    Hello.

    I have the same issue after upgrade libs:

    works fine:
    python 3.6
    aiohttp 3.6.2
    uvloop 0.14.0

    issue:
    python 3.7, 3.9
    aiohttp 3.7.4.post0
    uvloop 0.16.0

    If I have only one pod - it was ok, but when I start 2nd pod - pod doesn't listen 8080 port

    My system:
    sh-4.2# cat /etc/*release : CentOS Linux release 7.8.2003 (Core)

    If I run without uvloop.install() - it was ok.

    When I set Debug mode: PYTHONASYNCIODEBUG=1
    I finally got a log:

    WARNING:asyncio:create_server() failed to create socket.socket(10, 1, 6)
    Traceback (most recent call last):
    File "uvloop/loop.pyx", line 1745, in uvloop.loop.Loop.create_server
    File "/usr/local/lib/python3.9/socket.py", line 232, in init
    _socket.socket.init(self, family, type, proto, fileno)
    OSError: [Errno 97] Address family not supported by protocol

  4. nehanagendra02 commented on Oct 8, 2021

    @nehanagendra02

    @bumer-t , @semakmillev were you able to figure out the root cause or solution to this problem? I am facing similar issues.

  5. kfur commented on Oct 11, 2021

    @kfur
    Contributor

    Try set ipv4 address, because by default it will try to bind to ipv6 first

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions