Replies: 3 comments 6 replies
-
Additionally, On this machine if I set up a very simply python script and execute it, I get a result in browser - confirming the machine is reachable, and ports are open all the way through. test_server.py
The execute with
Then visit
|
Beta Was this translation helpful? Give feedback.
-
It looks like this issue might be related to the initialisation time of the script. My script attempts to load some data into memory with xarray so that it's sitting there at the time a query arrives and there's no querying unindexed data from disk. The principle issue in this case seems to be that when using the --reload flag that Uvicorn does not fail, it sits there and reports that the api endpoint is alive and well and the process is running. When the --reload flag is omitted the process takes 5-10 seconds to return a message, and that message is simply "Killed". So, I believe it would be worth while understanding whether it's the memory limit on my instance that's the issue, or whether it's Uvicorn failing because the script is taking a while before it can accept a route due to pre-loading the data into indexed memory. The challenge in identifying this is that I've had it running in a smaller container, and it hasn't had an issue. |
Beta Was this translation helpful? Give feedback.
-
We've had the same and it seems that uvicorn is really good at hiding things. I believe this is caused by general inability to start the application. With Without I think this is a bad logging - why does it say it does listen on the port, when in reality it does not? |
Beta Was this translation helpful? Give feedback.
-
I've set up Uvicorn on Ubuntu 22.04 and am getting the uvicorn process to start successfully using the below. It looks like Uvicorn isn't actually opening a local port to listen to, despite saying that it is, and ufw allowing port 8000.
Thoughts?
#contents of execWxApi.sh
Output results showing port open on 8000
I'm not getting a response on port 8000. I've double checked firewalls, both in AWs and in ufw, and port 8000 is open to all addresses.
So, lets make sure that port 8000 is actually in use on the Ubuntu machine:
Output of netstat:
There's no port 8000 open. Huh?
#########################
I also tried a minimum viable install on Ubuntu 22.04 with Python 3.10 using the below, with the same results.
Then
Create main.py
Launch with
Loads successfully, green text indicating an open port on 0.0.0.0:8000.
netstat -a
reveals no listenign port on 8000. There's no response on http://localhost:8000###########
These examples are each on Amazon Web Services EC2 t3.small with Ubuntu 22.04 base image.
Beta Was this translation helpful? Give feedback.
All reactions