Bug 1201785 - com.google.protobuf.InvalidProtocolBufferException exception is thrown while loading stateful knowledge session
Summary: com.google.protobuf.InvalidProtocolBufferException exception is thrown while ...
Keywords:
Status: MODIFIED
Alias: None
Product: JBoss Enterprise BRMS Platform 5
Classification: JBoss
Component: BRE (Expert, Fusion)
Version: BRMS 5.3.1
Hardware: Unspecified
OS: Unspecified
unspecified
unspecified
Target Milestone: ---
: ---
Assignee: Mario Fusco
QA Contact: Lukáš Petrovický
URL:
Whiteboard:
Depends On:
Blocks: 1203459
TreeView+ depends on / blocked
 
Reported: 2015-03-13 13:56 UTC by Amana
Modified: 2020-04-27 01:16 UTC (History)
5 users (show)

Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Clone Of:
Environment:
Last Closed:
Type: Bug


Attachments (Terms of Use)
drools25-reproducer.zip (3.53 KB, application/zip)
2015-05-06 12:17 UTC, Jiri Svitak
no flags Details


Links
System ID Private Priority Status Summary Last Updated
Red Hat Issue Tracker DROOLS-25 0 Major Closed Cannot unmarshall large session file: InvalidProtocolBufferException 2017-06-14 06:31:59 UTC
Red Hat Knowledge Base (Solution) 1379983 0 None None None Never

Description Amana 2015-03-13 13:56:48 UTC
Description of problem:

We are running BRMS version 5.3.1.BRMS-P05-temporary-patch. When attempting to load a stateful knowledge session, a "com.google.protobuf.InvalidProtocolBufferException" exception is thrown in BRMS5.3.1+Roll Up 5 applied, with the message "Protocol message was too large.  May be malicious.  Use CodedInputStream.setSizeLimit() to increase the size limit.".

According to DROOLS-25:

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.

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.



Version-Release number of selected component (if applicable):
BRMS 5.3.1 last roll up patch applied (5)



Steps to Reproduce:
Please see steps to reproduce in https://issues.jboss.org/browse/DROOLS-25.

Comment 4 Mario Fusco 2015-03-20 09:22:04 UTC
Cherry-picked to 5.3.x with https://github.com/droolsjbpm/drools/commit/d093f6088

Comment 9 Kris Verlaenen 2015-04-10 12:37:55 UTC
Additional commit required in jbpm 5.2.x due to change above:
http://github.com/droolsjbpm/jbpm/commit/b8469ddbe

Comment 10 Alessandro Lazarotti 2015-04-16 21:24:06 UTC
adding it to patch now, thanks Kris.

Comment 11 Jiri Svitak 2015-05-06 12:17:26 UTC
Created attachment 1022639 [details]
drools25-reproducer.zip

Reproducer used by QE attached. Tips to run:
export MAVEN_OPTS="-Xmx4G"
mvn exec:java -Dexec.mainClass=org.drools25.App


Note You need to log in before you can comment on or make changes to this bug.