Asankha C. Perera wrote:
Hi Oleg

I first tried to do the throttling version for Synapse, but didn't really get to a stable point last night.. and thus, looked at using the simple buffers first as you suggested..

I am now getting the following exception, and am trying to figure out what went wrong.. but I will have to put some debug information into the org.apache.http.nio.util classes and debug, as I cannot get much useful information from the JDK classes when this happens as they do not contain any debug information.. I am just sharing this upfront with you to see if you have any suggestion on what the cause may be

java.lang.IllegalArgumentException
   at java.nio.Buffer.position(Buffer.java:218)
   at java.nio.HeapByteBuffer.put(HeapByteBuffer.java:186)
at org.apache.http.nio.util.ExpandableBuffer.expandCapacity(ExpandableBuffer.java:81) at org.apache.http.nio.util.ExpandableBuffer.ensureCapacity(ExpandableBuffer.java:94) at org.apache.http.nio.util.SimpleOutputBuffer.write(SimpleOutputBuffer.java:63)

thanks
asankha

Hi Asankha

I am sorry I could not get back to you sooner.

I think this is because SimpleOutputBuffer is not threading safe. Synapse is writing to and reading from the buffer from different threads. You must make sure the access to the underlying HeapByteBuffer is synchronized.

Oleg



Here is a cut down of the full stack trace...

2008-05-22 11:22:26,042 [127.0.1.1-asankha] [I/O dispatcher 5] DEBUG ServerHandler HTTP connection [/127.0.0.1:22817]: Connected 2008-05-22 11:22:26,061 [127.0.1.1-asankha] [I/O dispatcher 5] DEBUG ServerHandler HTTP connection [/127.0.0.1:22817]: POST /soap/MyServiceProxy HTTP/1.1 2008-05-22 11:22:26,082 [127.0.1.1-asankha] [I/O dispatcher 5] DEBUG headers >> POST /soap/MyServiceProxy HTTP/1.1 2008-05-22 11:22:26,082 [127.0.1.1-asankha] [I/O dispatcher 5] DEBUG headers >> SOAPAction: urn:echo 2008-05-22 11:22:26,082 [127.0.1.1-asankha] [I/O dispatcher 5] DEBUG headers >> Transfer-Encoding: chunked 2008-05-22 11:22:26,082 [127.0.1.1-asankha] [I/O dispatcher 5] DEBUG headers >> Content-Type: application/soap+xml; charset=UTF-8 2008-05-22 11:22:26,082 [127.0.1.1-asankha] [I/O dispatcher 5] DEBUG headers >> Host: localhost:8080 2008-05-22 11:22:26,082 [127.0.1.1-asankha] [I/O dispatcher 5] DEBUG headers >> Connection: Keep-Alive 2008-05-22 11:22:26,082 [127.0.1.1-asankha] [I/O dispatcher 5] DEBUG headers >> User-Agent: Jakarta-HttpComponents-Bench/1.1 2008-05-22 11:22:26,082 [127.0.1.1-asankha] [I/O dispatcher 5] DEBUG ServerHandler HTTP connection [localhost/127.0.0.1:22817]: Input ready 2008-05-22 11:22:26,103 [127.0.1.1-asankha] [I/O dispatcher 5] DEBUG ServerHandler HTTP connection [localhost/127.0.0.1:22817]: Content decoder [chunk-coded; completed: false]
....
2008-05-22 11:22:26,204 [127.0.1.1-asankha] [HttpServerWorker-1] DEBUG HttpCoreNIOSender A new connection established to : localhost:9000 2008-05-22 11:22:26,204 [127.0.1.1-asankha] [HttpServerWorker-1] DEBUG Axis2HttpRequest start streaming outgoing http request 2008-05-22 11:22:26,205 [127.0.1.1-asankha] [I/O dispatcher 3] DEBUG ClientHandler HTTP connection [localhost/127.0.0.1:9000]: Connected ([EMAIL PROTECTED]) 2008-05-22 11:22:26,205 [127.0.1.1-asankha] [I/O dispatcher 3] DEBUG ClientHandler ClientHandler connected : [localhost/127.0.0.1:9000] 2008-05-22 11:22:26,209 [127.0.1.1-asankha] [I/O dispatcher 3] DEBUG headers >> POST http://localhost:9000/axis2/services/MyService HTTP/1.1 2008-05-22 11:22:26,210 [127.0.1.1-asankha] [I/O dispatcher 3] DEBUG headers >> Host: localhost:8080 2008-05-22 11:22:26,210 [127.0.1.1-asankha] [I/O dispatcher 3] DEBUG headers >> SOAPAction: urn:echo 2008-05-22 11:22:26,210 [127.0.1.1-asankha] [I/O dispatcher 3] DEBUG headers >> Content-Type: application/soap+xml; charset=UTF-8; action="urn:echo" 2008-05-22 11:22:26,210 [127.0.1.1-asankha] [I/O dispatcher 3] DEBUG headers >> Transfer-Encoding: chunked 2008-05-22 11:22:26,210 [127.0.1.1-asankha] [I/O dispatcher 3] DEBUG headers >> Connection: Keep-Alive 2008-05-22 11:22:26,210 [127.0.1.1-asankha] [I/O dispatcher 3] DEBUG headers >> User-Agent: Synapse-HttpComponents-NIO 2008-05-22 11:22:26,210 [127.0.1.1-asankha] [I/O dispatcher 3] DEBUG ClientHandler HTTP connection [localhost/127.0.0.1:9000]: Output ready 2008-05-22 11:22:26,211 [127.0.1.1-asankha] [I/O dispatcher 3] DEBUG ClientHandler HTTP connection [localhost/127.0.0.1:9000]: Content encoder [chunk-coded; completed: false]
....
2008-05-22 11:22:26,425 [127.0.1.1-asankha] [I/O dispatcher 3] DEBUG ClientHandler HTTP connection [localhost/127.0.0.1:9000]: Output ready 2008-05-22 11:22:26,425 [127.0.1.1-asankha] [I/O dispatcher 3] DEBUG ClientHandler HTTP connection [localhost/127.0.0.1:9000]: Content encoder [chunk-coded; completed: false] 2008-05-22 11:22:26,425 [127.0.1.1-asankha] [I/O dispatcher 3] DEBUG ClientHandler HTTP connection [localhost/127.0.0.1:9000]: Output ready 2008-05-22 11:22:26,429 [127.0.1.1-asankha] [HttpServerWorker-1] ERROR Axis2HttpRequest Error streaming message context
java.lang.IllegalArgumentException
   at java.nio.Buffer.position(Buffer.java:218)
   at java.nio.HeapByteBuffer.put(HeapByteBuffer.java:186)
at org.apache.http.nio.util.ExpandableBuffer.expandCapacity(ExpandableBuffer.java:81) at org.apache.http.nio.util.ExpandableBuffer.ensureCapacity(ExpandableBuffer.java:94) at org.apache.http.nio.util.SimpleOutputBuffer.write(SimpleOutputBuffer.java:63) at org.apache.http.nio.entity.ContentOutputStream.write(ContentOutputStream.java:63)
   at com.ctc.wstx.io.UTF8Writer.write(UTF8Writer.java:139)
at com.ctc.wstx.sw.BufferingXmlWriter.writeRaw(BufferingXmlWriter.java:259) at com.ctc.wstx.sw.BufferingXmlWriter.writeCharacters(BufferingXmlWriter.java:543) at com.ctc.wstx.sw.BaseStreamWriter.writeCharacters(BaseStreamWriter.java:509) at org.apache.axiom.om.impl.MTOMXMLStreamWriter.writeCharacters(MTOMXMLStreamWriter.java:237) at org.apache.axiom.om.impl.llom.OMTextImpl.writeOutput(OMTextImpl.java:255) at org.apache.axiom.om.impl.llom.OMTextImpl.internalSerializeLocal(OMTextImpl.java:414) at org.apache.axiom.om.impl.llom.OMTextImpl.internalSerialize(OMTextImpl.java:243) at org.apache.axiom.om.impl.llom.OMElementImpl.internalSerialize(OMElementImpl.java:905) at org.apache.axiom.om.impl.llom.OMElementImpl.internalSerialize(OMElementImpl.java:889) at org.apache.axiom.om.impl.llom.OMElementImpl.internalSerialize(OMElementImpl.java:905) at org.apache.axiom.om.impl.llom.OMElementImpl.internalSerialize(OMElementImpl.java:889) at org.apache.axiom.om.impl.llom.OMElementImpl.internalSerialize(OMElementImpl.java:905) at org.apache.axiom.om.impl.llom.OMElementImpl.internalSerialize(OMElementImpl.java:889) at org.apache.axiom.soap.impl.llom.SOAPEnvelopeImpl.internalSerialize(SOAPEnvelopeImpl.java:213) at org.apache.axiom.om.impl.llom.OMElementImpl.internalSerialize(OMElementImpl.java:889) at org.apache.axiom.om.impl.llom.OMNodeImpl.serialize(OMNodeImpl.java:450) at org.apache.axis2.transport.http.SOAPMessageFormatter.writeTo(SOAPMessageFormatter.java:77) at org.apache.synapse.transport.nhttp.Axis2HttpRequest.streamMessageContents(Axis2HttpRequest.java:214) at org.apache.synapse.transport.nhttp.HttpCoreNIOSender.sendAsyncRequest(HttpCoreNIOSender.java:346) at org.apache.synapse.transport.nhttp.HttpCoreNIOSender.invoke(HttpCoreNIOSender.java:256)
   at org.apache.axis2.engine.AxisEngine.send(AxisEngine.java:448)
