-
-
Notifications
You must be signed in to change notification settings - Fork 754
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
Is there a reason for overriding the default asyncio policy on Windows? #1220
Comments
Looking at the commit history the It probably wasn't understood that using So simply disabling the |
@polys For now you can work around this issue by starting uvicorn programmatically in your own loop, for example this will give you a from asyncio import get_event_loop, new_event_loop
from fastapi import FastAPI
from uvicorn import Config, Server
app = FastAPI()
@app.get("/")
async def read_main():
return f'Running loop: {get_event_loop()}'
loop = new_event_loop()
config = Config(app=app)
server = Server(config)
loop.run_until_complete(server.serve()) However I still think that |
Thanks for the suggestion 😀 In my case, I'm only using Windows for development, so My workaround while on Windows is to use Hypercorn, which seems to be happier. I've only tried this for a couple of days now but haven't seen any I'm still very happy to use
That's a nice suggestion — I hadn't realised that that's the only reason for not using |
happy to review a PR for this, should you want to tackle it open a new issue |
Checklist
Is your feature related to a problem? Please describe.
While developing on Windows, my app being served by
uvicorn
keeps raisingValueError: too many file descriptors in select()
, which I understand is related to the suboptimalasyncio.WindowsSelectorEventLoopPolicy
.Python 3.8 changed the default to
ProactorEventLoop
on Windows but your code seems to override this.Is there a reason for this?
Describe the solution you would like.
Ideally, all the
too many file descriptors in select()
exceptions go away.Describe alternatives you considered
Additional context
This isn't an issue at all when running my app in a Linux container.
The text was updated successfully, but these errors were encountered: