Skip to content
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: [signal SIGSEGV: segmentation violation code=0x1] invalid memory address or nil pointer dereference #62133

Closed
linlexing opened this issue Aug 18, 2023 · 7 comments
Labels
NeedsInvestigation Someone must examine and confirm this is a valid issue and not a duplicate of an existing one. WaitingForInfo Issue is not actionable because of missing required information, which needs to be provided.

Comments

@linlexing
Copy link

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

$ go version
go version go1.20.6 linux/arm64

Does this issue reproduce with the latest release?

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

go env Output
$ go env
GO111MODULE="on"
GOARCH="arm64"
GOBIN=""
GOCACHE="/home/huawel/.cache/go-build"
GOENV="/home/huawel/.config/go/env"
GOEXE=""
GOEXPERIMENT=""
GOFLAGS=""
GOHOSTARCH="arm64"
GOHOSTOS="linux"
GOINSECURE=""
GOMODCACHE="/home/huawel/gowork/pkg/mod"
GONOPROXY=""
GONOSUMDB=""
GOOS="linux"
GOPATH="/home/huawel/gowork"
GOPRIVATE=""
GOPROXY="https://goproxy.cn,direct"
GOROOT="/home/huawel/go"
GOSUMDB="sum.golang.org"
GOTMPDIR=""
GOTOOLDIR="/home/huawel/go/pkg/tool/linux_arm64"
GOVCS=""
GOVERSION="go1.20.6"
GCCGO="gccgo"
AR="ar"
CC="gcc"
CXX="g++"
CGO_ENABLED="1"
GOMOD="/dev/null"
GOWORK=""
CGO_CFLAGS="-O2 -g"
CGO_CPPFLAGS=""
CGO_CXXFLAGS="-O2 -g"
CGO_FFLAGS="-O2 -g"
CGO_LDFLAGS="-O2 -g"
PKG_CONFIG="pkg-config"
GOGCCFLAGS="-fPIC -pthread -Wl,--no-gc-sections -fmessage-length=0 -fdebug-prefix-map=/tmp/go-build1090095046=/tmp/go-build -gno-record-gcc-switches"

What did you do?

What did you expect to see?

What did you see instead?

panic: runtime error: invalid memory address or nil pointer dereference
[signal SIGSEGV: segmentation violation code=0x1 addr=0x4f pc=0x46cc48]

goroutine 53571406 [running]:
internal/poll.runtime_pollSetDeadline(0x4f, 0x12a05f002, 0x77)
/home/huawel/go/src/runtime/netpoll.go:328 +0x28
internal/poll.setDeadlineImpl(0x403e945380, {0x470580?, 0x0?, 0x3c6dec0?}, 0x400484f988?)
/home/huawel/go/src/internal/poll/fd_poll_runtime.go:161 +0x1a8
internal/poll.(*FD).SetWriteDeadline(...)
/home/huawel/go/src/internal/poll/fd_poll_runtime.go:143
net.(*netFD).SetWriteDeadline(...)
/home/huawel/go/src/net/fd_posix.go:146
net.(*conn).SetWriteDeadline(0x405aeee678, {0x63d534?, 0x400484f988?, 0x3c6dec0?})
/home/huawel/go/src/net/net.go:261 +0x3c
crypto/tls.(*Conn).SetWriteDeadline(...)
/home/huawel/go/src/crypto/tls/conn.go:153
crypto/tls.(*Conn).closeNotify(0x4021a9d500)
/home/huawel/go/src/crypto/tls/conn.go:1400 +0x104
crypto/tls.(*Conn).Close(0x4021a9d500)
/home/huawel/go/src/crypto/tls/conn.go:1370 +0x8c
net/http.(*conn).close(0x4027d76360)
/home/huawel/go/src/net/http/server.go:1734 +0x34
net/http.(*conn).serve.func1()
/home/huawel/go/src/net/http/server.go:1865 +0x198
net/http.(*conn).serve(0x4027d76360, {0x245d140, 0x4001426420})
/home/huawel/go/src/net/http/server.go:2031 +0x654
created by net/http.(*Server).Serve
/home/huawel/go/src/net/http/server.go:3089 +0x4e8

@linlexing linlexing changed the title affected/package: affected/package: net/http [signal SIGSEGV: segmentation violation code=0x1] invalid memory address or nil pointer dereference Aug 18, 2023
@seankhliao
Copy link
Member

