Bug 29855 - Broken pipe exception on large POST data
Summary: Broken pipe exception on large POST data
Status: RESOLVED INVALID
Alias: None
Product: Tomcat 5
Classification: Unclassified
Component: Servlets:CGI (show other bugs)
Version: 5.0.0
Hardware: All Solaris
: P3 major (vote)
Target Milestone: ---
Assignee: Tomcat Developers Mailing List
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2004-06-29 06:17 UTC by jon wayne
Modified: 2007-11-21 00:43 UTC (History)
0 users



Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description jon wayne 2004-06-29 06:17:40 UTC
Hi
Everytime I send a large POST data alongwith a cgi to be executed, CGIServlet 
thrown an I/O exception viz. broken pipe; which's promptly displayed to the user
(though the cgi runs just fine, the data is written to the outputstream and the 
cgi gets executed)
TO prevent the user from seeing this message, I figured out I cud catch the 
exception just after the CGIServlet attempts to write the post data.

Any idea why the write to the Process outputstream throws the BrokenPipe 
Exception
Thanks !
Comment 1 Mark Thomas 2004-06-29 19:58:44 UTC
I'll have a look at this. Answers to the following would help.
1. What size is 'large'?
2. Do you have a stack trace? If so please attach.
3. Are you really using 5.0.0? There have been quite a few changes since this 
release.
Comment 2 jon wayne 2004-06-30 11:49:49 UTC
Hi 
Sure !
1. Large as in Post data sent in the range of 50 to 60 kB.
2. I'm using Tomcat4.0 on a solaris platform
3. I tried changing the size of the BufferedOutputStream (the point where it 
writes comes back from getPostInput() , converts the post string to a byte 
array and write it to the Process' ouptut stream); didn't help, inspite of 
setting it to the exact number of bytes the byte array.

4. here's the stack trace(If i catch the i/o exception at this point, everthng 
works just fine) [i get a Http 500 exception.]

java.io.IOException: Broken pipe
	at java.io.FileOutputStream.writeBytes(Native Method)
	at java.io.FileOutputStream.write(FileOutputStream.java:257)
	at java.io.BufferedOutputStream.write(BufferedOutputStream.java:109)
	at java.io.BufferedOutputStream.write(BufferedOutputStream.java:109)
	at java.io.FilterOutputStream.write(FilterOutputStream.java:80)
	at com.tekelec.sentinel.webframework.servlet.CGIServlet$CGIRunner.run
(Unknown Source)
	at com.tekelec.sentinel.webframework.servlet.CGIServlet.doGet(Unknown 
Source)
	at com.tekelec.sentinel.webframework.servlet.CGIServlet.doPost(Unknown 
Source)
	at javax.servlet.http.HttpServlet.service(HttpServlet.java:760)
	at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
	at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter
(ApplicationFilterChain.java:247)
	at org.apache.catalina.core.ApplicationFilterChain.doFilter
(ApplicationFilterChain.java:193)
	at com.tekelec.sentinel.webframework.filter.CGISessionFilter.doFilter
(Unknown Source)
	at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter
(ApplicationFilterChain.java:213)
	at org.apache.catalina.core.ApplicationFilterChain.doFilter
(ApplicationFilterChain.java:193)
	at 
com.tekelec.sentinel.webframework.filter.ExpiredCredentialsFilter.doFilter
(Unknown Source)
	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:260)
	at 
org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNex
t(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.invokeNex
t(StandardPipeline.java:643)
	at org.apache.catalina.authenticator.AuthenticatorBase.invoke(Unknown 
Source)
	at 
org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNex
t(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:2415)
	at org.apache.catalina.core.StandardHostValve.invoke
(StandardHostValve.java:180)
	at 
org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNex
t(StandardPipeline.java:643)
	at org.apache.catalina.valves.ErrorDispatcherValve.invoke
(ErrorDispatcherValve.java:170)
	at 
org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNex
t(StandardPipeline.java:641)
	at org.apache.catalina.valves.ErrorReportValve.invoke
(ErrorReportValve.java:172)
	at 
org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNex
t(StandardPipeline.java:641)
	at org.apache.catalina.valves.AccessLogValve.invoke
(AccessLogValve.java:509)
	at 
org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNex
t(StandardPipeline.java:641)
	at org.apache.catalina.authenticator.SingleSignOn.invoke(Unknown Source)
	at 
org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNex
t(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.invokeNex
t(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:223)
	at org.apache.coyote.http11.Http11Processor.process
(Http11Processor.java:432)
	at 
org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.processConnectio
n(Http11Protocol.java:386)
	at org.apache.tomcat.util.net.TcpWorkerThread.runIt
(PoolTcpEndpoint.java:534)
	at org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run
(ThreadPool.java:530)
	at java.lang.Thread.run(Thread.java:536)

5. I'm not sure if tomcat5 would have made any changes to the CGIServlet.
Thanks
Jon
Comment 3 Yoav Shapira 2004-07-28 15:05:34 UTC
Tomcat 5 has made changes to the CGI servlet as well as relevant Connector 
code.  Please re-test on Tomcat 5.0.27 or later.  Thanks.
Comment 4 Yoav Shapira 2004-09-15 16:12:17 UTC
I'm closing this issue as it's likely been fixed since Tomcat 4.0 and there has 
been no response to my request to retest on a more recent stable Tomcat release.
Comment 5 Florian Kolbe 2007-11-21 00:43:08 UTC
For me the problem was the PHP executable with a setting in the php.ini
'post_max_size' which was exceeded, leeding to the 'Broken Pipe' IOException
while writing the POST data.

A patch could be to catch this, since PHP still executes fine (although the
upload will fail).

Also see http://www.php.net/manual/en/features.file-upload.php