cxf-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Daniel Kulp <dk...@apache.org>
Subject Re: Thread hangs when processing large response message using LocalTransport with dispatchDirect
Date Fri, 30 Nov 2007 21:20:00 GMT

Yea, that looks very bad.    Pipes should NEVER be used on a single 
thread.   That will definitely cause a hang.   Can you log a JIRA?

It probably should use a CachedOutputStream and then grab the inputstream 
in the dispatchDirect method.

Dan


On Friday 30 November 2007, mcoogan wrote:
> I am running a local transport configured with DISPATCH_DIRECT = true.
> Small request/response messages process successfully but any request
> that generates a response > 1KB seems to hang the JVM. The problem
> appears to be in the PipedInput/OutputStreams. If the buffer (default
> size 1024B) fills up it is never flushed and the thread appears to
> hang in an eternal wait (PipedInputStream.awaitSpace())
>
> The PipedInput and PipedOutput Streams are on the same thread and
> therefore the buffer is never cleared until after the stream is
> closed.
>
> Has anyone else seen this problem or is it something I am missing in
> the configuration.
>
> Here's a code snippet of how I send the local
>
>
>         InputStream in = null;
>     	MyMessageObserver mo = new MyMessageObserver();
>
> 	try {
> 		EndpointInfo ei = new EndpointInfo(null,
> "http://schemas.xmlsoap.org/soap/http");
> 		ei.setAddress(address);
>
> 		LocalConduit conduit = (LocalConduit)localTransport.getConduit(ei);
> 		conduit.setMessageObserver(mo);
>
> 		Message msg = new MessageImpl();
> 		msg.put(LocalConduit.DIRECT_DISPATCH, true);
>
> 		in = new ByteArrayInputStream(messsageBytes);
> 		msg.setContent(InputStream.class, in);
>
> 		conduit.close(msg);
> 		return  mo.getResponseStream().toByteArray();
>
> 	}
> 	finally {
>
> 		try {
> 			if(in != null) {
> 				in.close();
> 			}
> 		} catch (Exception e) {
> 			logger.error("Error closing Stream: "+ e.getMessage());
> 		}
> 	}
>
>
> Thanks in advance



-- 
J. Daniel Kulp
Principal Engineer
IONA
P: 781-902-8727    C: 508-380-7194
daniel.kulp@iona.com
http://www.dankulp.com/blog

Mime
View raw message