golang / protobuf

Go support for Google's protocol buffers
BSD 3-Clause "New" or "Revised" License
9.79k stars 1.58k forks source link

Service crash caused by encoding #1627

Closed unihon closed 3 months ago

unihon commented 4 months ago
    unexpected fault address 0x1a929e0
    fatal error: fault
    [signal SIGSEGV: segmentation violation code=0x1 addr=0x1a929e0 pc=0x46d789]

    goroutine 40 [running]:
    runtime.throw({0xf78fd1?, 0x248?})
        /usr/local/go/src/runtime/panic.go:1047 +0x5d fp=0xc000dec710 sp=0xc000dec6e0 pc=0x43ac9d
    runtime.sigpanic()
        /usr/local/go/src/runtime/signal_unix.go:842 +0x2c5 fp=0xc000dec760 sp=0xc000dec710 pc=0x4509e5
    runtime.memmove()
        /usr/local/go/src/runtime/memmove_amd64.s:399 +0x489 fp=0xc000dec768 sp=0xc000dec760 pc=0x46d789
    google.golang.org/protobuf/encoding/protowire.AppendString(...)
        /root/go/pkg/mod/google.golang.org/protobuf@v1.33.0/encoding/protowire/wire.go:455
    google.golang.org/protobuf/internal/impl.appendStringNoZeroValidateUTF8({0xc001a48000?, 0xfb?, 0x140?}, {0xc000fdac18?}, 0xc0001583e8?, {0x2?})
        /root/go/pkg/mod/google.golang.org/protobuf@v1.33.0/internal/impl/codec_gen.go:5113 +0xa7 fp=0xc000dec7d0 sp=0xc000dec768 pc=0x651067
    google.golang.org/protobuf/internal/impl.(*MessageInfo).marshalAppendPointer(0xc00023d600, {0xc001a48000?, 0x651076?, 0x27d45ea?}, {0x97?}, {0x0?})
        /root/go/pkg/mod/google.golang.org/protobuf@v1.33.0/internal/impl/encode.go:139 +0x14f fp=0xc000dec848 sp=0xc000dec7d0 pc=0x6674af
    google.golang.org/protobuf/internal/impl.appendMessageSliceInfo({0xc001a48000?, 0x425e07?, 0x425e07?}, {0xe94ed8?}, 0xc000e0edd8, {0x5?})
        /root/go/pkg/mod/google.golang.org/protobuf@v1.33.0/internal/impl/codec_field.go:485 +0xf1 fp=0xc000dec8c8 sp=0xc000dec848 pc=0x638d71
    google.golang.org/protobuf/internal/impl.(*MessageInfo).marshalAppendPointer(0xc0002a8290, {0xc001a48000?, 0x651076?, 0x27d4683?}, {0x3d?}, {0x4?})
        /root/go/pkg/mod/google.golang.org/protobuf@v1.33.0/internal/impl/encode.go:139 +0x14f fp=0xc000dec940 sp=0xc000dec8c8 pc=0x6674af
    google.golang.org/protobuf/internal/impl.appendMessageSliceInfo({0xc001a48000?, 0x181fbe0?, 0xe57fe7b7b46cbf?}, {0x0?}, 0xc000e02b90, {0x0?})
        /root/go/pkg/mod/google.golang.org/protobuf@v1.33.0/internal/impl/codec_field.go:485 +0xf1 fp=0xc000dec9c0 sp=0xc000dec940 pc=0x638d71
    google.golang.org/protobuf/internal/impl.(*MessageInfo).marshalAppendPointer(0xc0002a8000, {0xc001a48000?, 0x7f1ff9ea9c18?, 0x0?}, {0x7f20241e4108?}, {0x0?})
        /root/go/pkg/mod/google.golang.org/protobuf@v1.33.0/internal/impl/encode.go:139 +0x14f fp=0xc000deca38 sp=0xc000dec9c0 pc=0x6674af
    google.golang.org/protobuf/internal/impl.(*MessageInfo).marshal(0x0?, {{}, {0x111d550, 0xc001029830}, {0xc001a48000, 0x0, 0x27d4740}, 0x2})
        /root/go/pkg/mod/google.golang.org/protobuf@v1.33.0/internal/impl/encode.go:107 +0x85 fp=0xc000deca78 sp=0xc000deca38 pc=0x6672e5
    google.golang.org/protobuf/internal/impl.(*MessageInfo).marshal-fm({{}, {0x111d550, 0xc001029830}, {0xc001a48000, 0x0, 0x27d4740}, 0x2})
        <autogenerated>:1 +0x6f fp=0xc000decac0 sp=0xc000deca78 pc=0x684c6f
    google.golang.org/protobuf/proto.MarshalOptions.marshal({{}, 0x30?, 0x0, 0x0}, {0x0, 0x0, 0x0}, {0x111d550, 0xc001029830})
        /root/go/pkg/mod/google.golang.org/protobuf@v1.33.0/proto/encode.go:166 +0x27b fp=0xc000decb60 sp=0xc000decac0 pc=0x5fd07b
    google.golang.org/protobuf/proto.MarshalOptions.MarshalAppend({{}, 0x20?, 0x2e?, 0xf1?}, {0x0, 0x0, 0x0}, {0x110c5e0?, 0xc001029830?})
        /root/go/pkg/mod/google.golang.org/protobuf@v1.33.0/proto/encode.go:125 +0x79 fp=0xc000decba8 sp=0xc000decb60 pc=0x5fccb9
    github.com/golang/protobuf/proto.marshalAppend({0x0, 0x0, 0x0}, {0x7f1ff8388008?, 0xc001029830?}, 0x0?)
        /root/go/pkg/mod/github.com/golang/protobuf@v1.5.3/proto/wire.go:40 +0xa5 fp=0xc000decc28 sp=0xc000decba8 pc=0x6a6e05
    github.com/golang/protobuf/proto.Marshal(...)
        /root/go/pkg/mod/github.com/golang/protobuf@v1.5.3/proto/wire.go:23
    google.golang.org/grpc/encoding/proto.codec.Marshal({}, {0xf12e20, 0xc001029830})
        /root/go/pkg/mod/google.golang.org/grpc@v1.56.3/encoding/proto/proto.go:45 +0x4e fp=0xc000decc78 sp=0xc000decc28 pc=0x88c3ae
    google.golang.org/grpc/encoding/proto.(*codec).Marshal(0xc000decd50?, {0xf12e20?, 0xc001029830?})
        <autogenerated>:1 +0x37 fp=0xc000decc98 sp=0xc000decc78 pc=0x88c597
    google.golang.org/grpc.encode({0x7f1ff852a018?, 0x181d8f8?}, {0xf12e20?, 0xc001029830?})
        /root/go/pkg/mod/google.golang.org/grpc@v1.56.3/rpc_util.go:632 +0x44 fp=0xc000decce8 sp=0xc000decc98 pc=0x8f00a4
    google.golang.org/grpc.prepareMsg({0xf12e20?, 0xc001029830?}, {0x7f1ff852a018?, 0x181d8f8?}, {0x0, 0x0}, {0x0, 0x0})
        /root/go/pkg/mod/google.golang.org/grpc@v1.56.3/stream.go:1767 +0xd2 fp=0xc000decd60 sp=0xc000decce8 pc=0x909632
    google.golang.org/grpc.(*clientStream).SendMsg(0xc001275560, {0xf12e20, 0xc001029830})
        /root/go/pkg/mod/google.golang.org/grpc@v1.56.3/stream.go:883 +0x1b5 fp=0xc000decef0 sp=0xc000decd60 pc=0x902bb5
    skywalking.apache.org/repo/goapi/collect/language/agent/v3.(*traceSegmentReportServiceCollectClient).Send(0xc000df8ea0?, 0xc000d48090?)
        /root/go/pkg/mod/skywalking.apache.org/repo/goapi@v0.0.0-20230314034821-0c5a44bb767a/collect/language/agent/v3/Tracing_grpc.pb.go:61 +0x2b fp=0xc000decf18 sp=0xc000decef0 pc=0xa77a2b
    github.com/apache/skywalking-go/agent/reporter.(*gRPCReporter).initSendPipeline.func1()
        grpc.go:333 +0x268 fp=0xc000decfe0 sp=0xc000decf18 pc=0xd38328
    runtime.goexit()
        /usr/local/go/src/runtime/asm_amd64.s:1594 +0x1 fp=0xc000decfe8 sp=0xc000decfe0 pc=0x46c441
    created by github.com/apache/skywalking-go/agent/reporter.(*gRPCReporter).initSendPipeline
        grpc.go:307 +0x90

My service uses skywalking to report indicators, and an exception occurs when using protobuf for data encoding. Can anyone tell me what the problem is and how to fix it?

puellanivis commented 4 months ago

I don’t see anything useful looking up this data, but it seems someone was hitting a similar issue trying to hook up their skywalker-go to opentelemetry.

Unfortunately, even on those threads for skywalker-go, and for opentelemetry, no one could make any use of the stacktrace, and unfortunately, we can’t either.

hoeppi-google commented 4 months ago

Could you please provide a minimal reproducer (if at all feasible)?

stapelberg commented 3 months ago

Closing because of inactivity.