New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
net/http: RoundTripper is not sending tcp fin packet after response body close, even on exit #41342
Comments
I forgot to say |
I am not able to reproduce this locally, or I am missing something about your issue. The socket looks to be successfully closing to me.
As an aside, I believe Does calling |
Hi toothrot 10.255.254.161 is server and 10.0.2.15 is client for HTTP disablekeepalive is true since I want use 1 socket(tcp connection) per http request tcpdump all log |
here is the code of test import ( //var a string func main() {
} |
is this golang bug?
CentOS server uses tcpdump to capture packets as follows,it shows not send FIN
|
Timed out in state WaitingForInfo. Closing. (I am just a bot, though. Please speak up if this is a mistake or you have the requested information.) |
What version of Go are you using (
go version
)?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
OutputWhat 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
The text was updated successfully, but these errors were encountered: