When using MinIO as file storage uploading release attachments causes #10406

Closed
opened 2025-11-02 09:06:39 -06:00 by GiteaMirror · 0 comments
Owner

Originally created by @prskr on GitHub (Mar 9, 2023).

Description

When creating a release e.g. with GoReleaser I noticed a memory spike when release artifacts are uploaded.
I had to increase the memory limit to ~3GB for my small self-hosted, personal Gitea instance whereas it normally barely exceeds 300MB.

I enabled the pprof endpoint, collected a heap dump and noticed that:

putObjectMultipartStreamNoLength is the function consuming suddently >1.2GB of RAM although I was only uploading ~50MB of artifacts.

The issues is obviously because the original file size is not passed through the chain so the MinIO client doesn't have access to it and has to fall back reading everything to memory.

I played around with the code and could prepare a (quite easy) fix and already tested it on my private instance and it works.
Will create a PR tomorrow (or so).

Let me know if you need further information :)

Gitea Version

v1.18.3

Can you reproduce the bug on the Gitea demo site?

No

Log Gist

No response

Screenshots

No response

Git Version

No response

Operating System

No response

How are you running Gitea?

Gitea Helm chart

Database

PostgreSQL

Originally created by @prskr on GitHub (Mar 9, 2023). ### Description When creating a release e.g. with GoReleaser I noticed a memory spike when release artifacts are uploaded. I had to increase the memory limit to ~3GB for my small self-hosted, personal Gitea instance whereas it normally barely exceeds 300MB. I enabled the pprof endpoint, collected a heap dump and noticed that: ` putObjectMultipartStreamNoLength` is the function consuming suddently >1.2GB of RAM although I was only uploading ~50MB of artifacts. The issues is obviously because the original file size is not passed through the chain so the MinIO client doesn't have access to it and has to fall back reading everything to memory. I played around with the code and could prepare a (quite easy) fix and already tested it on my private instance and it works. Will create a PR tomorrow (or so). Let me know if you need further information :) ### Gitea Version v1.18.3 ### Can you reproduce the bug on the Gitea demo site? No ### Log Gist _No response_ ### Screenshots _No response_ ### Git Version _No response_ ### Operating System _No response_ ### How are you running Gitea? Gitea Helm chart ### Database PostgreSQL
GiteaMirror added the type/bug label 2025-11-02 09:06:39 -06:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github-starred/gitea#10406