ECONNRESET on FastAPI Image Processing with Large Files (Timeout Suspected?)

Hi Render Community,

I have a FastAPI (Python) web service deployed on Render that processes images and returns Base64 data. It works perfectly fine for smaller images (e.g., 1024x1024), completing in about 2 seconds according to logs.

However, when processing large images (~12MB file size, ~64MP resolution), my client (Make.com) consistently receives an ECONNRESET error.

Troubleshooting done:

  1. Render Logs: For the failing requests, I don’t see specific Python errors (MemoryError) or OOM killer messages. Logs for successful smaller images show the full process completing and returning 200 OK.

  2. Render Metrics: I’m on a plan with 2GB RAM, but memory usage stays low during attempts (<150MB). CPU usage spikes but doesn’t hit the limit. RAM doesn’t seem to be the issue.

  3. Local Testing: Processing the same large image locally takes 30-60 seconds on my fast desktop CPU.

My hypothesis is that the processing time on Render’s hardware significantly exceeds the local time, hitting a default HTTP request timeout limit before the response can be sent, thus causing the ECONNRESET.

Does this sound like the likely cause? What are the typical request timeouts for Render web services? Is the best practice here to implement background workers, or are there other viable options like increasing timeouts or instance CPU?

Thanks for any insights!