Struts 1
  1. Struts 1
  2. STR-3187

Java.Lang.OutOfMemoryError while posting huge data with enctype="multipart/form-data"

    Details

    • Type: Bug Bug
    • Status: Open
    • Priority: Major Major
    • Resolution: Unresolved
    • Affects Version/s: None
    • Fix Version/s: Pending Review
    • Component/s: None
    • Labels:
      None
    • Environment:
      Tomcat 5.0, JDK 1.4.2_09, SQLServer 2000, Struts 1.1, Spring 1.2.4, Commons-fileupload.jar 1.0
    • Flags:
      Important

      Description

      1: I am getting java.lang.OutOfMemoryError when the form in my jsp code is as below.
      <html:form action="/actnMpng" enctype="multipart/form-data" method ="post" >

      • JSP code ? containing very huge data (hidden parameters) with file upload attachment facility (<html:file/>).

      </html:form>

      This is throwing OutOfMemoryError eventhough I am not attaching/uploading any files.
      I have more than 1000 hidden fields in this jsp.
      When i check the used memory in my action class, i came to know that nearly 200 MB memory is utilizing on each action submit from this jsp (i have more actions / buttons in this form in different tabs).

      2:*** The same data is getting posted successfully if the form is submitted with out
      enctype="multipart/form-data" and without providing the attachment facility. (by removing <html:file/> tags)

      3: I am facing this problem only when my form is containing more hidden parameters to post.
      Where as when my form is containg less fields (which are dynamic), then i am not facing this problem eventhough my form is with enctype="multipart/form-data"

      Please find the below log generated in Tomcat.

      2009-06-02 16:51:42 StandardWrapperValve[action]: Servlet.service() for servlet action threw exception
      java.lang.OutOfMemoryError

      plese let me know if anybody came across this problem.

        Activity

        Hide
        Dave Newton added a comment -

        > I have more than 1000 hidden fields in this jsp.

        Why?!

        Show
        Dave Newton added a comment - > I have more than 1000 hidden fields in this jsp. Why?!
        Hide
        Sambasiva Rao J added a comment -

        Sorry .. small correction..
        those are not hidden fields..
        My form bean is containing huge data to process, in the form of array list.

        This is as per my requirement. I have certain number of items in my screen which are dynamic, number may vary from 3 items to 150 or more items.
        For each item, user has to enter price, discount & various taxes details.

        So, if number of items in my form are more - i have more data to submit.
        in this case, while submitting the form having enctype="multipart/form-data" in my <html:form/> tag, i am experiencing OutOfMemory error (HTTP Status 500-). I am using commons-fileupload.jar 1.0 implementation version as i need to provide an option to upload attachment in this page.

        Where as, if i remove this upload option & enctype property form my <html:form/> tag, i do not see any problem in submitting even more than 150 items.

        What could be the reason?

        Show
        Sambasiva Rao J added a comment - Sorry .. small correction.. those are not hidden fields.. My form bean is containing huge data to process, in the form of array list. This is as per my requirement. I have certain number of items in my screen which are dynamic, number may vary from 3 items to 150 or more items. For each item, user has to enter price, discount & various taxes details. So, if number of items in my form are more - i have more data to submit. in this case, while submitting the form having enctype="multipart/form-data" in my <html:form/> tag, i am experiencing OutOfMemory error (HTTP Status 500-). I am using commons-fileupload.jar 1.0 implementation version as i need to provide an option to upload attachment in this page. Where as, if i remove this upload option & enctype property form my <html:form/> tag, i do not see any problem in submitting even more than 150 items. What could be the reason?
        Hide
        Wes Wannemacher added a comment -

        Seriously, quit assigning me to this. I don't do much with Struts 1.

        Show
        Wes Wannemacher added a comment - Seriously, quit assigning me to this. I don't do much with Struts 1.
        Hide
        Sambasiva Rao J added a comment -

        someone who has idea on this issue, pls suggest.

        Show
        Sambasiva Rao J added a comment - someone who has idea on this issue, pls suggest.
        Hide
        Dave Newton added a comment -

        You don't assign; we do.

        Show
        Dave Newton added a comment - You don't assign; we do.
        Hide
        Sambasiva Rao J added a comment -

        Does anybody know the reason / solution for the problem I described above?

        Struts JIRA team,
        What is the status of this issue from your side?

        Show
        Sambasiva Rao J added a comment - Does anybody know the reason / solution for the problem I described above? Struts JIRA team, What is the status of this issue from your side?
        Hide
        Paul Benedict added a comment -

        Samba, any progress on this?

        Show
        Paul Benedict added a comment - Samba, any progress on this?
        Hide
        Sambasiva Rao J added a comment - - edited

        No Paul, we did not get any reason / solution for this.
        We have temporarily divided the page into two; first page contains all the data to submit with out using multipart/form-data in the form & second page containing only attachment part with multipart attribute in <html:form/> tag.

        But still we are looking for permanent soluction. Pls let me know if anyone came across this.

        Show
        Sambasiva Rao J added a comment - - edited No Paul, we did not get any reason / solution for this. We have temporarily divided the page into two; first page contains all the data to submit with out using multipart/form-data in the form & second page containing only attachment part with multipart attribute in <html:form/> tag. But still we are looking for permanent soluction. Pls let me know if anyone came across this.

          People

          • Assignee:
            Unassigned
            Reporter:
            Sambasiva Rao J
          • Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

            • Created:
              Updated:

              Development