Skip to content

net/http: RoundTripper is not sending tcp fin packet after response body close, even on exit #41342

Closed
@mikumiku2468

Description

@mikumiku2468

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

$ go version
go version go1.14.4 linux/amd64

Does this issue reproduce with the latest release?

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

GO111MODULE=""
GOARCH="amd64"
GOBIN=""
GOCACHE="/root/.cache/go-build"
GOENV="/root/.config/go/env"
GOEXE=""
GOFLAGS=""
GOHOSTARCH="amd64"
GOHOSTOS="linux"
GOINSECURE=""
GONOPROXY=""
GONOSUMDB=""
GOOS="linux"
GOPATH="/root/go"
GOPRIVATE=""
GOPROXY="https://proxy.golang.org,direct"
GOROOT="/usr/lib/go-1.14"
GOSUMDB="sum.golang.org"
GOTMPDIR=""
GOTOOLDIR="/usr/lib/go-1.14/pkg/tool/linux_amd64"
GCCGO="gccgo"
AR="ar"
CC="gcc"
CXX="g++"
CGO_ENABLED="1"
GOMOD=""
CGO_CFLAGS="-g -O2"
CGO_CPPFLAGS=""
CGO_CXXFLAGS="-g -O2"
CGO_FFLAGS="-g -O2"
CGO_LDFLAGS="-g -O2"
PKG_CONFIG="pkg-config"
GOGCCFLAGS="-fPIC -m64 -pthread -fmessage-length=0 -fdebug-prefix-map=/tmp/go-build841420152=/tmp/go-build -gno-record-gcc-switches

go env Output
$ go env

What did you do?

package main

import (
"net/http"
"io/ioutil"
)

//var a string

func main() {
conntransport := &http.Transport{
DisableKeepAlives: true,
DisableCompression: true,
}
client := &http.Client{Transport: conntransport}
req, _ := http.NewRequest("GET", "http://10.255.254.161", nil)
req.Header.Set("User-Agent", "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/85.0.4183.83 Safari/537.36")
resp,_:=client.Do(req)
ioutil.ReadAll(resp.Body)
defer resp.Body.Close()
}

What did you expect to see?

I expect to see the tcp fin packet or tcp rst packet send after I use resp.Body.Close()

What did you see instead?

after I recv response from server
server send tcp fin psh ack flag packet
and I send tcp fin ack flag packet
and server send tcp ack packet
and client not send tcp fin or tcp rst packet

Metadata

Metadata

Assignees

No one assigned

    Labels

    FrozenDueToAgeWaitingForInfoIssue is not actionable because of missing required information, which needs to be provided.

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions