ProtobufException

93 views
Skip to first unread message

Xavier Vanderstukken

unread,
Aug 17, 2011, 3:25:01 PM8/17/11
to proto...@googlegroups.com
Previously I made some succesfully tests to serialize and deserialize objects in my RestEasy application.
But when I try to serialize a complete object graph with about 30classes I receive the following message.
How can I debug this kind of error?

org.jboss.resteasy.spi.ReaderException: javax.ws.rs.WebApplicationException: com.dyuproject.protostuff.ProtobufException: While parsing a protocol message, the input ended unexpectedly in the middle of a field.  This could mean either than the input has been truncated or that an embedded message misreported its own length.
 at org.jboss.resteasy.client.core.BaseClientResponse.readFrom(BaseClientResponse.java:434)
 at org.jboss.resteasy.client.core.BaseClientResponse.getEntity(BaseClientResponse.java:346)
 at org.jboss.resteasy.client.core.BaseClientResponse.getEntity(BaseClientResponse.java:319)
 at org.jboss.resteasy.client.core.extractors.BodyEntityExtractor.extractEntity(BodyEntityExtractor.java:54)
 at org.jboss.resteasy.client.core.ClientInvoker.invoke(ClientInvoker.java:114)
 at org.jboss.resteasy.client.core.ClientProxy.invoke(ClientProxy.java:72)
 at $Proxy24.addQuizz(Unknown Source)
 at com.ep.resteasy.test.MainTestClient.testImportJSON(MainTestClient.java:161)
 at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
 at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
 at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
 at java.lang.reflect.Method.invoke(Method.java:597)
 at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:44)
 at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:15)
 at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:41)
 at org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:20)
 at org.junit.internal.runners.statements.RunBefores.evaluate(RunBefores.java:28)
 at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:76)
 at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:50)
 at org.junit.runners.ParentRunner$3.run(ParentRunner.java:193)
 at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:52)
 at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:191)
 at org.junit.runners.ParentRunner.access$000(ParentRunner.java:42)
 at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:184)
 at org.junit.internal.runners.statements.RunBefores.evaluate(RunBefores.java:28)
 at org.junit.runners.ParentRunner.run(ParentRunner.java:236)
 at org.eclipse.jdt.internal.junit4.runner.JUnit4TestReference.run(JUnit4TestReference.java:49)
 at org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38)
 at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:467)
 at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:683)
 at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:390)
 at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:197)
Caused by: javax.ws.rs.WebApplicationException: com.dyuproject.protostuff.ProtobufException: While parsing a protocol message, the input ended unexpectedly in the middle of a field.  This could mean either than the input has been truncated or that an embedded message misreported its own length.
 at com.ep.testjersey.converter.ProtoStuffReader.readFrom(ProtoStuffReader.java:84)
 at org.jboss.resteasy.core.interception.MessageBodyReaderContextImpl.proceed(MessageBodyReaderContextImpl.java:105)
 at org.jboss.resteasy.plugins.interceptors.encoding.GZIPDecodingInterceptor.read(GZIPDecodingInterceptor.java:61)
 at org.jboss.resteasy.core.interception.MessageBodyReaderContextImpl.proceed(MessageBodyReaderContextImpl.java:108)
 at org.jboss.resteasy.security.doseta.DigitalVerificationInterceptor.read(DigitalVerificationInterceptor.java:35)
 at org.jboss.resteasy.core.interception.MessageBodyReaderContextImpl.proceed(MessageBodyReaderContextImpl.java:108)
 at org.jboss.resteasy.client.core.BaseClientResponse.readFrom(BaseClientResponse.java:398)
 ... 31 more
Caused by: com.dyuproject.protostuff.ProtobufException: While parsing a protocol message, the input ended unexpectedly in the middle of a field.  This could mean either than the input has been truncated or that an embedded message misreported its own length.
 at com.dyuproject.protostuff.ProtobufException.truncatedMessage(ProtobufException.java:77)
 at com.dyuproject.protostuff.CodedInput.readRawBytes(CodedInput.java:809)
 at com.dyuproject.protostuff.CodedInput.readString(CodedInput.java:233)
 at com.dyuproject.protostuff.runtime.RuntimeUnsafeFieldFactory$9$1.mergeFrom(RuntimeUnsafeFieldFactory.java:569)
 at com.dyuproject.protostuff.runtime.MappedSchema.mergeFrom(MappedSchema.java:188)
 at com.dyuproject.protostuff.CodedInput.mergeObject(CodedInput.java:251)
 at com.dyuproject.protostuff.runtime.RuntimeUnsafeFieldFactory$13$1.mergeFrom(RuntimeUnsafeFieldFactory.java:771)
 at com.dyuproject.protostuff.runtime.MappedSchema.mergeFrom(MappedSchema.java:188)
 at com.dyuproject.protostuff.IOUtil.mergeFrom(IOUtil.java:77)
 at com.dyuproject.protostuff.ProtobufIOUtil.mergeFrom(ProtobufIOUtil.java:114)
 at com.ep.testjersey.converter.ProtoStuffReader.readFrom(ProtoStuffReader.java:81)
 ... 37 more

David Yu

unread,
Aug 18, 2011, 3:12:15 AM8/18/11
to proto...@googlegroups.com
Do you have sample data that triggers this?
From the stacktrace, it looks like you have an embedded message that misreported its size.
When the string field of that embedded message is parsed, the string length could not fit within the size of its container (the embedded message)

Its not really 100% since if a message is mis-encoded/decoded, any error can popup.
It could be the gzip decoding that could be the culprit (or the other parts of your stack).
You could test the same data without the extra layers to see if protostuff is the culprit here.
I've gotten some few reports before and it came down to the other parts of their stack being the culprit.
--
When the cat is away, the mouse is alone.
- David Yu
Reply all
Reply to author
Forward
0 new messages