Closed
Description
Ok, I am trying to convert our code (pre-XXX) to the latest protoc-gen-go and... I am seriously thinking about switching back to json.
Side effects so far
- Things that were perfectly comparable are not comparable any more (most of our structs were strings and ints, nothing fancy). Now I have to use proto.Equals(), which uses reflection. Something tells me that speedup that I got from using protobuf might be slowly disappearing into comparisons and special cases to handle it (that I need to remember when I am using it). (this is covered by @sitano in protoc-gen-go: XXX_ fields break code back compatibility #607)
- getting panic in tests for code that serializing / deserializing the following (handrolled) code for serialization that was perfectly working before. (We have many of these little things created without proto files, and it was considered a nice feature of proto to be able to do it easily)
type leveldbModTime struct {
ModTime *proto.Timestamp `protobuf:"bytes,1,opt,name=modTime" json:"modTime,omitempty"`
}
func (m * leveldbModTime) Reset() { *m = leveldbModTime{} }
func (m * leveldbModTime) String() string { return proto.CompactTextString(m) }
func (* leveldbModTime) ProtoMessage() {}
func init() {
proto.RegisterType((* leveldbModTime)(nil), "tandr.leveldbModTime")
}
and the panic stack is something like this
=== RUN TestStore_StoreLoad
--- FAIL: TestStore_StoreLoad (0.16s)
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=0x8 pc=0x1185538]
goroutine 29 [running]:
testing.tRunner.func1(0xc4201cab40)
/usr/local/go/src/testing/testing.go:742 +0x29d
panic(0x15a03a0, 0x1a32e00)
/usr/local/go/src/runtime/panic.go:502 +0x229
tandr/myexe1/vendor/github.com/golang/protobuf/proto.unmarshalStringValue(0xc4201d41e2, 0x1d4, 0x1df, 0x0, 0x2, 0xc4206db910, 0x101397c, 0xc4200ba878, 0xc4206db9d8, 0x10)
/Users/tandrey/ww/go/src/tandr/myexe1/vendor/github.com/golang/protobuf/proto/table_unmarshal.go:1454 +0x108
tandr/myexe1/vendor/github.com/golang/protobuf/proto.(*unmarshalInfo).unmarshal(0xc4200fbea0, 0x0, 0xc4201d41e0, 0x1d6, 0x1e0, 0x1cbee40, 0xc4201fe820)
/Users/tandrey/ww/go/src/tandr/myexe1/vendor/github.com/golang/protobuf/proto/table_unmarshal.go:171 +0x7b7
tandr/myexe1/vendor/github.com/golang/protobuf/proto.(*InternalMessageInfo).Unmarshal(0x1a45bc0, 0x16dafc0, 0x0, 0xc4201d41e0, 0x1d6, 0x1e0, 0x1, 0x1cbee40)
/Users/tandrey/ww/go/src/tandr/myexe1/vendor/github.com/golang/protobuf/proto/table_unmarshal.go:63 +0x75
tandr/myexe1/vendor/tandr/proto-interfaces/gen/go/myexe1_proto.(*Block).XXX_Unmarshal(0x0, 0xc4201d41e0, 0x1d6, 0x1e0, 0x0, 0x0)
/Users/tandrey/ww/go/src/tandr/myexe1/vendor/tandr/proto-interfaces/gen/go/myexe1_proto/block.pb.go:173 +0x61
tandr/myexe1/vendor/github.com/golang/protobuf/proto.Unmarshal(0xc4201d41e0, 0x1d6, 0x1e0, 0x16da200, 0xc42000e408, 0x1a64080, 0xc4201d41e0)
/Users/tandrey/ww/go/src/tandr/myexe1/vendor/github.com/golang/protobuf/proto/decode.go:338 +0x1ad
tandr/myexe1/leveldb_store.unpackBlock(0xc4201d41e0, 0x1d6, 0x1e0, 0x1e0, 0xc4201f27e0, 0x8)
/Users/tandrey/ww/go/src/tandr/myexe1/leveldb_store/proto_helpers.go:44 +0x71
tandr/myexe1/leveldb_store.(*leveldbStore).collectBlocks(0xc4201f41b0, 0x0, 0x0, 0x0, 0x0)
/Users/tandrey/ww/go/src/tandr/myexe1/leveldb_store/leveldb_store.go:385 +0x272
tandr/myexe1/leveldb_store.(*leveldbStore).LoadOutputs(0xc4201f41b0, 0xc4207100c0, 0x0, 0x0, 0x0, 0x0, 0xc4206e0b40)
/Users/tandrey/ww/go/src/tandr/myexe1/leveldb_store/leveldb_store.go:327 +0x39
tandr/myexe1/leveldb_store.(*leveldbResolver).LoadOutputs(0xc42000c080, 0xc4207100c0, 0x0, 0x0, 0xc4201cab40, 0x0, 0x0)
/Users/tandrey/ww/go/src/tandr/myexe1/leveldb_store/leveldb_store_resolver.go:235 +0x97
tandr/myexe1/leveldb_store.checkStoredBlocks(0xc4201cab40, 0x16e02c0, 0xc42000c080, 0xc420030240, 0x4, 0x0, 0x0)
/Users/tandrey/ww/go/src/tandr/myexe1/leveldb_store/leveldb_store_test.go:366 +0x50
tandr/myexe1/leveldb_store.setupAcAndOutputs(0xc4201cab40, 0x16e02c0, 0xc42000c080, 0x2d2, 0x10ed5c0, 0x10ed5ed, 0x17b06d0)
/Users/tandrey/ww/go/src/tandr/myexe1/leveldb_store/leveldb_store_test.go:357 +0x498
tandr/myexe1/leveldb_store.TestStore_StoreLoadOutputs(0xc4201cab40)
/Users/tandrey/ww/go/src/tandr/myexe1/leveldb_store/leveldb_store_test.go:77 +0xb1
testing.tRunner(0xc4201cab40, 0x168ebe8)
/usr/local/go/src/testing/testing.go:777 +0xd0
created by testing.(*T).Run
/usr/local/go/src/testing/testing.go:824 +0x2e0
FAIL tandr/myexe1/leveldb_store 1.968s
Metadata
Metadata
Assignees
Labels
No labels