pinpoint-apm/pinpoint-go-agent

nil pointer dereference bug report

Closed this issue · 2 comments

tuyy commented

Hello, I'm using the pinpoint-go-agent well.

I'm reporting the following bugs intermittently.

Is it a bug solved in v1.3.4 by any chance?

golang & Library information in use

  • golang version 1.21.3
  • github.com/pinpoint-apm/pinpoint-go-agent v1.3.0
  • github.com/pinpoint-apm/pinpoint-go-agent/plugin/gin v1.2.0
  • github.com/pinpoint-apm/pinpoint-go-agent/plugin/goredisv8 v1.3.0
  • github.com/pinpoint-apm/pinpoint-go-agent/plugin/mysql v1.3.0
2023-11-28T20:32:54.685  panic: runtime error: invalid memory address or nil pointer dereference
2023-11-28T20:32:54.685  [signal SIGSEGV: segmentation violation code=0x1 addr=0x0 pc=0x5faa9b]
2023-11-28T20:32:54.685  
2023-11-28T20:32:54.685  goroutine 192 [running]:
2023-11-28T20:32:54.685  github.com/golang/protobuf/proto.(*textWriter).writeQuotedString(0xc00b0df3e0, {0x0, 0x5})
2023-11-28T20:32:54.685  	/go/pkg/mod/github.com/golang/protobuf@v1.5.3/proto/text_encode.go:410 +0xfb
2023-11-28T20:32:54.685  github.com/golang/protobuf/proto.(*textWriter).writeSingularValue(0xc00b0df3e0, {{}, 0xf28840?, 0x0?, 0xc033baf3a0?}, {0x125d670, 0xc0005ea7e0})
2023-11-28T20:32:54.685  	/go/pkg/mod/github.com/golang/protobuf@v1.5.3/proto/text_encode.go:369 +0x405
2023-11-28T20:32:54.685  github.com/golang/protobuf/proto.(*textWriter).writeMessage(0xc00b0df3e0, {0x1256010, 0xc008b66b00})
2023-11-28T20:32:54.685  	/go/pkg/mod/github.com/golang/protobuf@v1.5.3/proto/text_encode.go:341 +0x4a5
2023-11-28T20:32:54.685  github.com/golang/protobuf/proto.(*textWriter).writeSingularValue(0xc00b0df3e0, {{}, 0x1081700?, 0xc008b66b00?, 0xc008b66ae0?}, {0x125d670, 0xc0005ec000})
2023-11-28T20:32:54.685  	/go/pkg/mod/github.com/golang/protobuf@v1.5.3/proto/text_encode.go:390 +0x5b6
2023-11-28T20:32:54.685  github.com/golang/protobuf/proto.(*textWriter).writeMessage(0xc00b0df3e0, {0x1256010, 0xc008b66ae0})
2023-11-28T20:32:54.685  	/go/pkg/mod/github.com/golang/protobuf@v1.5.3/proto/text_encode.go:341 +0x4a5
2023-11-28T20:32:54.686  github.com/golang/protobuf/proto.(*textWriter).writeSingularValue(0xc00b0df3e0, {{}, 0x1081700?, 0xc008b66ae0?, 0x10?}, {0x125d670, 0xc000220780})
2023-11-28T20:32:54.686  	/go/pkg/mod/github.com/golang/protobuf@v1.5.3/proto/text_encode.go:390 +0x5b6
2023-11-28T20:32:54.686  github.com/golang/protobuf/proto.(*textWriter).writeMessage(0xc00b0df3e0, {0x1256010, 0xc008b66ad0})
2023-11-28T20:32:54.686  	/go/pkg/mod/github.com/golang/protobuf@v1.5.3/proto/text_encode.go:341 +0x4a5
2023-11-28T20:32:54.686  github.com/golang/protobuf/proto.(*textWriter).writeSingularValue(0xc00b0df3e0, {{}, 0x1081700?, 0xc008b66ad0?, 0xc02db39ac0?}, {0x125d670, 0xc000316b40})
2023-11-28T20:32:54.686  	/go/pkg/mod/github.com/golang/protobuf@v1.5.3/proto/text_encode.go:390 +0x5b6
2023-11-28T20:32:54.686  github.com/golang/protobuf/proto.(*textWriter).writeMessage(0xc00b0df3e0, {0x1256010, 0xc008b668d0})
2023-11-28T20:32:54.686  	/go/pkg/mod/github.com/golang/protobuf@v1.5.3/proto/text_encode.go:288 +0x645
2023-11-28T20:32:54.686  github.com/golang/protobuf/proto.(*textWriter).writeSingularValue(0xc00b0df3e0, {{}, 0x1081700?, 0xc008b668d0?, 0x7f660eaa7c78?}, {0x125d670, 0xc0005e6000})
2023-11-28T20:32:54.686  	/go/pkg/mod/github.com/golang/protobuf@v1.5.3/proto/text_encode.go:390 +0x5b6
2023-11-28T20:32:54.686  github.com/golang/protobuf/proto.(*textWriter).writeMessage(0xc00b0df3e0, {0x1256010, 0xc008b668c0})
2023-11-28T20:32:54.686  	/go/pkg/mod/github.com/golang/protobuf@v1.5.3/proto/text_encode.go:341 +0x4a5
2023-11-28T20:32:54.686  github.com/golang/protobuf/proto.(*TextMarshaler).marshal(0x1b66616, {0x[124](https://n3r.navercorp.com/project/mybox-drive/apps/real-ugs/tabs/logs#)a060?, 0xc00b0df350})
2023-11-28T20:32:54.686  	/go/pkg/mod/github.com/golang/protobuf@v1.5.3/proto/text_encode.go:86 +0x12f
2023-11-28T20:32:54.686  github.com/golang/protobuf/proto.(*TextMarshaler).Text(...)
2023-11-28T20:32:54.686  	/go/pkg/mod/github.com/golang/protobuf@v1.5.3/proto/text_encode.go:44
2023-11-28T20:32:54.686  github.com/golang/protobuf/proto.CompactTextString(...)
2023-11-28T20:32:54.686  	/go/pkg/mod/github.com/golang/protobuf@v1.5.3/proto/text_encode.go:106
2023-11-28T20:32:54.686  github.com/pinpoint-apm/pinpoint-go-agent/protobuf.(*PSpanMessage).String(...)
2023-11-28T20:32:54.686  	/go/pkg/mod/github.com/pinpoint-apm/pinpoint-go-agent@v1.3.0/protobuf/Span.pb.go:34
2023-11-28T20:32:54.686  github.com/pinpoint-apm/pinpoint-go-agent.(*spanStream).sendSpan(0xc03b0ca520, 0xc004a7b980?)
2023-11-28T20:32:54.686  	/go/pkg/mod/github.com/pinpoint-apm/pinpoint-go-agent@v1.3.0/grpc.go:573 +0x89
2023-11-28T20:32:54.686  github.com/pinpoint-apm/pinpoint-go-agent.(*agent).sendSpanWorker(0xc0002260f0)
2023-11-28T20:32:54.686  	/go/pkg/mod/github.com/pinpoint-apm/pinpoint-go-agent@v1.3.0/agent.go:332 +0x1fe
2023-11-28T20:32:54.686  created by github.com/pinpoint-apm/pinpoint-go-agent.(*agent).connectGrpcServer
2023-11-28T20:32:54.686  	/go/pkg/mod/github.com/pinpoint-apm/pinpoint-go-agent@v1.3.0/agent.go:187 +0x1aa
dwkang commented

This bug occurs in the process of outputting logs for debugging. The panic occurs inside the protobuf codes, so it is difficult to analyze the cause, so it will take time to resolve it.
However, the optimization code for log output for debugging is patched in v1.3.3. This log message output is modified to be invoked only when the log level is trace. If you apply the patch version, you will be able to bypass this bug.

https://github.com/pinpoint-apm/pinpoint-go-agent/releases/tag/v1.3.3

tuyy commented

@dwkang
Thank you for the information! I will close the issue.