Hello, This is what I have inside my mod_jk.conf for Apache --- LoadModule jk_module modules/mod_jk.so <IfModule mod_jk.c> JkWorkersFile /etc/httpd/conf.d/workers.properties JkLogFile /etc/httpd/logs/mod_jk.log JkLogLevel info JkLogStampFormat "[%a %b %d %H:%M:%S %Y] " JkOptions +ForwardKeySize +ForwardURICompatUnparsed +FlushHeader JkRequestLogFormat "%w %V %T" JkShmFile /var/run/mod_jk.shm # mount points JKMount /products/*.jsp ajp13 JKMount /products/* ajp13 </IfModule> ---
This is the workers.properties file extract for the ajp13 worker --- worker.ajp13.port=15509 worker.ajp13.host=localhost worker.ajp13.type=ajp13 worker.ajp13.lbfactor=1 worker.ajp13.socket_keepalive=1 worker.ajp13.socket_timeout=0 --- I refrain from +FlushPackets because as the guide indicates, it gives a strong performance penalty to for Apache and Tomcat. As for the timeout, not sure which one to use and the default is already "0" which means indefinite. Any help are appreciated. -- Best regards, Ketut Mahaindra (Ito) -----Original Message----- From: Rainer Jung [mailto:[EMAIL PROTECTED] Sent: Friday, June 01, 2007 4:04 PM To: Tomcat Users List Subject: Re: Problem with mod_jk / tomcat on file streaming Have a look at the flush options on http://tomcat.apache.org/connectors-doc/reference/apache.html and maybe at the various timeouts at http://tomcat.apache.org/connectors-doc/reference/workers.html There is also a Timeout directive for Apache httpd. If you can't find it out, post your config and more details: in case you can reproduce, you can set JkLogLevel to trace and we'll most likely see, why mod_jk closes the connection to Tomcat (if so). Packet dumps are also helpful. There is no known issue, apart from the need of correct flush settings for streaming. Regards, Rainer MAHAINDRA Ketut wrote: > Hello all, > > > > I have a problem when using Tomcat 5.5.23 and apache/mod_jk 1.2.23. > > I have a piece of code that will stream a file when a download request > is made by a user. > > > > ... > > response.setContentType("application/octet-stream"); > > response.setContentLength((int)fDownload.length()); > > response.setHeader("Content-Disposition", "attachment; filename=\"" + > fromFileName + "\""); > > > > // read the fromFile and write to output stream > > FileInputStream fis = new FileInputStream(location + "/" + > fromFileName); //$NON-NLS-1$ > > BufferedOutputStream bos = new > BufferedOutputStream(response.getOutputStream()); > > int iLen =0; > > byte[] buffer = new byte[4096]; > > while ((iLen = fis.read(buffer)) != -1) { > > bos.write(buffer,0,iLen); > > } > > fis.close(); > > bos.close(); > > ... > > > > When the application is accessed directly through Tomcat on port 8080, > there is no problem. > > But when we put apache / mod_jk to provide connection to tomcat, the > stream is disconnected prematurely at around 450K with the following > exceptions logged in catalina.out. > > > > ClientAbortException: java.io.IOException > > at > org.apache.catalina.connector.OutputBuffer.realWriteBytes(OutputBuffer.j > ava:366) > > at > org.apache.tomcat.util.buf.ByteChunk.flushBuffer(ByteChunk.java:432) > > at > org.apache.tomcat.util.buf.ByteChunk.append(ByteChunk.java:347) > > at > org.apache.catalina.connector.OutputBuffer.writeBytes(OutputBuffer.java: > 392) > > at > org.apache.catalina.connector.OutputBuffer.write(OutputBuffer.java:381) > > at > org.apache.catalina.connector.CoyoteOutputStream.write(CoyoteOutputStrea > m.java:89) > > at > java.io.BufferedOutputStream.flushBuffer(BufferedOutputStream.java:65) > > at > java.io.BufferedOutputStream.write(BufferedOutputStream.java:109) > > at > com.gemalto.tools.lkms.actions.ManageVersionAction.downloadFile(Unknown > Source) > > at > com.gemalto.tools.lkms.actions.ManageVersionAction.execute(Unknown > Source) > > at > org.apache.struts.chain.commands.servlet.ExecuteAction.execute(ExecuteAc > tion.java:58) > > at > org.apache.struts.chain.commands.AbstractExecuteAction.execute(AbstractE > xecuteAction.java:67) > > at > org.apache.struts.chain.commands.ActionCommandBase.execute(ActionCommand > Base.java:51) > > at > org.apache.commons.chain.impl.ChainBase.execute(ChainBase.java:190) > > at > org.apache.commons.chain.generic.LookupCommand.execute(LookupCommand.jav > a:304) > > at > org.apache.commons.chain.impl.ChainBase.execute(ChainBase.java:190) > > at > org.apache.struts.chain.ComposableRequestProcessor.process(ComposableReq > uestProcessor.java:283) > > at > org.apache.struts.action.ActionServlet.process(ActionServlet.java:1913) > > at > org.apache.struts.action.ActionServlet.doPost(ActionServlet.java:462) > > at javax.servlet.http.HttpServlet.service(HttpServlet.java:710) > > at javax.servlet.http.HttpServlet.service(HttpServlet.java:803) > > at > org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(Applica > tionFilterChain.java:269) > > at > org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilt > erChain.java:188) > > at > com.gemalto.tools.lkms.util.SetCharacterEncodingFilter.doFilter(Unknown > Source) > > at > org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(Applica > tionFilterChain.java:215) > > at > org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilt > erChain.java:188) > > at > org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValv > e.java:210) > > at > org.apache.catalina.core.StandardContextValve.invoke(StandardContextValv > e.java:174) > > at > org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java > :127) > > at > org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java > :117) > > at > org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:542 > ) > > at > org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve. > java:108) > > at > org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:1 > 51) > > at > org.apache.coyote.ajp.AjpAprProcessor.process(AjpAprProcessor.java:444) > > at > org.apache.coyote.ajp.AjpAprProtocol$AjpConnectionHandler.process(AjpApr > Protocol.java:472) > > at > org.apache.tomcat.util.net.AprEndpoint$Worker.run(AprEndpoint.java:1286) > > at java.lang.Thread.run(Thread.java:595) > > Caused by: java.io.IOException > > at > org.apache.coyote.ajp.AjpAprProcessor.flush(AjpAprProcessor.java:1197) > > at > org.apache.coyote.ajp.AjpAprProcessor$SocketOutputBuffer.doWrite(AjpAprP > rocessor.java:1282) > > at org.apache.coyote.Response.doWrite(Response.java:560) > > at > org.apache.catalina.connector.OutputBuffer.realWriteBytes(OutputBuffer.j > ava:361) > > ... 36 more > > > > > > Is there any issue on the code ? > > Or is it a known mod_jk issue ? Or is it perhaps a configuration issue > on my side ? --------------------------------------------------------------------- To start a new topic, e-mail: users@tomcat.apache.org To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] --------------------------------------------------------------------- To start a new topic, e-mail: users@tomcat.apache.org To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]