Memory leak in FastAPI only on Railway

maximilianvb
HOBBY

a year ago

Hi, I have a FastAPI backend that does a lot of computation (puts a lot into RAM). When the service is restarted it is idling around 100mb RAM usage. However, on every subsequent call of one of my endpoint it just piles up more RAM usage over time even when taking precautions such as deleting variables and stuff manually.

This does not happen locally (goes back to 100mb RAM usage).

This leads me to believe there is something wrong with the Railway deployment.

I'm a bit uncertain how I'm even going to debug it without deploying the same service on another provider and see if the issue persists. Any suggestions?

Solved

1 Replies

a year ago

I'm sorry but this would be an issue with your application not the platform, unfortunately working as intended locally does not rule out a code issue.

The best advice I could give would be to write clean and efficient code, put as little data into ram as possible, and make sure your local development environment is as close as the final container on Railway as possible (same python version, etc)


Status changed to Solved Railway about 1 year ago


Memory leak in FastAPI only on Railway - Railway Help Station