Skip to content

net/http: Server fails to clean up MultipartForm files when Request.WithContext is used #58809

Closed
@JellyZero

Description

@JellyZero

What version of Go are you using (go version)?

$ go version
go version go1.19.5 darwin/arm64

Does this issue reproduce with the latest release?

yes

What operating system and processor architecture are you using (go env)?

go env Output
$ go env
GO111MODULE="on"
GOARCH="arm64"
GOBIN="/Users/jeffreybool/code/go/bin"
GOCACHE="/Users/jeffreybool/Library/Caches/go-build"
GOENV="/Users/jeffreybool/Library/Application Support/go/env"
GOEXE=""
GOEXPERIMENT=""
GOFLAGS=""
GOHOSTARCH="arm64"
GOHOSTOS="darwin"
GOINSECURE=""
GOMODCACHE="/Users/jeffreybool/code/go/pkg/mod"
GONOPROXY="git.xxx.com"
GONOSUMDB="git.xxx.com"
GOOS="darwin"
GOPATH="/Users/jeffreybool/code/go"
GOPRIVATE="git.xxx.com"
GOPROXY="https://goproxy.cn,direct"
GOROOT="/opt/homebrew/Cellar/go/1.19.5/libexec"
GOSUMDB="sum.golang.org"
GOTMPDIR=""
GOTOOLDIR="/opt/homebrew/Cellar/go/1.19.5/libexec/pkg/tool/darwin_arm64"
GOVCS=""
GOVERSION="go1.19.5"
GCCGO="gccgo"
AR="ar"
CC="clang"
CXX="clang++"
CGO_ENABLED="1"
GOMOD="/dev/null"
GOWORK=""
CGO_CFLAGS="-g -O2"
CGO_CPPFLAGS=""
CGO_CXXFLAGS="-g -O2"
CGO_FFLAGS="-g -O2"
CGO_LDFLAGS="-g -O2"
PKG_CONFIG="pkg-config"
GOGCCFLAGS="-fPIC -arch arm64 -pthread -fno-caret-diagnostics -Qunused-arguments -fmessage-length=0 -fdebug-prefix-map=/var/folders/1b/9qbcfwxs19g5k9_5h05_9h9m0000gn/T/go-build2306283356=/tmp/go-build -gno-record-gcc-switches -fno-common"

What did you do?

request, err := http.NewRequest(http.MethodGet,"/test",nil)
	if err != nil {
		return 
	}
	request.WithContext(request.Context())

What did you expect to see?

labstack/echo#2413

What did you see instead?

The pointer address changes after calling the WithContext method, which causes the server. go finishRequest() method to fail to execute normally

Metadata

Metadata

Assignees

No one assigned

    Labels

    FrozenDueToAgeNeedsInvestigationSomeone must examine and confirm this is a valid issue and not a duplicate of an existing one.

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions