Skip to content

uvloop blocks app and not executes aiohttp server #425

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
semakmillev opened this issue Jul 21, 2021 · 5 comments · Fixed by #446
Closed

uvloop blocks app and not executes aiohttp server #425

semakmillev opened this issue Jul 21, 2021 · 5 comments · Fixed by #446

Comments

@semakmillev
Copy link

semakmillev commented Jul 21, 2021

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)"

@1st1
Copy link
Member

1st1 commented Jul 21, 2021

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?

@semakmillev
Copy link
Author

semakmillev commented Jul 21, 2021

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(

@roman27t
Copy link

roman27t commented Sep 24, 2021

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

@nehanagendra02
Copy link

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

@kfur
Copy link
Contributor

kfur commented Oct 11, 2021

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
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants