After upgrading to Http Core 4.3, one of the integration tests intermittently fail with the following error:

2013-08-10 00:54:21,501 [-] [PassThroughMessageProcessor-1] ERROR PassThroughNHttpGetProcessor Error generating ?wsdl output for service : StockQuoteProxy
at java.nio.HeapByteBuffer.put(
at org.apache.http.nio.util.SimpleOutputBuffer.write(
at org.apache.http.nio.entity.ContentOutputStream.write(
at org.apache.synapse.transport.passthru.api.PassThroughNHttpGetProcessor.sendResponseAndFinish(
at org.apache.synapse.transport.passthru.api.PassThroughNHttpGetProcessor.generateWsdl(
at org.apache.synapse.transport.passthru.api.PassThroughNHttpGetProcessor.process(
at org.apache.axis2.transport.base.threads.NativeWorkerPool$
at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(
at java.util.concurrent.ThreadPoolExecutor$

This is a very specific scenario, where Synapse doesn't mediate the request, but responds to the HTTP request on its own (WSDL generation scenario). Any idea what could have cause this issue?

My guess is this is a race condition at the output buffer. SimpleOutputBuffer is not thread safe as per the HTTP Core API docs. But it is being accessed by server worker as well as the IO dispatcher in this particular scenario. I tried using the SharedOutputBuffer and it seems to fix the problem (need to test this further). Is this is a reasonable solution?

Hiranya Jayathilaka
Mayhem Lab/RACE Lab;
Dept. of Computer Science, UCSB;
E-mail:;  Mobile: +1 (805) 895-7443