net: Not close accept conn when epoll failed #34392
Labels
FrozenDueToAge
NeedsInvestigation
Someone must examine and confirm this is a valid issue and not a duplicate of an existing one.
What version of Go are you using (
go version
)?go version go1.12.9 linux/amd64
Does this issue reproduce with the latest release?
Code review
What operating system and processor architecture are you using (
go env
)?[root@test-master1 ~]# go env
GOARCH="amd64"
GOBIN=""
GOCACHE="/root/.cache/go-build"
GOEXE=""
GOFLAGS=""
GOHOSTARCH="amd64"
GOHOSTOS="linux"
GOOS="linux"
GOPATH="/root/go"
GOPROXY=""
GORACE=""
GOROOT="/usr/local/go"
GOTMPDIR=""
GOTOOLDIR="/usr/local/go/pkg/tool/linux_amd64"
GCCGO="gccgo"
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-build784496647=/tmp/go-build -gno-record-gcc-switches"
go env
OutputWhat did you do?
Code review
What did you expect to see?
In the code below(net/fd_unix.go), when netfd.init() return err not nil, it will close listen socket, but at this time,
fd.pfd.Accept()
has established a connection, it has nowhere to close the connection.What did you see instead?
I test the case, step as below:
1:build the code below
2:gdb test
3:gdb# b fd_unix.go:250 //This is the code
if err = netfd.init(); err != nil
inaccept
function4: telnet 127.0.0.1 19090
5: step into function
net.init
->poll.Init
->poll.init
6: after run
runtime_pollOpen
,set errno=1
manually in gdb7: gdb# c
At this time, when run netstat it shows below, the server stuck in CLOSE_WAIT, and the
accept
connection still there.And when telnet again, it shows below
I try to add the code below, it will close the
accept
connection, but the server will be in TIME_WAIT, because there is no listen socket, it can't establish new connection. So when telnet ,it refused.I think the code should like below.
When start new start, it will establish a new connection
I think this is should be the notmal way
The text was updated successfully, but these errors were encountered: