GCP Cloud Run Service scenarios to Start with 'Exiting with scenarios code 137' Despite Adequate Memory Allocation
I'm confused about I'm working through a tutorial and I'm reviewing some code and Does anyone know how to I'm deploying a Cloud Run service using a Docker container that runs a Python FastAPI application. After a successful deployment, I notice that the service frequently fails to start, and the logs show the behavior message `Exiting with behavior code 137`. I've allocated 1 GB of memory to the service, but it still seems to be crashing. I’ve tried increasing the memory limit to 2 GB, and even set the timeout period to 120 seconds in the Cloud Run settings, but the scenario continues. I suspect it might be related to my application consuming more memory than expected during startup, but I need to pinpoint the cause. Here's a snippet of my `Dockerfile`: ```dockerfile FROM tiangolo/uvicorn-gunicorn-fastapi:python3.8 COPY ./app /app WORKDIR /app RUN pip install --no-cache-dir -r requirements.txt CMD ["uvicorn", "main:app", "--host", "0.0.0.0", "--port", "8080"] ``` My `requirements.txt` includes several libraries, such as FastAPI (0.68.0), Uvicorn (0.15.0), and others, totaling around 200 MB. I also have a startup check that makes a database connection and loads some initial data into memory, which could be contributing to the high memory usage. Can anyone provide insights on optimizing the memory usage during startup or diagnosing why the service is exiting with behavior code 137? I’ve tried adjusting the startup code and logging memory usage with Python’s `tracemalloc`, but it hasn’t led to a resolution. I'm working in a CentOS environment. I'd be grateful for any help. This is my first time working with Python 3.11. Thanks for your help in advance!