Skip to content

net/http: Post url: read tcp xx->xx: i/o timeout returns less than 1 seconds #27942

@jacentsao

Description

@jacentsao

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

$ go version
go version go1.10.3 windows/amd64

Does this issue reproduce with the latest release?

yes

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

$ go env
set GOARCH=amd64
set GOBIN=
set GOCACHE=C:\Users\xx\AppData\Local\go-build
set GOEXE=.exe
set GOHOSTARCH=amd64
set GOHOSTOS=windows
set GOOS=windows
set GOPATH=G:\workspace\GO
set GORACE=
set GOROOT=C:\Go
set GOTMPDIR=
set GOTOOLDIR=C:\Go\pkg\tool\windows_amd64
set GCCGO=gccgo
set CC=gcc
set CXX=g++
set CGO_ENABLED=1
set CGO_CFLAGS=-g -O2
set CGO_CPPFLAGS=
set CGO_CXXFLAGS=-g -O2
set CGO_FFLAGS=-g -O2
set CGO_LDFLAGS=-g -O2
set PKG_CONFIG=pkg-config
set GOGCCFLAGS=-m64 -mthreads -fno-caret-diagnostics -Qunused-arguments -fmessag                                                                                                                                                                                               e-length=0 -fdebug-prefix-map=C:\Users\xx\AppData\Local\Temp\go-build87870614                                                                                                                                                                                               2=/tmp/go-build -gno-record-gcc-switches

What did you do?


tr = &http.Transport{
	TLSClientConfig: &tls.Config{InsecureSkipVerify: true},
	Dial:            TimeoutDialer(connectTimeout, readWriteTimeout),
}
client := &http.Client{Transport: tr,}
if req, err := client.Post(url, "application/json;charset=utf-8", body); err == nil {
    defer req.Body.Close()
   if result, err := ioutil.ReadAll(req.Body); err == nil {
       Post url: read tcp xx->xx: i/o timeout 
  }
}  else {
   
}

What did you expect to see?

no error occurs

What did you see instead?

I got a timeout error just like below when launch post request it returns error less than 1 seconds

Post url: read tcp xx->xx: i/o timeout 

Metadata

Metadata

Assignees

No one assigned

    Labels

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

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions