struts-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "mougenko (JIRA)" <j...@apache.org>
Subject [jira] [Commented] (WW-4386) "java.io.IOException: Broken pipe" occurred
Date Mon, 18 Aug 2014 02:30:18 GMT

    [ https://issues.apache.org/jira/browse/WW-4386?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14100226#comment-14100226
] 

mougenko commented on WW-4386:
------------------------------

As you say, If I fetch the content, Exception does not occur.

But, 
・If don't use interceptor, Exception does not occur.
・If action result type is not stream, Exception does not occur.
Whether it has fetch, I believe that they should be independent.

So I believe that is not a problem of the client, it's a server problem.

> "java.io.IOException: Broken pipe" occurred
> -------------------------------------------
>
>                 Key: WW-4386
>                 URL: https://issues.apache.org/jira/browse/WW-4386
>             Project: Struts 2
>          Issue Type: Bug
>          Components: Core Interceptors
>    Affects Versions: 2.3.16.3
>         Environment: OS:RHEL Server 5.3
> JRE:1.7.0_09
> Application Server:Tomcat 8.0.9
>            Reporter: mougenko
>            Priority: Blocker
>             Fix For: 2.3.18
>
>
> When I call Action, Broken pipe Exception occur.
> ・If don't use interceptor, Exception does not occur.
> ・If action result type is not stream, Exception does not occur.
> ・If read HttpResponse, Exception does not occur.
> ・If OS is Windows, Exception does not occur.
> ・If use Tomcat BIO protocol, Exception does not occur.
> {code:title=StackTrace|borderStyle=solid}
> org.apache.catalina.connector.ClientAbortException: java.io.IOException: Broken pipe

