You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ofbiz.apache.org by jl...@apache.org on 2020/04/16 14:11:37 UTC
[ofbiz-framework] 01/03: Fixed: Error in uploading very large files, ie >2MB
This is an automated email from the ASF dual-hosted git repository.
jleroux pushed a commit to branch release18.12
in repository https://gitbox.apache.org/repos/asf/ofbiz-framework.git
commit 711ca4171547360b55ed182516a05db38674fddf
Author: Jacques Le Roux <ja...@les7arts.com>
AuthorDate: Thu Apr 16 15:46:09 2020 +0200
Fixed: Error in uploading very large files, ie >2MB
(OFBIZ-11534)
There is an issue in uploading large files, I am able to upload files up to 2 GB
successfully but getting an error when trying to upload a file larger than 2GB.
Example -
1. Go to party profile -
https://demo-trunk.ofbiz.apache.org/partymgr/control/viewprofile?partyId=admin
2. Try to create a party content with a file larger than 2 GB
3. Error on console
jleroux:
For a 2GB+ file you need to set Xmx to more than the double of the file size,
eg: gradlew ofbiz -PjvmArgs="-Xms1024M -Xmx5048M"
You then get another small issue (only in log) when redirecting to send the
partyId parameter.
This is because, DiskFileItem is a temporary Object with a null value contained
in "fileItems" attribute. It can't be detected by UtilMisc::makeMapSerializable
and that makes "fileItems" not serializable. So it must be removed from
reqAttrMap.
Thanks: Chandan Khandelwal for report, Michael for suggesting a very large file
to upload
---
.../src/main/java/org/apache/ofbiz/webapp/control/RequestHandler.java | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/framework/webapp/src/main/java/org/apache/ofbiz/webapp/control/RequestHandler.java b/framework/webapp/src/main/java/org/apache/ofbiz/webapp/control/RequestHandler.java
index 41b5d44..3e9d24e 100644
--- a/framework/webapp/src/main/java/org/apache/ofbiz/webapp/control/RequestHandler.java
+++ b/framework/webapp/src/main/java/org/apache/ofbiz/webapp/control/RequestHandler.java
@@ -903,6 +903,10 @@ public class RequestHandler {
}
}
if (reqAttrMap.size() > 0) {
+ // fileItems is not serializable.
+ // It contains a temporary DiskFileItem with a null value than can't be detected by UtilMisc::makeMapSerializable
+ // So it must be removed from reqAttrMap. See OFBIZ-11534
+ reqAttrMap.remove("fileItems");
byte[] reqAttrMapBytes = UtilObject.getBytes(reqAttrMap);
if (reqAttrMapBytes != null) {
req.getSession().setAttribute("_REQ_ATTR_MAP_", StringUtil.toHexString(reqAttrMapBytes));