This happens when you are trying to access a nil pointer. Check from where 
the stack trace originates, go to that line and add a "!= nil" check. I 
guess that is what's happening.

P.S. Your stack trace is in a json format which is for machines to read, 
not humans. While reporting issues, it helps a lot you present your data 
(logs, stack trace, etc) in the most clearest way possible.



On Wednesday, 19 June 2019 11:32:09 UTC+5:30, Mayank Jha wrote:
>
> I am getting the *runtime error: invalid memory address or nil pointer 
> dereference, *with the following stack trace, but only occasionally when 
> I try to proto.Marshal() a proto message. 
>
> [{"file":"/go/src/github.com/carousell/Cats/Cats/analytics/analytics.go",
>> "line":92,"function":"(*producer).Produce.func1"},{"file":
>> "/usr/local/go/src/runtime/asm_amd64.s","line":573,"function":"call32"},{
>> "file":"/usr/local/go/src/runtime/panic.go","line":502,"function":
>> "gopanic"},{"file":"/usr/local/go/src/runtime/panic.go","line":63,
>> "function":"panicmem"},{"file":"/usr/local/go/src/runtime/signal_unix.go"
>> ,"line":388,"function":"sigpanic"},{"file":
>> "/usr/local/go/src/unicode/utf8/utf8.go","line":483,"function":
>> "ValidString"},{"file":"/go/src/
>> github.com/carousell/Cats/vendor/github.com/golang/protobuf/proto/table_marshal.go
>> ","line":2074,"function":"appendUTF8StringValueNoZero"},{"file":"/go/src/
>> github.com/carousell/Cats/vendor/github.com/golang/protobuf/proto/table_marshal.go
>> ","line":270,"function":"(*marshalInfo).marshal"},{"file":"/go/src/
>> github.com/carousell/Cats/vendor/github.com/golang/protobuf/proto/table_marshal.go
>> ","line":2264,"function":"makeMessageSliceMarshaler.func2"},{"file":
>> "/go/src/
>> github.com/carousell/Cats/vendor/github.com/golang/protobuf/proto/table_marshal.go
>> ","line":270,"function":"(*marshalInfo).marshal"{"file":"/go/src/
>> github.com/carousell/Cats/vendor/github.com/golang/protobuf/proto/table_marshal.go
>> ","line":2234,"function":"makeMessageMarshaler.func2"},{"file":"/go/src/
>> github.com/carousell/Cats/vendor/github.com/golang/protobuf/proto/table_marshal.go
>> ","line":270,"function":"(*marshalInfo).marshal"},{"file":"/go/src/
>> github.com/carousell/Cats/vendor/github.com/golang/protobuf/proto/table_marshal.go
>> ","line":141,"function":"(*InternalMessageInfo).Marshal"},{"file":
>> "/go/src/github.com/carousell/Cats/Cats/Cats_proto/analytics.pb.go",
>> "line":447,"function":"(*AdRequestMsg).XXX_Marshal"},{"file":"/go/src/
>> github.com/carousell/Cats/vendor/github.com/golang/protobuf/proto/table_marshal.go
>> ","line":2715,"function":"Marshal"}]
>>
>>
>  Have omitted the initial part of the stack trace. Can someone tell me 
> when all could this happen ? Could it be because of a difference in 
> protobuf library versions ? I am unable to get the message, as when the 
> panic happens when the serialization is taking place. Any ideas on how to 
> approach this kind of problem ?
>

-- 
You received this message because you are subscribed to the Google Groups 
"golang-nuts" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to golang-nuts+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/golang-nuts/eb43e86c-b595-4ae7-8a9b-a6645bc013e0%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to