- Newest
- Most votes
- Most comments
It is relevant to determine if the error 5XX originated from your load balancer or the instance: https://lightsail.aws.amazon.com/ls/docs/en_us/articles/understanding-instance-health-metrics-in-amazon-lightsail#understanding-load-balancer-metrics
To gather more information as to what is happening, I recommend you try the following:
- Ensure the relevant
flask
environment flags are set to output debug level logging:
You should be able to see an error traceback as shown here: https://flask.palletsprojects.com/en/2.0.x/debugging
You can also review the recorded logs in Lightsail as explained here: https://lightsail.aws.amazon.com/ls/docs/en_us/articles/amazon-lightsail-viewing-container-service-container-logs
-
As a test run your application with more RAM to see if an out-of-memory error crashes your application. https://lightsail.aws.amazon.com/ls/docs/en_us/articles/amazon-lightsail-viewing-container-services-metrics
-
Investigate the health status reported by your container. The container service may have specific health requirements that are monitored (e.g. response time). If this metric determines that the service is unhealthy, I expect it will restart the service for you. You can find more information about the health monitoring options here: https://lightsail.aws.amazon.com/ls/docs/en_us/articles/amazon-lightsail-container-services-deployments
I'm accepting either way because you took a long time with me, will try to see what the underlying issues is. Maybe even Amazon Rekognition is better, since I don't really want to spend much money on this school project.
Hi Chris, I have tried your suggestions 1. I have created a new flask app with the debug option now properly set up, like in your 1. https://flask.palletsprojects.com/en/2.0.x/debugging , but it didn't returned anything, I got 502 bad gateway instantly. 2. Will try to check this out. 3. I have updated health options, but no noticable impact. Link: https://ibb.co/xYmtjWX
Hey, I have also tried 2. option, but nothing has changed, same bad gateway error.
If you can't get flask to display more debug output here, it's likely that the error 502/503 you are seeing is not generated flask, but a load balancer that sits before your application and can't route traffic to the desired service. Therefore option 3 and the configuration around the network connectivity and health monitoring of your service should be evaluated. Often short time-outs in combination with synchronous request handling lead to services being considered stale.
Relevant content
- asked 4 months ago
- asked 2 years ago
- AWS OFFICIALUpdated a year ago
- AWS OFFICIALUpdated a year ago
- AWS OFFICIALUpdated 8 months ago
- AWS OFFICIALUpdated 2 years ago
Hi AWS-User-4298801, could you share the logs from the container? How do you know that is crashing on the sift.detectAndCompute(...) line? OpenCV is compute intensive, what is your container size on Lightsail?
Thank you for your reply. Here are the steps of how I can reproduce it:
Hi @AWS-User-4298801, please try to run your flask app in debug mode and kindly provide more detail around the error output. You could simply start your python app from an interactive terminal and view the logs while trying to compare the images.
Hi, I took your advice and pushed the project in dev mode to AWS, but it is the same result, but no extra logs were added. I can't use interactive terminal, since I'm using Lightsail container services, can't log in to the machine.
No logs after logger.warning("IMG1 read created " + str(img1 is None)). So I assume it crashes on detectAndCompute.