Getting Bad Gateways 502 for PaddleOCR
Hi, so I've been trying to run PaddleOCR on my app and it doesn't work. Basically, there's a form submission I have on my app that lets users upload files tohave scanvia OCR, but it gives a bad gateway whenever this is tried. Only error I see on the Railway logs is "[1] [ERROR] Worker (pid:2) was sent SIGKILL! Perhaps out of memory?" but the site never crashes.
On the other hand, this is the CORS issue that shows on the console of the website after a user uploads a file. I realize it works for PDFs but not PNGs.
This is how my dockerfile looks, maybe it needs to be changed?
Use an official Python runtime as a parent image
FROM python:3.9-slim
Set the working directory
WORKDIR /app
Install necessary system dependencies for processing different file formats
RUN apt-get update && apt-get install -y \
ffmpeg \
libsm6 \
libxext6 \
libgl1-mesa-glx \
libjpeg-dev \
zlib1g-dev \
libpng-dev \
libtiff-dev \
libopenjp2-7-dev \
poppler-utils \
tesseract-ocr \
libtesseract-dev \
build-essential \
curl && \
apt-get clean
Reinstall Pillow to ensure compatibility with the system libraries
RUN pip install --no-cache-dir --upgrade pillow
Copy the requirements file and install dependencies
COPY requirements.txt ./
RUN pip install --no-cache-dir -r requirements.txt
Copy the rest of the application code
COPY . .
Expose the necessary ports
EXPOSE 8080/tcp
EXPOSE 8080/udp
Health check to ensure the container is running correctly
HEALTHCHECK --interval=30s --timeout=30s --retries=3 CMD curl --fail http://localhost:8080/ || exit 1
Start Gunicorn server with fewer workers to reduce memory usage
CMD ["gunicorn", "server:app", "--bind", "0.0.0.0:8080", "--workers", "1", "--timeout", "4000"]
ERROR gist
-blocked by CORS
page-d3d0a68ad3d403c8.js:1
net::ERR_FAILED 502 (Bad Gateway)
Error: TypeError: Failed to fetch
at U (page-d3d0a68ad3d403c8.js:1:7757)
Solution:Jump to solution
Hey, please keep in mind that we do not offer urgent supprt to users on the trial or hobby plans, but since im here it would be rude to not answer, just please keep that in mind going forward.
From your deploy logs -
```
[ERROR] Worker (pid:191) was sent SIGKILL! Perhaps out of memory?...
7 Replies
Project ID:
7d96b9ff-377a-4b75-b784-3ab8a1fc1f8f
here's my project ID:
7d96b9ff-377a-4b75-b784-3ab8a1fc1f8f
Solution
Hey, please keep in mind that we do not offer urgent supprt to users on the trial or hobby plans, but since im here it would be rude to not answer, just please keep that in mind going forward.
From your deploy logs -
You are on the trial plan and are running into the memory limits, please upgrade to the Hobby plan and redeploy the service.
thank you brody sorry
so alright memory limit
yes, let me know if you contine to see errors once on the hobby plan
Hi Brody, yes the error is now gone
Thank you!
no problem!