hertz: long running process crashed here

Describe the bug

long running process crashed

To Reproduce

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

goroutine 359534 [running]:
github.com/cloudwego/hertz/pkg/network/standard.(*Conn).Len(...)
        /root/go/pkg/mod/github.com/cloudwego/hertz@v0.6.0/pkg/network/standard/connection.go:438
github.com/cloudwego/hertz/pkg/network/standard.(*Conn).Read(0x44a693?, {0xc000edce78?, 0x1?, 0x0?})
        /root/go/pkg/mod/github.com/cloudwego/hertz@v0.6.0/pkg/network/standard/connection.go:82 +0x22
io.ReadAtLeast({0x7fcbc1083e90, 0xc000e95780}, {0xc000edce78, 0x9, 0x9}, 0x9)
        /usr/local/go/src/io/io.go:332 +0x9a
io.ReadFull(...)
        /usr/local/go/src/io/io.go:351
github.com/hertz-contrib/http2.readFrameHeader({0xc000edce78?, 0x9?, 0xc00174a880?}, {0x7fcbc1083e90?, 0xc000e95780?})
        /root/go/pkg/mod/github.com/hertz-contrib/http2@v0.1.5/frame.go:253 +0x6e
github.com/hertz-contrib/http2.(*Framer).ReadFrame(0xc000edce40)
        /root/go/pkg/mod/github.com/hertz-contrib/http2@v0.1.5/frame.go:503 +0x95
github.com/hertz-contrib/http2.(*serverConn).readFrames(0xc000ba1500)
        /root/go/pkg/mod/github.com/hertz-contrib/http2@v0.1.5/server.go:526 +0x91
created by github.com/hertz-contrib/http2.(*serverConn).serve
        /root/go/pkg/mod/github.com/hertz-contrib/http2@v0.1.5/server.go:625 +0x4d2
child 1 exited with error: exit status 2

Expected behavior

pls check the code

Hertz version:

0.6.0

About this issue

  • Original URL
  • State: closed
  • Created a year ago
  • Comments: 15 (11 by maintainers)

Most upvoted comments

Hello, this issue was caused by goroutine calling the write interface after the connection was closed. Today, we reviewed the exposed interfaces and found that the problem may be caused by your call to ctx.GetConn().Close() which closes the connection. Therefore, we have implemented a fallback version that can completely solve this issue. Currently, this branch can be used for urgent repairs, but if you are not in a hurry, you can wait for us to verify and release a new version before using it.

@Duslia i will after this issue is fixed because now it’s crashable.

@wzekin ok i can wait. pls update it. @Duslia yes i used ctx.GetConn().Close() a lot of places. almost everywhere.

pls do mention when the update will happen. coz it’s being used in production now.