Skip to content

Invalid memory address or nil pointer dereference in internal/transport/client_stream.go #8893

@user12031

Description

@user12031

Position:

s.ct.closeStream(s, err, rst, rstCode, status.Convert(err), nil, false)

How to reproduce:
1.Adding time.Sleep(time.Second * 7) at the beginning of the method
func (c *controlBuffer) executeAndPut(f func() bool, it cbItem) (bool, error) {

2.Running the test function
func (s) TestKeepaliveClientStaysHealthyWithResponsiveServer(t *testing.T) {

Bug report:

--- FAIL: TestKeepaliveClientStaysHealthyWithResponsiveServer (14.51s)
panic: runtime error: invalid memory address or nil pointer dereference [recovered]
	panic: runtime error: invalid memory address or nil pointer dereference
[signal SIGSEGV: segmentation violation code=0x1 addr=0x148 pc=0x8c3bed]

goroutine 20 [running]:
testing.tRunner.func1.2({0xad0a00, 0x118d670})
	/home/song2048/桌面/goProject/pkg/mod/golang.org/toolchain@v0.0.1-go1.24.0.linux-amd64/src/testing/testing.go:1734 +0x21c
testing.tRunner.func1()
	/home/song2048/桌面/goProject/pkg/mod/golang.org/toolchain@v0.0.1-go1.24.0.linux-amd64/src/testing/testing.go:1737 +0x35e
panic({0xad0a00?, 0x118d670?})
	/home/song2048/桌面/goProject/pkg/mod/golang.org/toolchain@v0.0.1-go1.24.0.linux-amd64/src/runtime/panic.go:787 +0x132
google.golang.org/grpc/internal/transport.(*ClientStream).Close(0x0, {0xcb0660, 0xc0002de030})
	/home/song2048/桌面/goProject/src/grpc-go-master/internal/transport/client_stream.go:74 +0x2d
google.golang.org/grpc/internal/transport.checkForHealthyStream(0xc0001866c8)
	/home/song2048/桌面/goProject/src/grpc-go-master/internal/transport/keepalive_test.go:814 +0xa5
google.golang.org/grpc/internal/transport.TestKeepaliveClientStaysHealthyWithResponsiveServer(0xc000102e00)
	/home/song2048/桌面/goProject/src/grpc-go-master/internal/transport/keepalive_test.go:413 +0x1c5
testing.tRunner(0xc000102e00, 0xbf07f8)
	/home/song2048/桌面/goProject/pkg/mod/golang.org/toolchain@v0.0.1-go1.24.0.linux-amd64/src/testing/testing.go:1792 +0xf4
created by testing.(*T).Run in goroutine 1
	/home/song2048/桌面/goProject/pkg/mod/golang.org/toolchain@v0.0.1-go1.24.0.linux-amd64/src/testing/testing.go:1851 +0x413


Process finished with the exit code 1

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions