Uploaded image for project: 'Go Driver'
  1. Go Driver
  2. GODRIVER-1654

Panic in bsoncore.appendstring

    • Type: Icon: Bug Bug
    • Resolution: Works as Designed
    • Priority: Icon: Major - P3 Major - P3
    • None
    • Affects Version/s: 1.3.4
    • Component/s: BSON
    • Labels:
      None
    • Environment:
      go version go1.14.2 darwin/amd64
      go version go1.14.2 linux/amd64

      When running the following code:

      c.UpdateOne(ctx,
         bson.M{
            "_id": Id.String(),
         },
         bson.M{
            "$set": object,
         },
         options.Update().SetUpsert(true),
      );
      

      we are encountering occasional panics:

      panic: runtime error: invalid memory address or nil pointer dereferencepanic: runtime error: 
         invalid memory address or nil pointer dereference[signal SIGSEGV: segmentation violation code=0x1 addr=0x0 pc=0x1064ca7]
      goroutine 1537702 [running]:
      go.mongodb.org/mongo-driver/x/bsonx/bsoncore.appendstring(...) /Users/my-name/go/pkg/mod/go.mongodb.org/mongo-driver@v1.3.4/x/bsonx/bsoncore/bsoncore.go:809
      go.mongodb.org/mongo-driver/x/bsonx/bsoncore.AppendString(...) /Users/my-name/go/pkg/mod/go.mongodb.org/mongo-driver@v1.3.4/x/bsonx/bsoncore/bsoncore.go:172
      go.mongodb.org/mongo-driver/bson/bsonrw.(*valueWriter).WriteString(0xc0222de190, 0x0, 0x18, 0x0, 0x18) /Users/my-name/go/pkg/mod/go.mongodb.org/mongo-driver@v1.3.4/bson/bsonrw/value_writer.go:447 +0x10e
      go.mongodb.org/mongo-driver/bson/bsoncodec.(*StringCodec).EncodeValue(0xc00002655b, 0xc000170d90, 0x0, 0x1b44820, 0xc0222de190, 0x18064c0, 0xc0126a3400, 0x198, 0xc00002655b, 0x18064c0) /Users/my-name/go/pkg/mod/go.mongodb.org/mongo-driver@v1.3.4/bson/bsoncodec/string_codec.go:43 +0x178
      go.mongodb.org/mongo-driver/bson/bsoncodec.(*StructCodec).EncodeValue(0x20dd100, 0xc000170d90, 0x0, 0x1b44820, 0xc0222de190, 0x189f360, 0xc0126a3400, 0x199, 0x20dd100, 0x189f360) /Users/my-name/go/pkg/mod/go.mongodb.org/mongo-driver@v1.3.4/bson/bsoncodec/struct_codec.go:150 +0x6f1
      go.mongodb.org/mongo-driver/bson/bsoncodec.(*StructCodec).EncodeValue(0x20dd100, 0xc000170d90, 0x0, 0x1b44820, 0xc0222de190, 0x18fd100, 0xc0126a3400, 0x199, 0x20dd100, 0x18fd100) /Users/my-name/go/pkg/mod/go.mongodb.org/mongo-driver@v1.3.4/bson/bsoncodec/struct_codec.go:150 +0x6f1
      go.mongodb.org/mongo-driver/bson/bsoncodec.(*StructCodec).EncodeValue(0x20dd100, 0xc000170d90, 0x0, 0x1b44820, 0xc0222de190, 0x18e8320, 0xc0126a3400, 0x199, 0x100fda9, 0xc0061bf390) /Users/my-name/go/pkg/mod/go.mongodb.org/mongo-driver@v1.3.4/bson/bsoncodec/struct_codec.go:150 +0x6f1
      go.mongodb.org/mongo-driver/bson/bsoncodec.(*PointerCodec).EncodeValue(0xc00017eba0, 0xc000170d90, 0x0, 0x1b44820, 0xc0222de190, 0x1901120, 0xc0126a3400, 0x16, 0xc01fb22cb0, 0xc0061bf428) /Users/my-name/go/pkg/mod/go.mongodb.org/mongo-driver@v1.3.4/bson/bsoncodec/pointer_codec.go:61 +0x323
      go.mongodb.org/mongo-driver/bson/bsoncodec.EmptyInterfaceCodec.EncodeValue(0x183a800, 0xc000170d90, 0x0, 0x1b44820, 0xc0222de190, 0x183a8e0, 0xc01fb22cd0, 0x94, 0xc0157c4468, 0xc0169660d0) /Users/my-name/go/pkg/mod/go.mongodb.org/mongo-driver@v1.3.4/bson/bsoncodec/empty_interface_codec.go:52 +0x1ba
      go.mongodb.org/mongo-driver/bson/bsoncodec.(*MapCodec).mapEncodeValue(0xc000026558, 0xc000170d90, 0xc0222de100, 0x1b2b6c0, 0xc0222de190, 0x1861a60, 0xc01f679d40, 0x15, 0x0, 0xc00017ec60, ...) /Users/my-name/go/pkg/mod/go.mongodb.org/mongo-driver@v1.3.4/bson/bsoncodec/map_codec.go:106 +0x479
      go.mongodb.org/mongo-driver/bson/bsoncodec.(*MapCodec).EncodeValue(0xc000026558, 0xc000170d90, 0x1861a00, 0x1b44820, 0xc0222de190, 0x1861a60, 0xc01f679d40, 0x15, 0xc000580600, 0x4) /Users/my-name/go/pkg/mod/go.mongodb.org/mongo-driver@v1.3.4/bson/bsoncodec/map_codec.go:66 +0x20a
      go.mongodb.org/mongo-driver/bson.(*Encoder).Encode(0xc021265160, 0x1861a60, 0xc01f679d40, 0x1b44820, 0xc0222de190) /Users/my-name/go/pkg/mod/go.mongodb.org/mongo-driver@v1.3.4/bson/encoder.go:79 +0x183
      go.mongodb.org/mongo-driver/bson.MarshalAppendWithContext(0xc000170d90, 0x0, 0xc0167eb600, 0x0, 0x100, 0x1861a60, 0xc01f679d40, 0x0, 0x0, 0x0, ...) /Users/my-name/go/pkg/mod/go.mongodb.org/mongo-driver@v1.3.4/bson/marshal.go:94 +0x1cb
      go.mongodb.org/mongo-driver/bson.MarshalAppendWithRegistry(...) /Users/my-name/go/pkg/mod/go.mongodb.org/mongo-driver@v1.3.4/bson/marshal.go:70
      go.mongodb.org/mongo-driver/mongo.transformBsoncoreDocument(0xc000170d90, 0x1861a60, 0xc01f679d40, 0x0, 0x0, 0xdb12300, 0xc0069ee918, 0x100dbe4) /Users/my-name/go/pkg/mod/go.mongodb.org/mongo-driver@v1.3.4/mongo/mongo.go:212 +0xee
      go.mongodb.org/mongo-driver/mongo.transformUpdateValue(0xc000170d90, 0x1861a60, 0xc01f679d40, 0x1, 0x3a, 0xc021afc100, 0x7, 0x40, 0xc01fb22c90, 0x94) /Users/my-name/go/pkg/mod/go.mongodb.org/mongo-driver@v1.3.4/mongo/mongo.go:401 +0x867
      go.mongodb.org/mongo-driver/mongo.(*Collection).updateOrReplace(0xc01571f7a0, 0x1b351c0, 0xc000026080, 0xc0167eb300, 0x33, 0x100, 0x1861a60, 0xc01f679d40, 0x188e435b510ec500, 0x2, ...) /Users/my-name/go/pkg/mod/go.mongodb.org/mongo-driver@v1.3.4/mongo/collection.go:506 +0x1cd
      go.mongodb.org/mongo-driver/mongo.(*Collection).UpdateOne(0xc01571f7a0, 0x1b351c0, 0xc000026080, 0x1861a60, 0xc01f678e40, 0x1861a60, 0xc01f679d40, 0xc0069eeea0, 0x1, 0x1, ...) /Users/my-name/go/pkg/mod/go.mongodb.org/mongo-driver@v1.3.4/mongo/collection.go:619 +0x141
      

      The payload isn't changing.

       

            Assignee:
            isabella.siu@mongodb.com Isabella Siu (Inactive)
            Reporter:
            jongenelengino@gmail.com Gino Jongenelen
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated:
              Resolved: