protobuf
protobuf copied to clipboard
Call "ConvertMessageToJson" function trigger GOOGLE_DCHECK(target + size == res)
In Linux,When call "ConvertMessageToJson" function trigger GOOGLE_DCHECK(target + size == res) ,Why? But Windwos is ok.
Can you send the error output from the crash? What version of protobuf were you using?
If you can reduce this to a small program that reproduces the problem, we should be able to diagnose and fix it.
My program has the same issue occasionally when calling SerializeToString, I was wondering what situation would cause this issue
Guess protobuf object might be changed by other thread which happened right after get value of (target + size) and before get value of res for GOOGLE_DCHECK(target + size == res).
Sorry for the long delay here.
If you're still having an issue, please use the bug template to fill in information including what version you're using, how to reproduce, and the error logs.
I concur with poulls: The likely cause is that another thread is modifying the message while your thread is trying to convert it. A related possibility is that somehow, part of the message was free'd or delete'd even though the message still references it; if so, the conversion to JSON might end up using some of that free'd memory, causing an internal inconsistency which this DCHECK is complaining about.