> 	at org.apache.catalina.connector.OutputBuffer.realWriteBytes(OutputBuffer.java:389)
> 	at org.apache.tomcat.util.buf.ByteChunk.flushBuffer(ByteChunk.java:426)
> 	at org.apache.catalina.connector.OutputBuffer.doFlush(OutputBuffer.java:338)
> 	at org.apache.catalina.connector.OutputBuffer.close(OutputBuffer.java:291)
> 	at org.apache.catalina.connector.CoyoteOutputStream.close(CoyoteOutputStream.java:151)
> 	at org.apache.struts2.dispatcher.StreamResult.doExecute(StreamResult.java:305)
> 	at org.apache.struts2.dispatcher.StrutsResultSupport.execute(StrutsResultSupport.java:186)
> 	at com.opensymphony.xwork2.DefaultActionInvocation.executeResult(DefaultActionInvocation.java:371)
> 	at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:275)
> 	at org.apache.struts2.interceptor.DeprecationInterceptor.intercept(DeprecationInterceptor.java:41)
> 	at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:246)
> 	at org.apache.struts2.interceptor.debugging.DebuggingInterceptor.intercept(DebuggingInterceptor.java:256)
> 	at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:246)
> 	at com.opensymphony.xwork2.interceptor.DefaultWorkflowInterceptor.doIntercept(DefaultWorkflowInterceptor.java:167)
> 	at com.opensymphony.xwork2.interceptor.MethodFilterInterceptor.intercept(MethodFilterInterceptor.java:98)
> 	at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:246)
> 	at com.opensymphony.xwork2.validator.ValidationInterceptor.doIntercept(ValidationInterceptor.java:265)
> 	at org.apache.struts2.interceptor.validation.AnnotationValidationInterceptor.doIntercept(AnnotationValidationInterceptor.java:68)
> 	at com.opensymphony.xwork2.interceptor.MethodFilterInterceptor.intercept(MethodFilterInterceptor.java:98)
> 	at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:246)
> 	at com.opensymphony.xwork2.interceptor.ConversionErrorInterceptor.intercept(ConversionErrorInterceptor.java:138)
> 	at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:246)
> 	at com.opensymphony.xwork2.interceptor.ParametersInterceptor.doIntercept(ParametersInterceptor.java:254)
> 	at com.opensymphony.xwork2.interceptor.MethodFilterInterceptor.intercept(MethodFilterInterceptor.java:98)
> 	at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:246)
> 	at com.opensymphony.xwork2.interceptor.ParametersInterceptor.doIntercept(ParametersInterceptor.java:254)
> 	at com.opensymphony.xwork2.interceptor.MethodFilterInterceptor.intercept(MethodFilterInterceptor.java:98)
> 	at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:246)
> 	at com.opensymphony.xwork2.interceptor.StaticParametersInterceptor.intercept(StaticParametersInterceptor.java:191)
> 	at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:246)
> 	at org.apache.struts2.interceptor.MultiselectInterceptor.intercept(MultiselectInterceptor.java:73)
> 	at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:246)
> 	at org.apache.struts2.interceptor.CheckboxInterceptor.intercept(CheckboxInterceptor.java:91)
> 	at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:246)
> 	at org.apache.struts2.interceptor.FileUploadInterceptor.intercept(FileUploadInterceptor.java:252)
> 	at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:246)
> 	at com.opensymphony.xwork2.interceptor.ModelDrivenInterceptor.intercept(ModelDrivenInterceptor.java:100)
> 	at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:246)
> 	at com.opensymphony.xwork2.interceptor.ScopedModelDrivenInterceptor.intercept(ScopedModelDrivenInterceptor.java:141)
> 	at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:246)
> 	at com.opensymphony.xwork2.interceptor.ChainingInterceptor.intercept(ChainingInterceptor.java:145)
> 	at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:246)
> 	at com.opensymphony.xwork2.interceptor.PrepareInterceptor.doIntercept(PrepareInterceptor.java:171)
> 	at com.opensymphony.xwork2.interceptor.MethodFilterInterceptor.intercept(MethodFilterInterceptor.java:98)
> 	at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:246)
> 	at com.opensymphony.xwork2.interceptor.I18nInterceptor.intercept(I18nInterceptor.java:139)
> 	at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:246)
> 	at org.apache.struts2.interceptor.ServletConfigInterceptor.intercept(ServletConfigInterceptor.java:164)
> 	at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:246)
> 	at com.opensymphony.xwork2.interceptor.AliasInterceptor.intercept(AliasInterceptor.java:193)
> 	at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:246)
> 	at com.opensymphony.xwork2.interceptor.ExceptionMappingInterceptor.intercept(ExceptionMappingInterceptor.java:189)
> 	at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:246)
> 	at org.apache.struts2.impl.StrutsActionProxy.execute(StrutsActionProxy.java:54)
> 	at com.opensymphony.xwork2.ActionChainResult.execute(ActionChainResult.java:233)
> 	at com.opensymphony.xwork2.DefaultActionInvocation.executeResult(DefaultActionInvocation.java:371)
> 	at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:275)
> Caused by: java.io.IOException: Broken pipe	
> 	at sun.nio.ch.FileDispatcherImpl.write0(Native Method)
> 	at sun.nio.ch.SocketDispatcher.write(SocketDispatcher.java:47)
> 	at sun.nio.ch.IOUtil.writeFromNativeBuffer(IOUtil.java:89)
> 	at sun.nio.ch.IOUtil.write(IOUtil.java:60)
> 	at sun.nio.ch.SocketChannelImpl.write(SocketChannelImpl.java:450)
> 	at org.apache.tomcat.util.net.NioChannel.write(NioChannel.java:127)
> 	at org.apache.tomcat.util.net.NioBlockingSelector.write(NioBlockingSelector.java:101)
> 	at org.apache.tomcat.util.net.NioSelectorPool.write(NioSelectorPool.java:173)
> 	at org.apache.coyote.http11.InternalNioOutputBuffer.writeToSocket(InternalNioOutputBuffer.java:139)
> 	at org.apache.coyote.http11.InternalNioOutputBuffer.flushBuffer(InternalNioOutputBuffer.java:244)
> 	at org.apache.coyote.http11.InternalNioOutputBuffer.addToBB(InternalNioOutputBuffer.java:189)
> 	at org.apache.coyote.http11.InternalNioOutputBuffer.access$000(InternalNioOutputBuffer.java:41)
> 	at org.apache.coyote.http11.InternalNioOutputBuffer$SocketOutputBuffer.doWrite(InternalNioOutputBuffer.java:320)
> 	at org.apache.coyote.http11.filters.ChunkedOutputFilter.doWrite(ChunkedOutputFilter.java:116)
> 	at org.apache.coyote.http11.AbstractOutputBuffer.doWrite(AbstractOutputBuffer.java:257)
> 	at org.apache.coyote.Response.doWrite(Response.java:492)
> 	at org.apache.catalina.connector.OutputBuffer.realWriteBytes(OutputBuffer.java:384)
> 	... 164 more
> {code}
> {code:title=TestAction.java|borderStyle=solid}
> package sample.action;
> import java.io.ByteArrayInputStream;
> import java.io.InputStream;
> import org.apache.commons.logging.Log;
> import org.apache.commons.logging.LogFactory;
> import org.apache.struts2.convention.annotation.Action;
> import org.apache.struts2.convention.annotation.InterceptorRef;
> import org.apache.struts2.convention.annotation.ParentPackage;
> import org.apache.struts2.convention.annotation.Result;
> import com.opensymphony.xwork2.ActionSupport;
> @ParentPackage(value = "default")
> @InterceptorRef("first")
> public class TestAction extends ActionSupport {
> 	public InputStream inputStream;
> 	private static final Log log = LogFactory.getLog(TestAction.class);
> 	@Action(value = "test", results = {
> 			@Result(name = "error", type = "stream", location = "inputStream", params = {"contentType",
"text/xml; charset=UTF-8" }),
> 			@Result(name = "success", type = "stream", location = "inputStream", params = {"contentType",
"text/xml; charset=UTF-8" })
> 	})
> 	public String execute() throws Exception {
> 		try {
> 			log.info("Start");
> 			inputStream = new ByteArrayInputStream("<result>test</result>".getBytes());
> 			log.info("End");
> 			return "success";
> 		} catch (Exception e) {
> 			log.error(e.getMessage());
> 			return "error";
> 		}
> 	}
> }
> {code}
> {code:title=FirstInterceptor.java|borderStyle=solid}
> package sample.interceptor;
> import org.apache.commons.logging.Log;
> import org.apache.commons.logging.LogFactory;
> import com.opensymphony.xwork2.ActionInvocation;
> import com.opensymphony.xwork2.interceptor.AbstractInterceptor;
> public class FirstInterceptor extends AbstractInterceptor {
> 	private static final Log log = LogFactory.getLog(FirstInterceptor.class);
> 	@Override
> 	public void init() {
> 		super.init();
> 	}
> 	@Override
> 	public String intercept(ActionInvocation invocation) throws Exception {
> 		log.info("Start");
> 		String result = "";
> 		try {
> 			result = invocation.invoke();
> 		} catch (Exception e) {
> 			log.fatal(e.getMessage(), e);
> 			return "error";
> 		}
> 		log.info("End");
> 		return result;
> 	}
> }
> {code}
> {code:title=ClientMain.java|borderStyle=solid}
> package sample.client;
> import java.io.IOException;
> import java.util.ArrayList;
> import java.util.List;
> import org.apache.http.HttpResponse;
> import org.apache.http.NameValuePair;
> import org.apache.http.client.entity.UrlEncodedFormEntity;
> import org.apache.http.client.methods.HttpPost;
> import org.apache.http.impl.client.DefaultHttpClient;
> import org.apache.http.message.BasicNameValuePair;
> public class ClientMain {
> 	public static void main(String[] args) {
> 		try {
> 			for(int i = 0 ; i < 10 ; i++) {
> 				sendHttpRequest("http://<Host>/<context>/test");
> 			}
> 			System.out.println("finish");
> 		} catch(Exception e) {
> 			e.printStackTrace();
> 		}
> 	}
> 	private static void sendHttpRequest(final String url) throws IOException {
> 		HttpPost httpPost = null;
> 		try {
> 			httpPost = new HttpPost(url);
> 			DefaultHttpClient httpclient = new DefaultHttpClient();
> 			List<NameValuePair> params = new ArrayList<NameValuePair>();
> 			params.add(new BasicNameValuePair("client_type", ""));
> 			httpPost.setEntity(new UrlEncodedFormEntity(params, "UTF-8"));
> 			HttpResponse response = httpclient.execute(httpPost);
> 			if (response.getStatusLine().toString().indexOf(" 200 ") == -1) {
> 				// do something
> 			}
> 		} finally {
> 			if (httpPost != null) {
> 				httpPost.abort();
> 			}
> 		}
>     }
> }
> {code}



--
This message was sent by Atlassian JIRA
(v6.2#6252)

Mime
View raw message