[ http://wso2.org/jira/browse/ESBJAVA-370?page=all ]

indika kumara resolved ESBJAVA-370.
-----------------------------------

    Fix Version/s: NIGHTLY
       Resolution: Fixed

This error was occurred when try to resend the same response message 
(HttpRespone) again. HttpRespone always checks for availability of http headers 
before sending it and if already available then throws corresponding exception. 
With the provided configuration sending twice will occur ,only when all the 
child endpoints of Loadbalance endpoint are inactive. In this scenario the 
onError ('fault') sequence invokes with the message (the message which are 
injected  to the  endpoints )  and because all child endpoints are inactive , 
onError sequence will execute and then ,using this message ,the send mediator 
inside ('fault') sequence will send response back to the client (first time 
sending)and then message going to the out mediator (because the property 
mediator has already set the message as a response( <syn:property 
name="RESPONSE" value="true"/>). The send mediator inside the out mediator will 
try to resend same response(second time)  and throws the Exception ). This 
exception will not occur if any child endpoint  with in the LoadBalance 
endpoint is active ( If one or more times synapse call an external endpoint).In 
this case , the message going through the onError sequence and the message 
going through the main sequence are different .This is happen , because we 
always clone the  message before send it to an external endpoint . Therefore , 
the mediators with in the onError sequence process the cloned message and the 
message mediation through this sequence will not effect the message mediation 
through the main sequence. With in the onError sequence , sets the cloned 
message as a response and send it back to the client. Any property that are set 
to the cloned message will not effect to original message and so cloned message 
will behave as response message after ( <syn:property name="RESPONSE" 
value="true"/>)  but original message will not see this and it never go through 
out mediator , therefore second time sending will not occurred. This is the 
expected behavior . By properly writing configuration this will eliminates . 
please use drop mediator after the send mediator of the in mediator  and then  
it will works for both scenario .

<in>...
  <send>
       <endpoint>
            <loadbalance>............</loadbalance>
      </endpoint>
   </send>
   <drop/>
</in>






> "Transfer-encoding header already present" error occurred when trying out a 
> scenario with load balancing
> --------------------------------------------------------------------------------------------------------
>
>                 Key: ESBJAVA-370
>                 URL: http://wso2.org/jira/browse/ESBJAVA-370
>             Project: WSO2 ESB
>          Issue Type: Bug
>          Components: Endpoints Management
>    Affects Versions: 1.5-beta-1
>         Environment: Ubuntu7.04, JDK1.5.0_12, Firefox 2.0.0.9
>            Reporter: Evanthika Amarasiri
>         Assigned To: indika kumara
>             Fix For: NIGHTLY
>
>
> Below are the steps to reproduce the issue
> 1. Created the configuration as follows
>     <syn:sequence name="loadbalance_sample" onError="fault">
>         <syn:in>
>             <syn:send>
>                 <syn:endpoint>
>                     <syn:session type="simpleClientSession"/>
>                     <syn:loadbalance algorithm="roundRobin">
>                         <syn:endpoint>
>                             <syn:failover>
>                                 <syn:endpoint>
>                                     <syn:address 
> uri="http://localhost:9000/soap/LBService1";>
>                                         <syn:enableAddressing/>
>                                     </syn:address>
>                                 </syn:endpoint>
>                                 <syn:endpoint>
>                                     <syn:address 
> uri="http://localhost:9002/soap/LBService1";>
>                                         <syn:enableAddressing/>
>                                     </syn:address>
>                                 </syn:endpoint>
>                             </syn:failover>
>                         </syn:endpoint>
>                         <syn:endpoint>
>                             <syn:failover>
>                                 <syn:endpoint>
>                                     <syn:address 
> uri="http://localhost:9003/soap/LBService1";>
>                                         <syn:enableAddressing/>
>                                     </syn:address>
>                                 </syn:endpoint>
>                                 <syn:endpoint>
>                                     <syn:address 
> uri="http://localhost:9004/soap/LBService1";>
>                                         <syn:enableAddressing/>
>                                     </syn:address>
>                                 </syn:endpoint>
>                             </syn:failover>
>                         </syn:endpoint>
>                     </syn:loadbalance>
>                 </syn:endpoint>
>             </syn:send>
>         </syn:in>
>         <syn:out>
>             <syn:send/>
>         </syn:out>
>     </syn:sequence>
>     <syn:sequence name="fault">
>         <syn:makefault version="soap12">
>             <syn:code xmlns:sf12="http://www.w3.org/2003/05/soap-envelope"; 
> value="sf12:Receiver"/>
>             <syn:reason value="COULDN'T SEND THE MESSAGE TO THE SERVER."/>
>         </syn:makefault>
>         <syn:header name="To" action="remove"/>
>         <syn:property name="RESPONSE" value="true"/>
>         <syn:send/>
>     </syn:sequence>
> NOTE: Assume that all the servers are up and running and send a loadbalance 
> request and see that the responses are received properly
> 2. Now one by one shut down the servers until the client fails to execute and 
> you get the error message "COULDN'T SEND THE MESSAGE TO THE SERVER."
> 3. Then start all the servers one by one and wait for a while before sending 
> the request once more.
> 4. Once you send the requests the client will fail and you will get the 
> following error message on the ESB console
> 2007-11-26 11:21:52,146 [127.0.1.1-testc-ubuntu] [HttpServerWorker-19] ERROR 
> ServerHandler Unexpected HTTP protocol error : Transfer-encoding header 
> already present
> org.apache.http.ProtocolException: Transfer-encoding header already present
>         at 
> org.apache.http.protocol.ResponseContent.process(ResponseContent.java:67)
>         at 
> org.apache.http.protocol.BasicHttpProcessor.process(BasicHttpProcessor.java:304)
>         at 
> org.apache.synapse.transport.nhttp.ServerHandler.commitResponse(ServerHandler.java:220)
>         at 
> org.apache.synapse.transport.nhttp.HttpCoreNIOSender.sendAsyncResponse(HttpCoreNIOSender.java:360)
>         at 
> org.apache.synapse.transport.nhttp.HttpCoreNIOSender.invoke(HttpCoreNIOSender.java:225)
>         at org.apache.axis2.engine.AxisEngine.send(AxisEngine.java:396)
>         at 
> org.apache.synapse.core.axis2.Axis2Sender.sendBack(Axis2Sender.java:104)
>         at 
> org.apache.synapse.core.axis2.Axis2SynapseEnvironment.send(Axis2SynapseEnvironment.java:197)
>         at 
> org.apache.synapse.mediators.builtin.SendMediator.mediate(SendMediator.java:97)
>         at 
> org.apache.synapse.mediators.AbstractListMediator.mediate(AbstractListMediator.java:60)
>         at 
> org.apache.synapse.mediators.base.SequenceMediator.mediate(SequenceMediator.java:122)
>         at 
> org.apache.synapse.mediators.MediatorFaultHandler.onFault(MediatorFaultHandler.java:79)
>         at org.apache.synapse.FaultHandler.handleFault(FaultHandler.java:94)
>         at org.apache.synapse.FaultHandler.handleFault(FaultHandler.java:100)
>         at 
> org.apache.synapse.core.axis2.SynapseMessageReceiver.receive(SynapseMessageReceiver.java:95)
>         at org.apache.axis2.engine.AxisEngine.receive(AxisEngine.java:145)
>         at 
> org.apache.axis2.transport.http.HTTPTransportUtils.processHTTPPostRequest(HTTPTransportUtils.java:275)
>         at 
> org.apache.synapse.transport.nhttp.ServerWorker.processPost(ServerWorker.java:219)
>         at 
> org.apache.synapse.transport.nhttp.ServerWorker.run(ServerWorker.java:183)
>         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)
> 2007-11-26 11:21:52,190 [127.0.1.1-testc-ubuntu] [HttpServerWorker-19] ERROR 
> HttpCoreNIOSender IO Error sending response message
> org.apache.axis2.AxisFault
>         at org.apache.axis2.AxisFault.makeFault(AxisFault.java:417)
>         at 
> org.apache.axis2.transport.http.SOAPMessageFormatter.writeTo(SOAPMessageFormatter.java:72)
>         at 
> org.apache.synapse.transport.nhttp.HttpCoreNIOSender.sendAsyncResponse(HttpCoreNIOSender.java:370)
>         at 
> org.apache.synapse.transport.nhttp.HttpCoreNIOSender.invoke(HttpCoreNIOSender.java:225)
>         at org.apache.axis2.engine.AxisEngine.send(AxisEngine.java:396)
>         at 
> org.apache.synapse.core.axis2.Axis2Sender.sendBack(Axis2Sender.java:104)
>         at 
> org.apache.synapse.core.axis2.Axis2SynapseEnvironment.send(Axis2SynapseEnvironment.java:197)
>         at 
> org.apache.synapse.mediators.builtin.SendMediator.mediate(SendMediator.java:97)
>         at 
> org.apache.synapse.mediators.AbstractListMediator.mediate(AbstractListMediator.java:60)
>         at 
> org.apache.synapse.mediators.base.SequenceMediator.mediate(SequenceMediator.java:122)
>         at 
> org.apache.synapse.mediators.MediatorFaultHandler.onFault(MediatorFaultHandler.java:79)
>         at org.apache.synapse.FaultHandler.handleFault(FaultHandler.java:94)
>         at org.apache.synapse.FaultHandler.handleFault(FaultHandler.java:100)
>         at 
> org.apache.synapse.core.axis2.SynapseMessageReceiver.receive(SynapseMessageReceiver.java:95)
>         at org.apache.axis2.engine.AxisEngine.receive(AxisEngine.java:145)
>         at 
> org.apache.axis2.transport.http.HTTPTransportUtils.processHTTPPostRequest(HTTPTransportUtils.java:275)
>         at 
> org.apache.synapse.transport.nhttp.ServerWorker.processPost(ServerWorker.java:219)
>         at 
> org.apache.synapse.transport.nhttp.ServerWorker.run(ServerWorker.java:183)
>         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: com.ctc.wstx.exc.WstxIOException: null
>         at com.ctc.wstx.sw.BaseStreamWriter.flush(BaseStreamWriter.java:313)
>         at 
> org.apache.axiom.om.impl.MTOMXMLStreamWriter.flush(MTOMXMLStreamWriter.java:118)
>         at 
> org.apache.axiom.om.impl.llom.OMNodeImpl.serialize(OMNodeImpl.java:401)
>         at 
> org.apache.axis2.transport.http.SOAPMessageFormatter.writeTo(SOAPMessageFormatter.java:66)
>         ... 19 more
> Caused by: java.nio.channels.ClosedChannelException
>         at sun.nio.ch.SinkChannelImpl.ensureOpen(SinkChannelImpl.java:136)
>         at sun.nio.ch.SinkChannelImpl.write(SinkChannelImpl.java:140)
>         at java.nio.channels.Channels.write(Channels.java:60)
>         at java.nio.channels.Channels.access$000(Channels.java:47)
>         at java.nio.channels.Channels$1.write(Channels.java:134)
>         at com.ctc.wstx.io.UTF8Writer.flush(UTF8Writer.java:96)
>         at 
> com.ctc.wstx.sw.BufferingXmlWriter.flush(BufferingXmlWriter.java:214)
>         at com.ctc.wstx.sw.BaseStreamWriter.flush(BaseStreamWriter.java:311)
>         ... 22 more
> 2007-11-26 11:21:52,348 [127.0.1.1-testc-ubuntu] [HttpServerWorker-19] ERROR 
> Axis2Sender Unexpected error sending message back
> org.apache.axis2.AxisFault: IO Error sending response message
>         at 
> org.apache.synapse.transport.nhttp.HttpCoreNIOSender.handleException(HttpCoreNIOSender.java:478)
>         at 
> org.apache.synapse.transport.nhttp.HttpCoreNIOSender.sendAsyncResponse(HttpCoreNIOSender.java:374)
>         at 
> org.apache.synapse.transport.nhttp.HttpCoreNIOSender.invoke(HttpCoreNIOSender.java:225)
>         at org.apache.axis2.engine.AxisEngine.send(AxisEngine.java:396)
>         at 
> org.apache.synapse.core.axis2.Axis2Sender.sendBack(Axis2Sender.java:104)
>         at 
> org.apache.synapse.core.axis2.Axis2SynapseEnvironment.send(Axis2SynapseEnvironment.java:197)
>         at 
> org.apache.synapse.mediators.builtin.SendMediator.mediate(SendMediator.java:97)
>         at 
> org.apache.synapse.mediators.AbstractListMediator.mediate(AbstractListMediator.java:60)
>         at 
> org.apache.synapse.mediators.base.SequenceMediator.mediate(SequenceMediator.java:122)
>         at 
> org.apache.synapse.mediators.MediatorFaultHandler.onFault(MediatorFaultHandler.java:79)
>         at org.apache.synapse.FaultHandler.handleFault(FaultHandler.java:94)
>         at org.apache.synapse.FaultHandler.handleFault(FaultHandler.java:100)
>         at 
> org.apache.synapse.core.axis2.SynapseMessageReceiver.receive(SynapseMessageReceiver.java:95)
>         at org.apache.axis2.engine.AxisEngine.receive(AxisEngine.java:145)
>         at 
> org.apache.axis2.transport.http.HTTPTransportUtils.processHTTPPostRequest(HTTPTransportUtils.java:275)
>         at 
> org.apache.synapse.transport.nhttp.ServerWorker.processPost(ServerWorker.java:219)
>         at 
> org.apache.synapse.transport.nhttp.ServerWorker.run(ServerWorker.java:183)
>         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
>         at org.apache.axis2.AxisFault.makeFault(AxisFault.java:417)
>         at 
> org.apache.axis2.transport.http.SOAPMessageFormatter.writeTo(SOAPMessageFormatter.java:72)
>         at 
> org.apache.synapse.transport.nhttp.HttpCoreNIOSender.sendAsyncResponse(HttpCoreNIOSender.java:370)
>         ... 18 more
> Caused by: com.ctc.wstx.exc.WstxIOException: null
>         at com.ctc.wstx.sw.BaseStreamWriter.flush(BaseStreamWriter.java:313)
>         at 
> org.apache.axiom.om.impl.MTOMXMLStreamWriter.flush(MTOMXMLStreamWriter.java:118)
>         at 
> org.apache.axiom.om.impl.llom.OMNodeImpl.serialize(OMNodeImpl.java:401)
>         at 
> org.apache.axis2.transport.http.SOAPMessageFormatter.writeTo(SOAPMessageFormatter.java:66)
>         ... 19 more
> Caused by: java.nio.channels.ClosedChannelException
>         at sun.nio.ch.SinkChannelImpl.ensureOpen(SinkChannelImpl.java:136)
>         at sun.nio.ch.SinkChannelImpl.write(SinkChannelImpl.java:140)
>         at java.nio.channels.Channels.write(Channels.java:60)
>         at java.nio.channels.Channels.access$000(Channels.java:47)
>         at java.nio.channels.Channels$1.write(Channels.java:134)
>         at com.ctc.wstx.io.UTF8Writer.flush(UTF8Writer.java:96)
>         at 
> com.ctc.wstx.sw.BufferingXmlWriter.flush(BufferingXmlWriter.java:214)
>         at com.ctc.wstx.sw.BaseStreamWriter.flush(BaseStreamWriter.java:311)
>         ... 22 more

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: 
http://wso2.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira



_______________________________________________
Esb-java-dev mailing list
[email protected]
http://wso2.org/cgi-bin/mailman/listinfo/esb-java-dev

Reply via email to