Go version

go version go1.24.4 darwin/arm64

Output of go env in your module/workspace:

none

What did you do?

https://github.com/open-telemetry/opentelemetry-go-contrib/issues/5946#issuecomment-3028290240

What did you see happen?

Please check the relevant links.

What did you expect to see?

What I want to confirm is whether it is a underlying error, or if it is an issue arising from improper usage.

Comment From: dr2chase

@neild, @rsc, maybe this is for you?

Comment From: flc1125

@seankhliao I think this issue might not be related to user habits and should not have been closed.

When we call request.WithContext, most users are not aware that they need to execute request.ParseMultipartForm.RemoveAll(). This situation essentially goes beyond the scope of any framework.

Go provides these capabilities but does not offer best practices. Users thus don't understand how to properly handle them.

Improper handling may even lead to IO saturation, causing service abnormalities.

Therefore, I suggest reopening the issue to obtain further information.

The following situations exist (tested and confirmed):

  1. We executed request.WithContext() before executing request.ParseMultipartForm, but did not manually call RemoveAll on the new Request—it will be unable to delete the files;
  2. We executed request.WithContext() before executing request.ParseMultipartForm, and manually called RemoveAll on the new Request—it will delete the files;
  3. We executed request.WithContext() after executing request.ParseMultipartForm, and did not manually call RemoveAll on the new Request—it will delete the files.