Validate() opens the uploaded file to sniff the content type and never closes it. For any part above the adapter’s multipart memory threshold, that handle is a real file on disk, so the descriptor and its blocks stay held until the finalizer runs. multipart.Form.RemoveAll() only unlinks the temp file; it doesn’t close anything, so a service doing a lot of uploads can drift on file descriptors and ephemeral disk with nothing obvious pointing at the cause.
A deferred close in Validate() should cover that path. readFile() also opens the file before validation and returns without closing it when validation fails, so that path should be fixed too. Still present in v2.39.0.
Validate()opens the uploaded file to sniff the content type and never closes it. For any part above the adapter’s multipart memory threshold, that handle is a real file on disk, so the descriptor and its blocks stay held until the finalizer runs.multipart.Form.RemoveAll()only unlinks the temp file; it doesn’t close anything, so a service doing a lot of uploads can drift on file descriptors and ephemeral disk with nothing obvious pointing at the cause.A deferred close in
Validate()should cover that path.readFile()also opens the file before validation and returns without closing it when validation fails, so that path should be fixed too. Still present in v2.39.0.