[mule-user] Problems with large responses when using Mule as a proxy (buffer problems?)

42 views
Skip to first unread message

Häggkvist, Lennart

unread,
Jan 7, 2009, 11:24:24 AM1/7/09
to us...@mule.codehaus.org
Hi,
 
I am using Mule as a proxy with the following configuration:
 
  <model name="proxies">
    <service name="productCatalog">
      <inbound>
        <cxf:inbound-endpoint address="http://localhost:9090/services/ProductCatalog" proxy="true" remoteSync="true" />
      </inbound>
      <outbound>
        <pass-through-router>
          <cxf:outbound-endpoint address="http://localhost:8080/products/ws/ProductCatalog" proxy="true" remoteSync="true" />
        </pass-through-router>
      </outbound>
    </service>
  </model>
 
When I do a request that generates a response larger than 4028 characters Mule (2.1.2) throws the following exception:
 
2009-jan-07 16:38:20 org.apache.cxf.phase.PhaseInterceptorChain doIntercept
INFO: Interceptor has thrown exception, unwinding now
org.apache.cxf.interceptor.Fault: COULD_NOT_READ_XML_STREAM
        at org.apache.cxf.databinding.stax.StaxDataBinding$XMLStreamDataWriter.write(StaxDataBinding.java:131)
        at org.apache.cxf.databinding.stax.StaxDataBinding$XMLStreamDataWriter.write(StaxDataBinding.java:117)
        at org.apache.cxf.databinding.stax.StaxDataBinding$XMLStreamDataWriter.write(StaxDataBinding.java:113)
        at org.apache.cxf.interceptor.AbstractOutDatabindingInterceptor.writeParts(AbstractOutDatabindingInterceptor.java:113)
        at org.apache.cxf.interceptor.BareOutInterceptor.handleMessage(BareOutInterceptor.java:68)
        at org.apache.cxf.phase.PhaseInterceptorChain.doIntercept(PhaseInterceptorChain.java:220)
        at org.apache.cxf.phase.PhaseInterceptorChain.resume(PhaseInterceptorChain.java:198)
        at org.mule.transport.cxf.CxfServiceComponent$1.write(CxfServiceComponent.java:270)
        at org.mule.transport.http.HttpServerConnection.writeResponse(HttpServerConnection.java:294)
        at org.mule.transport.http.HttpMessageReceiver$HttpWorker.run(HttpMessageReceiver.java:190)
        at org.mule.work.WorkerContext.run(WorkerContext.java:310)
        at edu.emory.mathcs.backport.java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1061)
        at edu.emory.mathcs.backport.java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:575)
        at java.lang.Thread.run(Unknown Source)
Caused by: com.ctc.wstx.exc.WstxIOException: Attempted read on closed stream.
        at com.ctc.wstx.sr.StreamScanner.throwFromIOE(StreamScanner.java:708)
        at com.ctc.wstx.sr.BasicStreamReader.next(BasicStreamReader.java:1086)
        at org.apache.cxf.staxutils.DepthXMLStreamReader.next(DepthXMLStreamReader.java:220)
        at org.apache.cxf.staxutils.StaxUtils.copy(StaxUtils.java:352)
        at org.apache.cxf.staxutils.StaxUtils.copy(StaxUtils.java:314)
        at org.mule.transport.cxf.support.OutputPayloadInterceptor$1.write(OutputPayloadInterceptor.java:66)
        at org.apache.cxf.databinding.stax.StaxDataBinding$XMLStreamDataWriter.write(StaxDataBinding.java:125)
        ... 13 more
Caused by: java.io.IOException: Attempted read on closed stream.
        at org.apache.commons.httpclient.AutoCloseInputStream.isReadAllowed(AutoCloseInputStream.java:183)
        at org.apache.commons.httpclient.AutoCloseInputStream.read(AutoCloseInputStream.java:126)
        at org.mule.model.streaming.DelegatingInputStream.read(DelegatingInputStream.java:58)
        at com.ctc.wstx.io.UTF8Reader.loadMore(UTF8Reader.java:365)
        at com.ctc.wstx.io.UTF8Reader.read(UTF8Reader.java:110)
        at com.ctc.wstx.io.MergedReader.read(MergedReader.java:101)
        at com.ctc.wstx.io.ReaderSource.readInto(ReaderSource.java:84)
        at com.ctc.wstx.io.BranchingReaderSource.readInto(BranchingReaderSource.java:57)
        at com.ctc.wstx.sr.StreamScanner.loadMoreFromCurrent(StreamScanner.java:1046)
        at com.ctc.wstx.sr.StreamScanner.loadMoreFromCurrent(StreamScanner.java:1053)
        at com.ctc.wstx.sr.StreamScanner.getNextCharFromCurrent(StreamScanner.java:811)
        at com.ctc.wstx.sr.BasicStreamReader.readEndElem(BasicStreamReader.java:3209)
        at com.ctc.wstx.sr.BasicStreamReader.nextFromTree(BasicStreamReader.java:2830)
        at com.ctc.wstx.sr.BasicStreamReader.next(BasicStreamReader.java:1019)
        ... 18 more
 
