sanch
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)
11 replies