how do we reproduce this? I don't think there's sufficient information for us to do anything with this report?

@seankhliao seankhliao added the WaitingForInfo Issue is not actionable because of missing required information, which needs to be provided. label Aug 18, 2023
@panjf2000
Copy link
Member

panjf2000 commented Aug 18, 2023

I've browsed the source code which raised a panic by backtracing your stack message but it seemed unlikely to cause a panic of "invalid memory address or nil pointer dereference" there, I'm afraid that we need more info here, a reproducible code example would be the best, if not, at least share more details and context info at the time.

@panjf2000 panjf2000 added the NeedsInvestigation Someone must examine and confirm this is a valid issue and not a duplicate of an existing one. label Aug 18, 2023
@quki3
Copy link

quki3 commented Aug 18, 2023

  1. you have all the permission for run ?
  2. panic: runtime error: invalid memory address or nil pointer dereference} //... this maybe happen if you don't use a pointer correctly

@seankhliao seankhliao changed the title affected/package: net/http [signal SIGSEGV: segmentation violation code=0x1] invalid memory address or nil pointer dereference net/http: [signal SIGSEGV: segmentation violation code=0x1] invalid memory address or nil pointer dereference Aug 18, 2023
@bcmills bcmills added WaitingForInfo Issue is not actionable because of missing required information, which needs to be provided. and removed WaitingForInfo Issue is not actionable because of missing required information, which needs to be provided. labels Aug 18, 2023
@linlexing
Copy link
Author

linlexing commented Sep 11, 2023

I am sorry that I have not checked the reply for a long time. This is an accidental error in the production system. I am sorry that I cannot provide the fault recurrence code.but today again:

panic: runtime error: invalid memory address or nil pointer dereference
[signal SIGSEGV: segmentation violation code=0x1 addr=0x32 pc=0x46cc48]

goroutine 56206765 [running]:
internal/poll.runtime_pollSetDeadline(0x32, 0x12a05ef30, 0x77)
        /home/huawel/go/src/runtime/netpoll.go:328 +0x28
internal/poll.setDeadlineImpl(0x40c9d81d00, {0x470580?, 0x0?, 0x3c931c0?}, 0x2479b40?)
        /home/huawel/go/src/internal/poll/fd_poll_runtime.go:161 +0x1a8
internal/poll.(*FD).SetWriteDeadline(...)
        /home/huawel/go/src/internal/poll/fd_poll_runtime.go:143
net.(*netFD).SetWriteDeadline(...)
        /home/huawel/go/src/net/fd_posix.go:146
net.(*conn).SetWriteDeadline(0x404a327f00, {0x63d534?, 0x407347b988?, 0x3c931c0?})
        /home/huawel/go/src/net/net.go:261 +0x3c
crypto/tls.(*Conn).SetWriteDeadline(...)
        /home/huawel/go/src/crypto/tls/conn.go:153
crypto/tls.(*Conn).closeNotify(0x40207b4a80)
        /home/huawel/go/src/crypto/tls/conn.go:1400 +0x104
crypto/tls.(*Conn).Close(0x40207b4a80)
        /home/huawel/go/src/crypto/tls/conn.go:1370 +0x8c
net/http.(*conn).close(0x4016c13e60)
        /home/huawel/go/src/net/http/server.go:1734 +0x34
net/http.(*conn).serve.func1()
        /home/huawel/go/src/net/http/server.go:1865 +0x198
net/http.(*conn).serve(0x4016c13e60, {0x2479b40, 0x4001560420})
        /home/huawel/go/src/net/http/server.go:2031 +0x654
created by net/http.(*Server).Serve
        /home/huawel/go/src/net/http/server.go:3089 +0x4e8

Used a self-signed security certificate,There are a lot of the following logs:

/home/huawel/go/src/net/http/server.go:3217: http: TLS handshake error from ******: remote error: tls: unknown certificate

and

/home/huawel/go/src/net/http/server.go:3217: http: TLS handshake error from ******: EOF

@linlexing
Copy link
Author

go v1.20.8 same error

@seankhliao seankhliao added WaitingForInfo Issue is not actionable because of missing required information, which needs to be provided. and removed WaitingForInfo Issue is not actionable because of missing required information, which needs to be provided. labels Sep 15, 2023
@linlexing
Copy link
Author

Two new anomalies. I don't know if they'll help(go version go1.20.8 linux/arm64):

