question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Uvicorn ignores --uds and --fd configs

See original GitHub issue

I’m using uvicorn with supervisor and nginx

I’m trying to use the unix socket but it keep using the host and port

here is my supervisor conf file:

[fcgi-program:tas]
enviroment=DJANGO_SETTINGS_MODULE="maq_tasks.settings",DJANGO_ASGI_MODULE="maq_tasks.asgi",LOG_LEVEL="debug",WORKERS="3"
directory=/home/tas/src/
socket=unix:///home/tas/run/uvicorn.sock
command=/home/tas/bin/uvicorn maq_tasks.asgi:application --workers 3 --log-level debug --fd 0
user=tas
autostart=true
autorestart=true
redirect_stderr=true
stdout_logfile=/home/tas/logs/uvicorn-error.log

and here is my error

Traceback (most recent call last):
  ....
  File "/home/tas/lib/python3.6/site-packages/click/core.py", line 764, in __call__
    return self.main(*args, **kwargs)
  File "/home/tas/lib/python3.6/site-packages/click/core.py", line 717, in main
    rv = self.invoke(ctx)
  File "/home/tas/lib/python3.6/site-packages/click/core.py", line 956, in invoke
    return ctx.invoke(self.callback, **ctx.params)
  File "/home/tas/lib/python3.6/site-packages/click/core.py", line 555, in invoke
    return callback(*args, **kwargs)
  File "/home/tas/lib/python3.6/site-packages/uvicorn/main.py", line 257, in main
    run(**kwargs)
  File "/home/tas/lib/python3.6/site-packages/uvicorn/main.py", line 274, in run
    socket = config.bind_socket()
  File "/home/tas/lib/python3.6/site-packages/uvicorn/config.py", line 219, in bind_socket
    sock.bind((self.host, self.port))
OSError: [Errno 98] Address already in use

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Comments:12 (3 by maintainers)

github_iconTop GitHub Comments

6reactions
eseglemcommented, Aug 12, 2020

It would be nice to add this to the documentation at least. The docs state that --workers doesn’t work with --reload but does not mention issues with --uds or '–fd`. So, the only way to understand why reload is not working when using a socket, is this closed ticket on GitHub.

4reactions
Frechettacommented, Aug 11, 2020

I believe this is an important feature to have. In my situation, I use a unix socket for production, and I want the reload functionality for development. Since I run my application like production while I develop, it would be useful to be able to use reload and a unix socket together so that I don’t have to implement special code to handle this case.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Developers - Uvicorn ignores --uds and --fd configs - - Bountysource
I'm using uvicorn with supervisor and nginx. I'm trying to use the unix socket but it keep using the host and port. here...
Read more >
Settings - Uvicorn
--uds <path> - Bind to a UNIX domain socket, for example --uds /tmp/uvicorn.sock . ... This option is ignored if the --log-config CLI...
Read more >
How to use the uvicorn.main.Server function in uvicorn - Snyk
To help you get started, we've selected a few uvicorn.main. ... server = Server(config=config) config.load() CA.configure_trust(config.ssl) # Prepare the ...
Read more >
FastAPI/uvicorn not working when specifying host
I'm running a FastAPI app in Python using uvicorn on a Windows machine. It works fine when I do any one of the...
Read more >
How to unify uvicorn logging with endpoints logging?
Explanation When uvicorn's logging config has set ... This option is ignored if the --log-config CLI option is used.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found