protobuf icon indicating copy to clipboard operation
protobuf copied to clipboard

Call "ConvertMessageToJson" function trigger GOOGLE_DCHECK(target + size == res)

Open haoziAndy opened this issue 4 years ago • 4 comments

In Linux,When call "ConvertMessageToJson" function trigger GOOGLE_DCHECK(target + size == res) ,Why? But Windwos is ok.

haoziAndy avatar Jan 20 '21 13:01 haoziAndy

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.

haberman avatar Jan 27 '21 00:01 haberman

My program has the same issue occasionally when calling SerializeToString, I was wondering what situation would cause this issue

Minohh avatar Jun 10 '21 18:06 Minohh

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).

poulls avatar Feb 08 '22 08:02 poulls

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.

deannagarcia avatar Jul 22 '22 00:07 deannagarcia

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.

jorgbrown avatar Sep 01 '22 17:09 jorgbrown