Temporary large disk usage crashing Strapi

System Information
  • Strapi Version: 3.6.8
  • Operating System: Linux
  • Database: Postgres
  • Node Version: Node 12

Hey Strapi community,

I have been experiencing some odd issues on my Strapi server and I’m curious if someone can give me any ideas as to why I’m getting disk usage alerts that are very temporary but causes crashes every now and again.

I have alerts setup for 20% of my disk usage, and another alert for when the disk usage is healthy again.
During this time however sometimes the server seems to not respond for a while or just simply not respond at all for like 30-60 seconds, and then it seems to come back. It must be disk space related?

I checked right now we have 90% free space on the server.
I get emails though saying I have only 20% left, and without failure a few minutes later I’ll get an alert saying the disk is back to 90% free space.

Some info about our setup:
Strapi, Postgres DB, hosted on Platform.sh
We now have 4096MB total on our Production environment, which is way more than should be necessary I would think.

Could Strapi possibly be doing something that causes this disk space to temporarily fill up entirely?
It occurs only when I am making calls to the API in quick succession (nothing crazy, but I am using it rather heavily for a few applications), so I’m thinking something to do with temp files?

Thank you in advance!

After getting an input about this from @DMehaffy in Strapi discord channel, if you’re using the upload plugin (any provider) to upload multiple files, they aren’t properly purged from /tmp folder, which can lead to the high disk storage usage.

Until the bug is solved, you can use a cron job to delete the files inside /tmp that are no longer needed.

One more thing, the recommended settings for the server is
“Minimum required storage space recommended by your OS or 32 GB of free space” based on Strapi docs.

Github issue: Temp files remain in /tmp directory after successful file uploads that can leave device out of space · Issue #10565 · strapi/strapi · GitHub

1 Like

Thank you for the reply, this definitely could be my issue here. I’ve since resolved the problem by being more efficient about my API usage but I will look into this.