Hmm, this may have been a manifestation of a threaded initialization bug
which we very recently fixed internally and will be fixed in the next public
release.  It's hard to say for sure, though.  The problem could manifest if
you had two different threads which happened to run the one-time class
initializers for two different protobuf classes at the same time.  This can
cause the extensions to be initialized incorrectly.  It's very rare, but
it's the only explanation that I can think of.

On Thu, Oct 7, 2010 at 12:22 PM, Jesper Eskilson <> wrote:

> 2010/10/6 Kenton Varda <>:
> > This exception shouldn't be possible.
> > If you can produce a small, self-contained program that demonstrates the
> > problem, I could debug it.  Please make sure that the program is small
> (no
> > more than one .proto file and one source file) and runs quickly.
>  Probably
> > the easiest thing to do is record a sample message that produces this
> error
> > and write a little program that tries to parse those exact bytes.
> I did that and failed to reproduce the problem. My theory is that I
> was parsing a message of type B, where B is a extension of A, and
> doing this before parsing any messag of type A.
> I rewrote my code so I didn't have to serialize any extension types,
> and then the problem disappeared.
> When I was debugging this, I remember seeing that a field
> "defaultInstance" was null, and this seemed to cause protobuf to
> create a builder for a GeneratedMessage, instead of a
> ExtensionMessage. After that observation, I took a few steps back and
> rewrote my code to avoid serializing extension types.
> I'll try to construct a smaller test program when I get back to work
> tomorrow.
> --
> /Jesper

You received this message because you are subscribed to the Google Groups 
"Protocol Buffers" group.
To post to this group, send email to
To unsubscribe from this group, send email to
For more options, visit this group at

Reply via email to