Our Products:   CompleteFTP  edtFTPnet/Free  edtFTPnet/PRO  edtFTPj/Free  edtFTPj/PRO
0 votes
6.9k views
in Java FTP by
Hi - I keep getting Broken Pipe errors on file downloads - any ideas?

I have included the stack trace and the calling servlet and a utility class which wraps the enterprisedt code:

Stack Trace

2004-04-14 09:13:25,493 ERROR [STDERR] kmaMgr.util.KMAFTPException: null; CausedByException is:
   Broken pipe
2004-04-14 09:13:25,524 ERROR [STDERR]    at kmaMgr.util.FTPConnectionMgr.getFile(FTPConnectionMgr.java:78)
2004-04-14 09:13:25,525 ERROR [STDERR]    at kmaMgr.servlets.CheckOut.doGet(CheckOut.java:65)
2004-04-14 09:13:25,525 ERROR [STDERR]    at javax.servlet.http.HttpServlet.service(HttpServlet.java:740)
2004-04-14 09:13:25,526 ERROR [STDERR]    at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
2004-04-14 09:13:25,526 ERROR [STDERR]    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:247)
2004-04-14 09:13:25,527 ERROR [STDERR]    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:193)
2004-04-14 09:13:25,528 ERROR [STDERR]    at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:256)
2004-04-14 09:13:25,528 ERROR [STDERR]    at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:643)
2004-04-14 09:13:25,529 ERROR [STDERR]    at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:480)
2004-04-14 09:13:25,529 ERROR [STDERR]    at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:995)
2004-04-14 09:13:25,530 ERROR [STDERR]    at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191)
2004-04-14 09:13:25,531 ERROR [STDERR]    at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:643)
2004-04-14 09:13:25,531 ERROR [STDERR]    at org.apache.catalina.valves.CertificatesValve.invoke(CertificatesValve.java:246)
2004-04-14 09:13:25,532 ERROR [STDERR]    at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:641)
2004-04-14 09:13:25,532 ERROR [STDERR]    at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:480)
2004-04-14 09:13:25,533 ERROR [STDERR]    at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:995)
2004-04-14 09:13:25,534 ERROR [STDERR]    at org.apache.catalina.core.StandardContext.invoke(StandardContext.java:2415)
2004-04-14 09:13:25,534 ERROR [STDERR]    at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:180)
2004-04-14 09:13:25,535 ERROR [STDERR]    at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:643)
2004-04-14 09:13:25,535 ERROR [STDERR]    at org.apache.catalina.valves.ErrorDispatcherValve.invoke(ErrorDispatcherValve.java:171)
2004-04-14 09:13:25,536 ERROR [STDERR]    at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:641)
2004-04-14 09:13:25,537 ERROR [STDERR]    at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:172)
2004-04-14 09:13:25,538 ERROR [STDERR]    at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:641)
2004-04-14 09:13:25,539 ERROR [STDERR]    at org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:509)
2004-04-14 09:13:25,539 ERROR [STDERR]    at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:641)
2004-04-14 09:13:25,540 ERROR [STDERR]    at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:480)
2004-04-14 09:13:25,541 ERROR [STDERR]    at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:995)
2004-04-14 09:13:25,542 ERROR [STDERR]    at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:174)
2004-04-14 09:13:25,542 ERROR [STDERR]    at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:643)
2004-04-14 09:13:25,543 ERROR [STDERR]    at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:480)
2004-04-14 09:13:25,544 ERROR [STDERR]    at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:995)
2004-04-14 09:13:25,544 ERROR [STDERR]    at org.apache.coyote.tomcat4.CoyoteAdapter.service(CoyoteAdapter.java:223)
2004-04-14 09:13:25,545 ERROR [STDERR]    at org.apache.jk.server.JkCoyoteHandler.invoke(JkCoyoteHandler.java:261)
2004-04-14 09:13:25,546 ERROR [STDERR]    at org.apache.jk.common.HandlerRequest.invoke(HandlerRequest.java:360)
2004-04-14 09:13:25,546 ERROR [STDERR]    at org.apache.jk.common.ChannelSocket.invoke(ChannelSocket.java:604)
2004-04-14 09:13:25,547 ERROR [STDERR]    at org.apache.jk.common.ChannelSocket.processConnection(ChannelSocket.java:562)
2004-04-14 09:13:25,547 ERROR [STDERR]    at org.apache.jk.common.SocketConnection.runIt(ChannelSocket.java:679)
2004-04-14 09:13:25,548 ERROR [STDERR]    at org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:619)
2004-04-14 09:13:25,549 ERROR [STDERR]    at java.lang.Thread.run(Thread.java:536)
2004-04-14 09:13:25,549 ERROR [STDERR] java.net.SocketException: Broken pipe
2004-04-14 09:13:25,552 ERROR [STDERR]    at java.net.SocketOutputStream.socketWrite0(Native Method)
2004-04-14 09:13:25,553 ERROR [STDERR]    at java.net.SocketOutputStream.socketWrite(SocketOutputStream.java:92)
2004-04-14 09:13:25,553 ERROR [STDERR]    at java.net.SocketOutputStream.write(SocketOutputStream.java:136)
2004-04-14 09:13:25,554 ERROR [STDERR]    at org.apache.jk.common.ChannelSocket.send(ChannelSocket.java:407)
2004-04-14 09:13:25,555 ERROR [STDERR]    at org.apache.jk.common.ChannelSocket.invoke(ChannelSocket.java:599)
2004-04-14 09:13:25,555 ERROR [STDERR]    at org.apache.jk.server.JkCoyoteHandler.doWrite(JkCoyoteHandler.java:216)
2004-04-14 09:13:25,556 ERROR [STDERR]    at org.apache.coyote.Response.doWrite(Response.java:524)
2004-04-14 09:13:25,556 ERROR [STDERR]    at org.apache.coyote.tomcat4.OutputBuffer.realWriteBytes(OutputBuffer.java:384)
2004-04-14 09:13:25,558 ERROR [STDERR]    at org.apache.tomcat.util.buf.ByteChunk.flushBuffer(ByteChunk.java:439)
2004-04-14 09:13:25,558 ERROR [STDERR]    at org.apache.coyote.tomcat4.OutputBuffer.flush(OutputBuffer.java:348)
2004-04-14 09:13:25,559 ERROR [STDERR]    at org.apache.coyote.tomcat4.OutputBuffer.close(OutputBuffer.java:323)
2004-04-14 09:13:25,560 ERROR [STDERR] &nb

