Hi list, We are using tomcat with Railo to use CFML and getting an strange issue..
When we try to upload a file of 2~4MB on a slow connection 15~20kb/s the request is completed but all of the form fields are dropped.. which causes an error.. How to reproduce the error with a small CFM code: // form_upload.cfm <form name="form1" action="upload.cfm" method="post" enctype="multipart/form-data"> File: <input type="file" name="fileData"> <input type="submit"> </form> //upload.cfm <cfsetting requesttimeout="36000" /> <cffile action="upload" filefield="form.fileData" destination="#application.tempDir#" nameconflict="makeunique" /> <cfdump var="#cffile#"> This only happens with large files and/or slow connection. Here is some information about the test environment: - Railo 3.2.0.001 rc - OS Linux (2.6.18-164.15.1.el5) => CentOS 5.4 - Servlet Container Apache Tomcat/6.0.20 and also tested with Apache Tomcat/6.0.29 the tomcat configuration doesn't has many changes, and it seems not have any change that would affect this behavior. tomcat's server.xml <Connector port="8080" protocol="HTTP/1.1" connectionTimeout="20000" redirectPort="8443" /> tomcat's web.xml (timeout="30 minutes") <session-config> <session-timeout>30</session-timeout> </session-config> apache-tomcat workers.properties type=ajp13 socket_timeout=300 So what is important to notice: 1) socket_timeout just kill "inactive" connections, in other words, connections with 5 minutes without any activity. The error occurs even for upload minor that 5 minutes (socket_timeout) and longer than 50 seconds (Railo's default request timeout), like a 2 minutes upload. 2) anyway, we commented this parameter (to infinity) and the same error occurred 3) We create a simple simple CFM file that just (a) sleep a couple of seconds and (b) print a Ticket Count and it ran for more than one hour, user <cfsetting requesttimeout="36000"> This test runs fine, that makes me deduce the issue occurs only when I have a <cffile action="upload"> in the template In other words: A normal CFM request runs for so long, fine. An upload, not. 4) Backing to upload issue: I's important to note the request finishes perfectly. In other words: Railo continues processing this request after the upload. The problem is, in that case, the form scope/variables is empty and Railo raises an error saying "form field [form.my_upload_field] is not a file field" We also put a <cfdump var="#form#"> before the <cffile> tag, it outputs empty. In other words: Any form field is sent. 5) This issue only occurs for long uploads. If I execute the same upload, for the same file, in a fast connection, it works fine. The error only occurs on slow connections and larger files. Once slow connections is so common in Brazil, we can't upload larger files, and I mean as "larger files", files with a few MegaBytes of size. To reproduce this issues you'll need to simulate a slower connections. Some thing like 5-10KB/s (64-128 bit/s). In many cases it's normal in Brazil, specially when accessing international sites or sites hosted abroad. You can do it using the Firefox Add-on "Firefox Throttle" (Download here<http://www.uselessapplications.com/en/Application/FirefoxThrottle.aspx?src=0%3Affthrottle%3Aoptions> ). Set a 10 KB/s link and upload a file with size of 3-5 Mb. Our Railo default timeout (Railo Web Admin - "Application" - "Request timeout") is set to 50 seconds and you can use a <cfsetting requesttimeout="3600"> (1 hour) in your CFML code for that upload test. 6) It seems the error only occurs for <cffile action="upload"> for slower connections. Import to note that the request is processed by Railo. I can even process other CFML codes before the <cffile action="upload"> tag. It seems that some internal procedure is subjected default request timeout. In other words: It seems some internal procedure/function is NOT following the <cfsetting requesttimout> parameter. The stacktrace: form field [form.fileData] is not a file field at railo.runtime.tag.FileTag.getFormItem(FileTag.java:833):833 at railo.runtime.tag.FileTag.actionUpload(FileTag.java:666):666 at railo.runtime.tag.FileTag.doStartTag(FileTag.java:299):299 at admin.tools.upload_cfm$cf.call(/wwwroot/app/admin/tools/upload.cfm:7):7 at railo.runtime.PageContextImpl.doInclude(PageContextImpl.java:763):763 at railo.runtime.listener.ModernAppListener._onRequest(ModernAppListener.java:199):199 at railo.runtime.listener.MixedAppListener.onRequest(MixedAppListener.java:23):23 at railo.runtime.PageContextImpl.execute(PageContextImpl.java:1972):1972 at railo.runtime.engine.CFMLEngineImpl.serviceCFML(CFMLEngineImpl.java:280):280 at railo.loader.servlet.CFMLServlet.service(CFMLServlet.java:32):32 at javax.servlet.http.HttpServlet.service(HttpServlet.java:717):717 at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290):290 at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206):206 at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:233):233 at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191):191 at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:128):128 at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102):102 at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109):109 at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:293):293 at org.apache.jk.server.JkCoyoteHandler.invoke(JkCoyoteHandler.java:190):190 at org.apache.jk.common.HandlerRequest.invoke(HandlerRequest.java:291):291 at org.apache.jk.common.ChannelSocket.invoke(ChannelSocket.java:769):769 at org.apache.jk.common.ChannelSocket.processConnection(ChannelSocket.java:698):698 at org.apache.jk.common.ChannelSocket$SocketConnection.runIt(ChannelSocket.java:891):891 at org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:690):690 at java.lang.Thread.run(Thread.java:636):636 Also we try to We isolated the issue trying to find out if the error occurs only with Railo, so we tested with a small java upload application and didn't work as well. We tried using directly tomcat with no mod_jk to redirect to port 80 in Apache, and no success. We also try some configuration that a member of the Railo list posted: <Connector port="8888" maxHttpHeaderSize="8192" <--- may be helpful maxThreads="150" minSpareThreads="25" maxSpareThreads="75" enableLookups="false" redirectPort="8443" acceptCount="100" connectionTimeout="20000" <--- may be helpful disableUploadTimeout="true" <--- may be helpful /> But no success. Also, we try to set the disableUploadTimeout to false, as another user of Railo List suggested.. No success too. Anyone has been passed for something like that? We are stuck in this issue, we believe that may be a tomcat issue.. Any help would be great.. Thank you. -- Odilo Schwade Junior http://br.linkedin.com/in/odilojunior