8 Replies Latest reply on Jul 20, 2004 7:51 AM by Aaron Tang

    Error in html module

    danvu Newbie

      When I tried to load a file up using html module, it threw OutOfMemory exception. Can anyone help?

      Below is the stack trace:
      ---------------------------------------------------------------------------
      javax.servlet.ServletException: Filter execution threw an exception
      at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
      at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:193)
      at org.jboss.nukes.servlet.CompressFilter.doFilter(CompressFilter.java:113)
      at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:213)
      at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:193)
      at org.jboss.nukes.servlet.DatabasePollerFilter.doFilter(DatabasePollerFilter.java:88)
      at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:213)
      at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:193)
      at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:256)
      at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:643)
      at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:480)
      at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:995)
      at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191)
      at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:643)
      at org.jboss.web.tomcat.security.JBossSecurityMgrRealm.invoke(JBossSecurityMgrRealm.java:220)
      at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:641)
      at org.apache.catalina.valves.CertificatesValve.invoke(CertificatesValve.java:246)
      at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:641)
      at org.jboss.web.tomcat.tc4.statistics.ContainerStatsValve.invoke(ContainerStatsValve.java:76)
      at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:641)
      at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:480)
      at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:995)
      at org.apache.catalina.core.StandardContext.invoke(StandardContext.java:2417)
      at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:180)
      at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:643)
      at org.apache.catalina.valves.ErrorDispatcherValve.invoke(ErrorDispatcherValve.java:171)
      at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:641)
      at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:172)
      at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:641)
      at org.jboss.web.tomcat.security.SecurityAssociationValve.invoke(SecurityAssociationValve.java:65)
      at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:641)
      at org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:577)
      at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:641)
      at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:480)
      at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:995)
      at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:174)
      at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:643)
      at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:480)
      at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:995)
      at org.apache.coyote.tomcat4.CoyoteAdapter.service(CoyoteAdapter.java:197)
      at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:781)
      at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.processConnection(Http11Protocol.java:549)
      at org.apache.tomcat.util.net.TcpWorkerThread.runIt(PoolTcpEndpoint.java:605)
      at org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:677)
      at java.lang.Thread.run(Unknown Source)


      root cause

      java.lang.OutOfMemoryError
      -------------------------------------------------------------------------------

      I set the JVM memory and mySQL packet size to 128M, so it's not a memory problem from Jboss or mySQL.

        • 1. Re: Error in html module
          Marco Ciancimino Newbie

          I've got the same problem in 1.1rc2. How do you solve it? maybe wrong charset encoding?

          • 2. Re: Error in html module
            Marco Ciancimino Newbie

            After a step trace into MultipartRequest.java and commons-fileupload code, I discover that a memory buffer of FileUploadSizeMax is allocated for each form field.

            So, since I have set FileUploadSizeMax=30MB, it's easy to understand why a OutOfMemoryException is thrown.

            Any suggestions?

            • 3. Re: Error in html module
              Marco Ciancimino Newbie

              I think this is a bug, look at MultipartRequest.java line 68:

              upload.setSizeThreshold(sizeMax);

              This seems to be wrong, the threshold must be different from max upload size. I think a new attribute in CoreModule MBean is needed.

              • 4. Re: Error in html module
                jae Master

                you need to increase the min/max heap size when you start jboss. pls see the faq in the user group.

                • 5. Re: Error in html module
                  Marco Ciancimino Newbie

                  Hi jae77. Heap size is up to 256MB, the file that give me the OutOfMemory error is an image of about 15kb.

                  Take a look to MultipartRequest.java line 68. Actually a FileUploadSizeMax amount of bytes is allocated for each multipart parameter. This seems to be a bug.

                  • 6. Re: Error in html module
                    Viet Master

                    in commons fileupload or in nukes ?

                    • 7. Re: Error in html module
                      Marco Ciancimino Newbie

                      in nukes at org.jboss.nukes.servlet.MultipartRequest line 68.

                      this is the code, please read my comment:

                      public MultipartRequest(HttpServletRequest request, int sizeMax)
                      throws FileUploadException
                      {
                      super(request);

                      // Create a new file upload handler
                      DiskFileUpload upload = new DiskFileUpload();

                      // Set upload parameters
                      upload.setSizeMax(sizeMax);

                      // the next statement is wrong because setSizeThreshold
                      // sets the size limit of the memory stream upload (read apache docs)
                      // not the max size of the upload.

                      upload.setSizeThreshold(sizeMax);
                      upload.setRepositoryPath(System.getProperty("java.io.tmpdir"));

                      // Get request parameters
                      for (Enumeration en = request.getParameterNames();en.hasMoreElements();)
                      {
                      String name = (String)en.nextElement();
                      parameters.put(name, request.getParameterValues(name));
                      }

                      // Merge with upload fields
                      for (Iterator i = upload.parseRequest(request).iterator();i.hasNext();)
                      {
                      FileItem item = (FileItem)i.next();
                      if (item.isFormField())
                      {
                      parameters.put(item.getFieldName(), new String[]{item.getString()});
                      }
                      else
                      {
                      files.put(item.getFieldName(), new UploadedFile(item.getContentType(), item.get()));
                      }
                      }
                      }

                      • 8. Re: Error in html module
                        Aaron Tang Newbie

                        hi, danvu
                        just uncomment

                        set JAVA_OPTS=%JAVA_OPTS% -Xms128m -Xmx512m

                        in your run.bat/ add to your run.sh