502 Bad Gateway with Large Files

Hello, I am having some trouble with my Web Service application. I use python with Flask. The application works well for the most part, but I have a dropbox in which the user can drop pdfs which are sent to another backend to get some stuff done on them. If I use a small pdf, it works flawlessly, but the moment I choose to use a larger pdf (not even that large, around 650 kb) both Web Services stop logging and after a minute or two I get a 502 Bad Gateway and both servers get restarted.

It is most definitely not a PORT problem; the problem probably has to do with the amount of resources available, after all I’m using the free tier for both Web Services. I would have no problem in paying 14 dollars to host both servers, but I don’t know if that would solve the problem as I don’t see any log or event that could help me understand the root of the issue! Could the request be getting timed out? But in that case why would it stop logging even the healthcheck?

I am using Flask in the main Web Service and FastAPI in the one that does stuff to the pdfs

Has anyone faced a similar situation?
Thank you in advance

Okay I’ve been able to get some logging going, I’m still not sure why the previous configuration didn’t work, but it doesn’t matter now.
Okay I just realized instead of queueing the task I was just waiting until it ended during the POST, so when it takes close to 2 minutes, the app gets restarted and I get the 502 message
My bad!

We are encountering a similar issue right now. Could you elaborate a little bit on what was the issue? We are also working with pdfs in FastAPI background tasks and getting 502. It seems to be like there might be an outage on render side

Have you timed how long the request lasts before sending the 502?

My problem lied on the fact that instead of sending the pdf analysis to a query, I was trying to resolve it before sending a 200 POST, so the POST request after 2 minutes basically gave up. Now I am correctly sending it as a background task, but it seems like it is still having trouble every now and then. I have no idea why, it is most likely a timeout on Render side but apparently there is no timeout, even on the free instances.
Are you using a paid instance or a free one?
I don’t think it is a resources issue since many have commented they got to see an event on the Render dashboard when that was the case.
I am sorry that I am not much help