at org.apache.synapse.core.axis2.DynamicAxisOperation$DynamicOperationClient.send(DynamicAxisOperation.java:190) at org.apache.synapse.core.axis2.DynamicAxisOperation$DynamicOperationClient.executeImpl(DynamicAxisOperation.java:174) at org.apache.axis2.client.OperationClient.execute(OperationClient.java:163) at org.apache.synapse.core.axis2.Axis2FlexibleMEPClient.send(Axis2FlexibleMEPClient.java:282)
   at org.apache.synapse.core.axis2.Axis2Sender.sendOn(Axis2Sender.java:57)
at org.apache.synapse.core.axis2.Axis2SynapseEnvironment.send(Axis2SynapseEnvironment.java:222) at org.apache.synapse.endpoints.AddressEndpoint.send(AddressEndpoint.java:202) at org.apache.synapse.core.axis2.ProxyServiceMessageReceiver.receive(ProxyServiceMessageReceiver.java:179)
   at org.apache.axis2.engine.AxisEngine.receive(AxisEngine.java:176)
at org.apache.axis2.transport.http.HTTPTransportUtils.processHTTPPostRequest(HTTPTransportUtils.java:275) at org.apache.synapse.transport.nhttp.ServerWorker.processPost(ServerWorker.java:238) at org.apache.synapse.transport.nhttp.ServerWorker.run(ServerWorker.java:194) at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:650) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:675)
   at java.lang.Thread.run(Thread.java:595)
2008-05-22 11:22:26,431 [127.0.1.1-asankha] [I/O dispatcher 3] DEBUG ClientHandler HTTP connection [localhost/127.0.0.1:9000]: Content encoder [chunk-coded; completed: false] 2008-05-22 11:22:26,434 [127.0.1.1-asankha] [HttpServerWorker-1] ERROR HttpCoreNIOSender IO Error while submiting request message for sending
org.apache.axis2.AxisFault: Error streaming message context
at org.apache.synapse.transport.nhttp.Axis2HttpRequest.handleException(Axis2HttpRequest.java:245) at org.apache.synapse.transport.nhttp.Axis2HttpRequest.streamMessageContents(Axis2HttpRequest.java:228) at org.apache.synapse.transport.nhttp.HttpCoreNIOSender.sendAsyncRequest(HttpCoreNIOSender.java:346) at org.apache.synapse.transport.nhttp.HttpCoreNIOSender.invoke(HttpCoreNIOSender.java:256)
   at org.apache.axis2.engine.AxisEngine.send(AxisEngine.java:448)
at org.apache.synapse.core.axis2.DynamicAxisOperation$DynamicOperationClient.send(DynamicAxisOperation.java:190) at org.apache.synapse.core.axis2.DynamicAxisOperation$DynamicOperationClient.executeImpl(DynamicAxisOperation.java:174) at org.apache.axis2.client.OperationClient.execute(OperationClient.java:163) at org.apache.synapse.core.axis2.Axis2FlexibleMEPClient.send(Axis2FlexibleMEPClient.java:282)
   at org.apache.synapse.core.axis2.Axis2Sender.sendOn(Axis2Sender.java:57)
at org.apache.synapse.core.axis2.Axis2SynapseEnvironment.send(Axis2SynapseEnvironment.java:222) at org.apache.synapse.endpoints.AddressEndpoint.send(AddressEndpoint.java:202) at org.apache.synapse.core.axis2.ProxyServiceMessageReceiver.receive(ProxyServiceMessageReceiver.java:179)
   at org.apache.axis2.engine.AxisEngine.receive(AxisEngine.java:176)
