[ofbiz-framework] branch release17.12 updated: Fixed: Error in uploading very large files, ie >2MB

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

[ofbiz-framework] branch release17.12 updated: Fixed: Error in uploading very large files, ie >2MB

jleroux@apache.org
This is an automated email from the ASF dual-hosted git repository.

jleroux pushed a commit to branch release17.12
in repository https://gitbox.apache.org/repos/asf/ofbiz-framework.git


The following commit(s) were added to refs/heads/release17.12 by this push:
     new 9f5ebc4  Fixed: Error in uploading very large files, ie >2MB
9f5ebc4 is described below

commit 9f5ebc48fd5ed32008f087b2eee5b19e455c6df7
Author: Jacques Le Roux <[hidden email]>
AuthorDate: Thu Apr 16 15:46:09 2020 +0200

    Fixed: Error in uploading very large files, ie >2MB
   
    (OFBIZ-11534)
   
    This was not supposed to be committed, actually (wrong) part of OFBIZ-11597
   
    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 52fa77f..f239f20 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
@@ -835,6 +835,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));