5 Answers

0 votes
by
Grumpy answer: Consider buying support from http://www.enterprisedt.com/products/ed ... pport.html and we can wade through your huge stack trace and your code! Please don't post quite so much stuff in one go.

Nicer answer: after a quick glance, one thing to try would be to getFile into a byte array instead of directly into the ServletOutputStream (as below), and then write to the outputstream from that. And read the FAQ. And then buy support.

Hi - I keep getting Broken Pipe errors on file downloads - any ideas?

ServletOutputStream out = response.getOutputStream(); 
connectionMgr.getFile(out, document.getDocumentTitle()); 

0 votes
by
I've gotten this error a few times, namely with very large transfers. I think it is either a system buffering issue or caused by netwrok connections breaking (high traffic, causes an interrupt breaking the connection)... hence why an auto-retry would be very valuable.
0 votes
by
Hi EDT Support

I did some tests with the FTP client because I occasionally get the "broken pipe" or the "Connection Reset" exeption. Only one or 2 out of 5000 uploads are failing.
An immediate susequent upload of the same file is working fine. Hence I introduced a "retry count" feature in my code.

Did you plan to provide such a retry feature out of the box? This would be very handy?

Thanks
Rainer

PS: Here is a link with more info about this:
http://help.blogger.com/bin/answer.py?a ... 3&topic=19
0 votes
by (161k points)
Hi, thanks for the suggestion.

We probably won't add such a feature as it is easy to implement and users have widely varying requirements about what to do when an exception is thronw.

Hi EDT Support

I did some tests with the FTP client because I occasionally get the "broken pipe" or the "Connection Reset" exeption. Only one or 2 out of 5000 uploads are failing.
An immediate susequent upload of the same file is working fine. Hence I introduced a "retry count" feature in my code.

Did you plan to provide such a retry feature out of the box? This would be very handy?

Thanks
Rainer

PS: Here is a link with more info about this:
http://help.blogger.com/bin/answer.py?a ... 3&topic=19
0 votes
by
Ok I understand.
Thanks for the quick response (and for this great FTP Client)

Rainer

Categories

...