Skip to content

runtime: panic in conn.ok() #41694

Closed
Closed
@zhangshishen

Description

@zhangshishen

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

$ go version
go 1.13

Does this issue reproduce with the latest release?

Don't know, I can't reproduce

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

go env Output
$ go env

GOARCH="amd64"
GOBIN=""
GOEXE=""
GOFLAGS=""
GOHOSTARCH="amd64"
GOHOSTOS="linux"
GOOS="linux"
GOPROXY=""
GORACE=""
GOROOT="/opt/go/go"
GOTMPDIR=""
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-build345399552=/tmp/go-build -gno-record-gcc-switches"

What did you do?

Access *net.TCPConn parallel, panic in net.conn.ok()

I get the panic stack by debug.Stack()

Recovered panic stack is:

1752602 goroutine 313367 [running]:
1752603 runtime/debug.Stack(0xc00d43ddd8, 0xbdc5c0, 0x1609300)
1752604 /usr/local/go/src/runtime/debug/stack.go:24 +0x9d
1752605 /rtcgw/pkg/panicutil.CheckPanic()
1752606 /rtcgw/pkg/panicutil/panic_check.go:28 +0x46
1752607 panic(0xbdc5c0, 0x1609300)
1752608 /usr/local/go/src/runtime/panic.go:679 +0x1b2
1752609 net.(*conn).ok(...)
1752610 /usr/local/go/src/net/net.go:175
1752611 net.(*conn).RemoteAddr(...)
1752612 /usr/local/go/src/net/net.go:229
1752613 /rtcgw/pkg/ice.(*tcpPacketConn).ReadFrom(0xc01a639560, 0xc03eedc000, 0x2000, 0x2000, 0xc04f490720, 0x10, 0xc024056000, 0x6c, 0x640)
1752614 /rtcgw/pkg/ice/candidateTcp.go:280 +0x9d
1752615 /rtcgw/pkg/ice.(*candidateBase).recv(0xc009008bb0)
1752616 /rtcgw/pkg/ice/candidateBase.go:100 +0x141
1752617 created by /rtcgw/pkg/ice.(*candidateBase).start
1752618 /rtcgw/pkg/ice/candidateBase.go:91 +0x78

What did you expect to see?

conn.ok() in go 1.13 is:

...
135 func (c *conn) ok() bool { return c != nil && c.fd != nil }
...

I don't know why it got panic here.

Seems that nil pointer wouldn't cause panic, and I've never used unsafe ptr.

What did you see instead?

panic in conn.ok(),

I'm not sure if it's my code's bug or the output of debug.Stack() is not accurate, or sth else.

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

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions