size of the image you are copying? if is over 2gb you might want to implment copyLarge method http://commons.apache.org/io/api-release/org/apache/commons/io/IOUtils.html#copyLarge(java.io.InputStream,%20java.io.OutputStream)
also would be a good idea to trap IOException and NullPointerException hth Martin ______________________________________________ Verzicht und Vertraulichkeitanmerkung/Note de déni et de confidentialité Diese Nachricht ist vertraulich. Sollten Sie nicht der vorgesehene Empfaenger sein, so bitten wir hoeflich um eine Mitteilung. Jede unbefugte Weiterleitung oder Fertigung einer Kopie ist unzulaessig. Diese Nachricht dient lediglich dem Austausch von Informationen und entfaltet keine rechtliche Bindungswirkung. Aufgrund der leichten Manipulierbarkeit von E-Mails koennen wir keine Haftung fuer den Inhalt uebernehmen. Ce message est confidentiel et peut être privilégié. Si vous n'êtes pas le destinataire prévu, nous te demandons avec bonté que pour satisfaire informez l'expéditeur. N'importe quelle diffusion non autorisée ou la copie de ceci est interdite. Ce message sert à l'information seulement et n'aura pas n'importe quel effet légalement obligatoire. Étant donné que les email peuvent facilement être sujets à la manipulation, nous ne pouvons accepter aucune responsabilité pour le contenu fourni. > Date: Mon, 6 Jul 2009 11:23:29 -0700 > Subject: request thread hanging > From: wglasshus...@gmail.com > To: users@tomcat.apache.org > > Hi, > > I've got request threads hanging -- I can't seem to find out why. > I've got a servlet that is sending an image retrieved from Jackrabbit. > I use Commons IO -- IOUtils.copy()-- to copy the stream from the > Jackrabbit node to response.getOutputStream(). > > Over time, the Tomcat manager shows an increasing number of request > threads hanging for a long (infinite?) time. It's erratic, but the > thread appears to be stuck when a request is not allowed to complete, > e.g. if I hit "stop" on my browser while downloading the image. I > can't replicate this on my test machine. > > My configuration is httpd 2.0.52 -> mod_jk 1.2.26 -> Tomcat 6.0.18 > (Windows) with tcnative 1.1.14. > > I used jconsole to get a dump of the stuck thread -- see below. It > looks like it is hanging on native method sendbb. I checked the > archives and issue list, couldn't find anything relevant. > > Would appreciate any suggestions for further investigation. > > Best, WILL > > > Name: ajp-8009-1 > State: RUNNABLE > Total blocked: 56 Total waited: 1,111 > > Stack trace: > org.apache.tomcat.jni.Socket.sendbb(Native Method) > org.apache.coyote.ajp.AjpAprProcessor.flush(AjpAprProcessor.java:1184) > org.apache.coyote.ajp.AjpAprProcessor$SocketOutputBuffer.doWrite(AjpAprProcessor.java:1271) > org.apache.coyote.Response.doWrite(Response.java:560) > org.apache.catalina.connector.OutputBuffer.realWriteBytes(OutputBuffer.java:353) > org.apache.tomcat.util.buf.ByteChunk.flushBuffer(ByteChunk.java:434) > org.apache.tomcat.util.buf.ByteChunk.append(ByteChunk.java:349) > org.apache.catalina.connector.OutputBuffer.writeBytes(OutputBuffer.java:381) > org.apache.catalina.connector.OutputBuffer.write(OutputBuffer.java:370) > org.apache.catalina.connector.CoyoteOutputStream.write(CoyoteOutputStream.java:89) > org.apache.commons.io.IOUtils.copyLarge(IOUtils.java:1026) > org.apache.commons.io.IOUtils.copy(IOUtils.java:999) > com.forio.broadcast.controller.view.ImageView.renderMergedOutputModel(ImageView.java:29) > org.springframework.web.servlet.view.AbstractView.render(AbstractView.java:257) > org.springframework.web.servlet.DispatcherServlet.render(DispatcherServlet.java:1183) > org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:902) > org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:807) > org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:571) > org.springframework.web.servlet.FrameworkServlet.doGet(FrameworkServlet.java:501) > javax.servlet.http.HttpServlet.service(HttpServlet.java:617) > javax.servlet.http.HttpServlet.service(HttpServlet.java:717) > > --------------------------------------------------------------------- > To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org > For additional commands, e-mail: users-h...@tomcat.apache.org > _________________________________________________________________ Windows Live™ SkyDrive™: Get 25 GB of free online storage. http://windowslive.com/online/skydrive?ocid=TXT_TAGLM_WL_SD_25GB_062009