unexpected fault address 0x206574616470ad
fatal error: fault
[signal SIGSEGV: segmentation violation code=0x1 addr=0x206574616470ad pc=0x6de7e0]

goroutine 176401634 [running]:
runtime.throw({0x2051a37?, 0x6de5c4?})
        /home/huawel/go/src/runtime/panic.go:1047 +0x40 fp=0x4013436ef0 sp=0x4013436ec0 pc=0x43c520
runtime.sigpanic()
        /home/huawel/go/src/runtime/signal_unix.go:855 +0x1a8 fp=0x4013436f30 sp=0x4013436ef0 pc=0x453e98
net/http.(*http2priorityNode).setParent(0x18?, 0x1e08dc0?)
        /home/huawel/go/src/net/http/h2_bundle.go:10830 +0x20 fp=0x4013436f60 sp=0x4013436f40 pc=0x6de7e0
net/http.(*http2priorityWriteScheduler).removeNode(0x4059fa96c0, 0x4044f49780)
        /home/huawel/go/src/net/http/h2_bundle.go:11166 +0x3c fp=0x4013436f90 sp=0x4013436f60 pc=0x6dfc0c
net/http.(*http2priorityWriteScheduler).addClosedOrIdleNode(0x1d94820?, 0x4059fa9728, 0x40000000df?, 0x4004bdc660)
        /home/huawel/go/src/net/http/h2_bundle.go:11156 +0x3c fp=0x4013436ff0 sp=0x4013436f90 pc=0x6dfa7c
net/http.(*http2priorityWriteScheduler).CloseStream(0x4059fa96c0, 0xdf)
        /home/huawel/go/src/net/http/h2_bundle.go:11026 +0x1f4 fp=0x4013437070 sp=0x4013436ff0 pc=0x6df274
net/http.(*http2serverConn).closeStream(0x4043302000, 0x40158e6630, {0x24b30c0, 0x400003c9b0})
        /home/huawel/go/src/net/http/h2_bundle.go:5398 +0x268 fp=0x40134370d0 sp=0x4013437070 pc=0x6c56f8
net/http.(*http2serverConn).wroteFrame(0x4043302000, {{}, {{0x24bef88, 0x405e194720}, 0x40158e6630, 0x4007897ec0}, {0x0, 0x0}})
        /home/huawel/go/src/net/http/h2_bundle.go:5045 +0xe8 fp=0x4013437150 sp=0x40134370d0 pc=0x6c40d8
net/http.(*http2serverConn).startFrameWrite(0x4043302000, {{0x24bef88, 0x405e194720}, 0x40158e6630, 0x4007897ec0})
        /home/huawel/go/src/net/http/h2_bundle.go:4997 +0x1b8 fp=0x4013437210 sp=0x4013437150 pc=0x6c3d88
net/http.(*http2serverConn).scheduleFrameWrite(0x4043302000)
        /home/huawel/go/src/net/http/h2_bundle.go:5102 +0xe0 fp=0x4013437250 sp=0x4013437210 pc=0x6c4350
net/http.(*http2serverConn).wroteFrame(0x4043302000, {{}, {{0x24bf000, 0x4050600150}, 0x40158e66e0, 0x407d4ed7a0}, {0x0, 0x0}})
        /home/huawel/go/src/net/http/h2_bundle.go:5062 +0x1d4 fp=0x40134372d0 sp=0x4013437250 pc=0x6c41c4
net/http.(*http2serverConn).serve(0x4043302000)
        /home/huawel/go/src/net/http/h2_bundle.go:4683 +0xa3c fp=0x40134377f0 sp=0x40134372d0 pc=0x6c2a7c
net/http.(*http2Server).ServeConn(0x4002b0e370, {0x24d14f0?, 0x400ee9e380}, 0x4013437b08)
        /home/huawel/go/src/net/http/h2_bundle.go:4270 +0x99c fp=0x4013437ac0 sp=0x40134377f0 pc=0x6c0edc
net/http.http2ConfigureServer.func1(0x40003501e0, 0x24d14f0?, {0x24baa00, 0x402fc1ff20})
        /home/huawel/go/src/net/http/h2_bundle.go:4060 +0xd0 fp=0x4013437b60 sp=0x4013437ac0 pc=0x6c0500