According to SoapUI the only that comes back from the server is:
        HTTP/1.1 200 OK
        Transfer-Encoding: chunked
        Date: Wed, 07 Jan 2009 04:54:02 CET
        Expires: Wed, 07 Jan 2009 04:54:02 CET
        Connection: close
        Content-Type: text/xml
        Server: Mule Core/2.1.2
 
I have created an web service using CXF that I can use to reproduce the error. The source to it is attached. The mule config file is also include in the file.
 
The web service contains only one method - getProducts(int nrOfProducts, int descriptionLength).
Using the both parameters I can decide the size of the reponse.
 
When I request 1 product with the descriptionLength = 3742 I get a response.
 
If I increase the descriptionLength with one, that is, to 3743 I always get the above error. SoapUI reports 4028 bytes when successful, 0 bytes when the exception is thrown.
 
Could this be some form of buffer problem?
If I enable debug logging I can see that the class httpclient.wire.content logs the entire response from the service, so the service is working.
 
This is a critical bug for us, so any help is appreciated.
 
Thanks in advance,
  Lennart
 
Info about my config:
**********************************************************************
* Mule ESB and Integration Platform                                  *
* Version: 2.1.2 Build: 13558                                        *
* MuleSource, Inc.                                                   *
* For more information go to http://mule.mulesource.org              *
*                                                                    *
* Server started: 2009-01-07 16:37                                   *
* Server ID: 161c9416-dcd1-11dd-b480-553a4317a710                    *
* JDK: 1.6.0_07 (mixed mode)                                         *
* Encoding: OS: Cp1252, Mule: UTF-8                                  *
* OS: Windows Vista - Service Pack 1 (6.0, x86)                      *
* Host: stopc6442 (192.168.3.54)                                     *
*                                                                    *
* Agents Running: None                                               *
**********************************************************************
 
 
products.zip

Häggkvist, Lennart

unread,
Jan 8, 2009, 4:20:12 AM1/8/09
to us...@mule.codehaus.org
Hi again,
 
I did some testing on the snapshot version of 2.1.3 and 2.2 - same problem.
 
Have any of you used Mule in this way and successfully transmitted large payloads?
 
Could this be a CXF bug? Should I ask in the CXF mailing list as well?
 
Thanks,
 Lennart


Från: Häggkvist, Lennart [mailto:Lennart....@ppm.nu]
Skickat: den 7 januari 2009 17:24
Till: us...@mule.codehaus.org
Ämne: [mule-user] Problems with large responses when using Mule as a proxy (buffer problems?)

Häggkvist, Lennart

unread,
Jan 12, 2009, 6:45:58 AM1/12/09
to us...@mule.codehaus.org
Hello!
 
I have created a bug report (http://mule.mulesource.org/jira/browse/CXF-8) containing more information and a test case. I have also simplified the configuration to use the Mule Echo component:
 
<model name="proxies">

    <service name="echoProxy">
      <inbound>
        <cxf:inbound-endpoint address="http://localhost:63082/services/EchoProxy" proxy="true" />
      </inbound>
      <outbound>
        <pass-through-router>
          <cxf:outbound-endpoint address="http://localhost:63081/services/Echo" proxy="true" />
        </pass-through-router>
      </outbound>
    </service>

    <service name="echoService">
      <inbound>
        <cxf:inbound-endpoint
          address="http://localhost:63081/services/Echo" frontend="simple"/>
      </inbound>
      <component class="org.mule.component.simple.EchoComponent" />
    </service>

  </model>
Could anyone please try to reproduce the error with a large amount of data, ie >5Kb?
 
Thanks,
 Lennart


Från: Häggkvist, Lennart [mailto:Lennart....@ppm.nu]
Skickat: den 8 januari 2009 10:20
Till: us...@mule.codehaus.org
Ämne: [mule-user] SV: Problems with large responses when using Mule as a proxy (buffer problems?)

Antoine Borg

unread,
Jan 21, 2009, 2:36:42 AM1/21/09
to us...@mule.codehaus.org
Hi,
 
This is an unusual report since the grid at the bottom of this page: http://mule.mulesource.org/display/MULE2USER/Available+Transports clearly shows that both CXF and HTTP are streaming transports and so I would have expected larger payloads to be streamed. Having said that, I cannot see any attributes in either CXF or HTTP that can switch streaming on or off; my assumption is that streaming is always there but perhaps there's a property in one (or both) of these connectors that is not visible.  Correction: I've just seen your logs again and it's rather clear that the data is being streamed.
 
Quick question: How are you invoking the web service? Is it possible that whatever is sending the data closes the connection before the stream is passed on/read by Mule?
 
HTH

A
 
 
 
Antoine Borg, Senior Consultant | Tel: +32 28 504 696 
ricston Ltd., BP 2, 1180 Uccle, Brussels, BELGIUM
email: antoine.borg@ricston.com | blog: blog.ricston.com | web: ricston.com 
 


From: Häggkvist, Lennart [mailto:Lennart....@ppm.nu]
Sent: Thursday, January 08, 2009 10:20 AM
To: us...@mule.codehaus.org
Subject: [mule-user] SV: Problems with large responses when using Mule as a proxy (buffer problems?)

Reply all
Reply to author
Forward
0 new messages