[jboss-jira] [JBoss JIRA] (DROOLS-25) Cannot unmarshall large session file: InvalidProtocolBufferException

Edson Tirelli (JIRA) jira-events at lists.jboss.org
Mon Mar 11 12:17:42 EDT 2013


     [ https://issues.jboss.org/browse/DROOLS-25?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Edson Tirelli resolved DROOLS-25.
---------------------------------

         Assignee: Edson Tirelli  (was: Mark Proctor)
    Fix Version/s: 5.6
                   6.0.0.Alpha1
       Resolution: Done


Thank you for reporting and providing the patch. We discussed the problem and decided it was not worth keeping it as an option, since for small sessions, the overhead of reading the stream into a byte[] is small anyway, and for large sessions it only works that way. We changed your patch to always preload the content into the byte[].
                
> Cannot unmarshall large session file: InvalidProtocolBufferException
> --------------------------------------------------------------------
>
>                 Key: DROOLS-25
>                 URL: https://issues.jboss.org/browse/DROOLS-25
>             Project: Drools
>          Issue Type: Bug
>      Security Level: Public(Everyone can see) 
>    Affects Versions: 5.5
>         Environment: Jdk 7
>            Reporter: Magnus Vojbacke
>            Assignee: Edson Tirelli
>             Fix For: 5.6, 6.0.0.Alpha1
>
>
> When trying to unmarshall a large knowledge session from a file stream, an exception is thrown.
> It seems that there is a default message size limit in Protobuf (used by Drools marshalling). Apparently, what happens is that the marshalled "Header" message exceeds this size, which causes Protobuf to throw this exception.
> I suspect that the Header field "payload" is the culprit, since it seems to contain the rest of the knowledge base in byte array form.
> Here's the stack trace:
> {code:title=Stacktrace}
> com.google.protobuf.InvalidProtocolBufferException: Protocol message was too large. May be malicious. Use CodedInputStream.setSizeLimit() to increase the size limit.
>     at com.google.protobuf.InvalidProtocolBufferException.sizeLimitExceeded:89
>     at com.google.protobuf.CodedInputStream.refillBuffer:720
>     at com.google.protobuf.CodedInputStream.isAtEnd:666
>     at com.google.protobuf.CodedInputStream.readTag:99
>     at org.drools.marshalling.impl.ProtobufMessages$Header$Builder.mergeFrom:967
>     at org.drools.marshalling.impl.ProtobufMessages$Header$Builder.mergeFrom:773
>     at com.google.protobuf.AbstractMessageLite$Builder.mergeFrom:212
>     at com.google.protobuf.AbstractMessage$Builder.mergeFrom:746
>     at org.drools.marshalling.impl.ProtobufMessages$Header.parseFrom:724
>     at org.drools.marshalling.impl.PersisterHelper.readFromStreamWithHeader:234
>     at org.drools.marshalling.impl.ProtobufInputMarshaller.loadAndParseSession:217
>     at org.drools.marshalling.impl.ProtobufInputMarshaller.readSession:107
>     at org.drools.marshalling.impl.ProtobufMarshaller.unmarshall:143
> {code}
> Suggested solutions:
> #1
> You can set the size limit of the Protobuf CodedInputStream, but there doesn't seem to be any way of providing this parameter to the Drools unmarshalling API.
> #2
> When you unmarshall from a byte array, Protobuf does not enforce any message size limit. I have successfully implemented a patch in drools-core that preloads the file into memory and unmarshalls from a byte array. Probably the least desirable fix.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira


More information about the jboss-jira mailing list