net/http.(*conn).serve(0x4030d4bb90, {0x24c63e0, 0x400026ab40})
        /home/huawel/go/src/net/http/server.go:1903 +0xf0c fp=0x4013437fa0 sp=0x4013437b60 pc=0x6ef8cc
net/http.(*Server).Serve.func3()
        /home/huawel/go/src/net/http/server.go:3089 +0x30 fp=0x4013437fd0 sp=0x4013437fa0 pc=0x6f3f90
runtime.goexit()
        /home/huawel/go/src/runtime/asm_arm64.s:1172 +0x4 fp=0x4013437fd0 sp=0x4013437fd0 pc=0x473c14
created by net/http.(*Server).Serve
        /home/huawel/go/src/net/http/server.go:3089 +0x4e8

and

panic: inconsistent poll.fdMutex

goroutine 120754549 [running]:
internal/poll.(*fdMutex).rwunlock(0x4030633748?, 0x20?)
        /home/huawel/go/src/internal/poll/fd_mutex.go:179 +0x100
internal/poll.(*FD).readUnlock(0x40315c1200)
        /home/huawel/go/src/internal/poll/fd_mutex.go:231 +0x28
internal/poll.(*FD).Read(0x40315c1200, {0x4036143500, 0x1a80, 0x1a80})
        /home/huawel/go/src/internal/poll/fd_unix.go:173 +0x2c8
net.(*netFD).Read(0x40315c1200, {0x4036143500?, 0x40306339a8?, 0x638988?})
        /home/huawel/go/src/net/fd_posix.go:55 +0x28
net.(*conn).Read(0x40313a4340, {0x4036143500?, 0x40306338c8?, 0x41a3e8?})
        /home/huawel/go/src/net/net.go:183 +0x34
crypto/tls.(*atLeastReader).Read(0x4016c07bd8, {0x4036143500?, 0x4016c07bd8?, 0x0?})
        /home/huawel/go/src/crypto/tls/conn.go:788 +0x40
bytes.(*Buffer).ReadFrom(0x4028a77410, {0x24b2800, 0x4016c07bd8})
        /home/huawel/go/src/bytes/buffer.go:202 +0x90
crypto/tls.(*Conn).readFromUntil(0x4028a77180, {0x24b5800?, 0x40313a4340}, 0xfffedd8c3fc0?)
        /home/huawel/go/src/crypto/tls/conn.go:810 +0xd0
crypto/tls.(*Conn).readRecordOrCCS(0x4028a77180, 0x0)
        /home/huawel/go/src/crypto/tls/conn.go:617 +0xd4
crypto/tls.(*Conn).readRecord(...)
        /home/huawel/go/src/crypto/tls/conn.go:583
crypto/tls.(*Conn).Read(0x4028a77180, {0x40318b4120, 0x9, 0x44fdec?})
        /home/huawel/go/src/crypto/tls/conn.go:1316 +0x170
io.ReadAtLeast({0xfffeb42d6a58, 0x4028a77180}, {0x40318b4120, 0x9, 0x9}, 0x9)
        /home/huawel/go/src/io/io.go:332 +0xa0
io.ReadFull(...)
        /home/huawel/go/src/io/io.go:351
net/http.http2readFrameHeader({0x40318b4120?, 0x9?, 0x1?}, {0xfffeb42d6a58?, 0x4028a77180?})
        /home/huawel/go/src/net/http/h2_bundle.go:1567 +0x58
net/http.(*http2Framer).ReadFrame(0x40318b40e0)
        /home/huawel/go/src/net/http/h2_bundle.go:1831 +0x80
net/http.(*http2serverConn).readFrames(0x4025301ba0)
        /home/huawel/go/src/net/http/h2_bundle.go:4560 +0x84
created by net/http.(*http2serverConn).serve
        /home/huawel/go/src/net/http/h2_bundle.go:4667 +0x480

@seankhliao seankhliao added WaitingForInfo Issue is not actionable because of missing required information, which needs to be provided. and removed WaitingForInfo Issue is not actionable because of missing required information, which needs to be provided. labels Oct 10, 2023
@gopherbot
Copy link

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.)

@gopherbot gopherbot closed this as not planned Won't fix, can't repro, duplicate, stale Nov 10, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
NeedsInvestigation Someone must examine and confirm this is a valid issue and not a duplicate of an existing one. WaitingForInfo Issue is not actionable because of missing required information, which needs to be provided.
Projects
None yet
Development

No branches or pull requests

6 participants