at org.apache.axis2.transport.http.HTTPTransportUtils.processHTTPPostRequest(HTTPTransportUtils.java:275) at org.apache.synapse.transport.nhttp.ServerWorker.processPost(ServerWorker.java:238) at org.apache.synapse.transport.nhttp.ServerWorker.run(ServerWorker.java:194) at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:650) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:675)
   at java.lang.Thread.run(Thread.java:595)
Caused by: java.lang.IllegalArgumentException
   at java.nio.Buffer.position(Buffer.java:218)
   at java.nio.HeapByteBuffer.put(HeapByteBuffer.java:186)
at org.apache.http.nio.util.ExpandableBuffer.expandCapacity(ExpandableBuffer.java:81) at org.apache.http.nio.util.ExpandableBuffer.ensureCapacity(ExpandableBuffer.java:94) at org.apache.http.nio.util.SimpleOutputBuffer.write(SimpleOutputBuffer.java:63) at org.apache.http.nio.entity.ContentOutputStream.write(ContentOutputStream.java:63)
   at com.ctc.wstx.io.UTF8Writer.write(UTF8Writer.java:139)
at com.ctc.wstx.sw.BufferingXmlWriter.writeRaw(BufferingXmlWriter.java:259) at com.ctc.wstx.sw.BufferingXmlWriter.writeCharacters(BufferingXmlWriter.java:543) at com.ctc.wstx.sw.BaseStreamWriter.writeCharacters(BaseStreamWriter.java:509) at org.apache.axiom.om.impl.MTOMXMLStreamWriter.writeCharacters(MTOMXMLStreamWriter.java:237) at org.apache.axiom.om.impl.llom.OMTextImpl.writeOutput(OMTextImpl.java:255) at org.apache.axiom.om.impl.llom.OMTextImpl.internalSerializeLocal(OMTextImpl.java:414) at org.apache.axiom.om.impl.llom.OMTextImpl.internalSerialize(OMTextImpl.java:243) at org.apache.axiom.om.impl.llom.OMElementImpl.internalSerialize(OMElementImpl.java:905) at org.apache.axiom.om.impl.llom.OMElementImpl.internalSerialize(OMElementImpl.java:889) at org.apache.axiom.om.impl.llom.OMElementImpl.internalSerialize(OMElementImpl.java:905) at org.apache.axiom.om.impl.llom.OMElementImpl.internalSerialize(OMElementImpl.java:889) at org.apache.axiom.om.impl.llom.OMElementImpl.internalSerialize(OMElementImpl.java:905) at org.apache.axiom.om.impl.llom.OMElementImpl.internalSerialize(OMElementImpl.java:889) at org.apache.axiom.soap.impl.llom.SOAPEnvelopeImpl.internalSerialize(SOAPEnvelopeImpl.java:213) at org.apache.axiom.om.impl.llom.OMElementImpl.internalSerialize(OMElementImpl.java:889) at org.apache.axiom.om.impl.llom.OMNodeImpl.serialize(OMNodeImpl.java:450) at org.apache.axis2.transport.http.SOAPMessageFormatter.writeTo(SOAPMessageFormatter.java:77) at org.apache.synapse.transport.nhttp.Axis2HttpRequest.streamMessageContents(Axis2HttpRequest.java:214)
   ... 18 more
2008-05-22 11:22:26,434 [127.0.1.1-asankha] [I/O dispatcher 3] DEBUG ClientHandler HTTP connection [localhost/127.0.0.1:9000]: Output ready 2008-05-22 11:22:26,435 [127.0.1.1-asankha] [HttpServerWorker-1] ERROR Axis2Sender Unexpected error during sending message out org.apache.axis2.AxisFault: IO Error while submiting request message for sending at org.apache.synapse.transport.nhttp.HttpCoreNIOSender.handleException(HttpCoreNIOSender.java:541) at org.apache.synapse.transport.nhttp.HttpCoreNIOSender.sendAsyncRequest(HttpCoreNIOSender.java:351) at org.apache.synapse.transport.nhttp.HttpCoreNIOSender.invoke(HttpCoreNIOSender.java:256)
   at org.apache.axis2.engine.AxisEngine.send(AxisEngine.java:448)
at org.apache.synapse.core.axis2.DynamicAxisOperation$DynamicOperationClient.send(DynamicAxisOperation.java:190) at org.apache.synapse.core.axis2.DynamicAxisOperation$DynamicOperationClient.executeImpl(DynamicAxisOperation.java:174) at org.apache.axis2.client.OperationClient.execute(OperationClient.java:163) at org.apache.synapse.core.axis2.Axis2FlexibleMEPClient.send(Axis2FlexibleMEPClient.java:282)
   at org.apache.synapse.core.axis2.Axis2Sender.sendOn(Axis2Sender.java:57)
at org.apache.synapse.core.axis2.Axis2SynapseEnvironment.send(Axis2SynapseEnvironment.java:222) at org.apache.synapse.endpoints.AddressEndpoint.send(AddressEndpoint.java:202) at org.apache.synapse.core.axis2.ProxyServiceMessageReceiver.receive(ProxyServiceMessageReceiver.java:179)
   at org.apache.axis2.engine.AxisEngine.receive(AxisEngine.java:176)
at org.apache.axis2.transport.http.HTTPTransportUtils.processHTTPPostRequest(HTTPTransportUtils.java:275) at org.apache.synapse.transport.nhttp.ServerWorker.processPost(ServerWorker.java:238) at org.apache.synapse.transport.nhttp.ServerWorker.run(ServerWorker.java:194) at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:650) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:675)
   at java.lang.Thread.run(Thread.java:595)
Caused by: org.apache.axis2.AxisFault: Error streaming message context
at org.apache.synapse.transport.nhttp.Axis2HttpRequest.handleException(Axis2HttpRequest.java:245) at org.apache.synapse.transport.nhttp.Axis2HttpRequest.streamMessageContents(Axis2HttpRequest.java:228) at org.apache.synapse.transport.nhttp.HttpCoreNIOSender.sendAsyncRequest(HttpCoreNIOSender.java:346)
   ... 17 more
Caused by: java.lang.IllegalArgumentException
   at java.nio.Buffer.position(Buffer.java:218)
   at java.nio.HeapByteBuffer.put(HeapByteBuffer.java:186)
at org.apache.http.nio.util.ExpandableBuffer.expandCapacity(ExpandableBuffer.java:81) at org.apache.http.nio.util.ExpandableBuffer.ensureCapacity(ExpandableBuffer.java:94) at org.apache.http.nio.util.SimpleOutputBuffer.write(SimpleOutputBuffer.java:63) at org.apache.http.nio.entity.ContentOutputStream.write(ContentOutputStream.java:63)
   at com.ctc.wstx.io.UTF8Writer.write(UTF8Writer.java:139)
at com.ctc.wstx.sw.BufferingXmlWriter.writeRaw(BufferingXmlWriter.java:259) at com.ctc.wstx.sw.BufferingXmlWriter.writeCharacters(BufferingXmlWriter.java:543) at com.ctc.wstx.sw.BaseStreamWriter.writeCharacters(BaseStreamWriter.java:509) at org.apache.axiom.om.impl.MTOMXMLStreamWriter.writeCharacters(MTOMXMLStreamWriter.java:237) at org.apache.axiom.om.impl.llom.OMTextImpl.writeOutput(OMTextImpl.java:255) at org.apache.axiom.om.impl.llom.OMTextImpl.internalSerializeLocal(OMTextImpl.java:414) at org.apache.axiom.om.impl.llom.OMTextImpl.internalSerialize(OMTextImpl.java:243) at org.apache.axiom.om.impl.llom.OMElementImpl.internalSerialize(OMElementImpl.java:905) at org.apache.axiom.om.impl.llom.OMElementImpl.internalSerialize(OMElementImpl.java:889) at org.apache.axiom.om.impl.llom.OMElementImpl.internalSerialize(OMElementImpl.java:905) at org.apache.axiom.om.impl.llom.OMElementImpl.internalSerialize(OMElementImpl.java:889) at org.apache.axiom.om.impl.llom.OMElementImpl.internalSerialize(OMElementImpl.java:905) at org.apache.axiom.om.impl.llom.OMElementImpl.internalSerialize(OMElementImpl.java:889) at org.apache.axiom.soap.impl.llom.SOAPEnvelopeImpl.internalSerialize(SOAPEnvelopeImpl.java:213) at org.apache.axiom.om.impl.llom.OMElementImpl.internalSerialize(OMElementImpl.java:889) at org.apache.axiom.om.impl.llom.OMNodeImpl.serialize(OMNodeImpl.java:450) at org.apache.axis2.transport.http.SOAPMessageFormatter.writeTo(SOAPMessageFormatter.java:77) at org.apache.synapse.transport.nhttp.Axis2HttpRequest.streamMessageContents(Axis2HttpRequest.java:214)

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to