You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@cxf.apache.org by "yogesh_d1@yahoo.com" <yo...@yahoo.com> on 2014/01/09 07:11:20 UTC

Re: MTOM OutOfMemory

List -I am facing a similar problem and have made a post for this. Looking at
this I would like to know if any of the users here were able to establish
working MTOM with large attachments. I would hugely appreciate a working
sample  



--
View this message in context: http://cxf.547215.n5.nabble.com/MTOM-OutOfMemory-tp547525p5738407.html
Sent from the cxf-user mailing list archive at Nabble.com.

Re: MTOM OutOfMemory

Posted by Daniel Kulp <dk...@apache.org>.
On Jan 13, 2014, at 6:39 AM, yogesh_d1@yahoo.com wrote:

> Dan,
> You're right, it was the byte array that was becoming too big. 
> After I commented out the first send to server and the MTOM client code
> seems to send file, 
> as you said , now the OOM error has moved to server .
> 
> 
> However - I am still splitting my hair to see what wrongdoing I did in my
> applications client which still continues to give me OOM error due to heap
> space
> 
> Below isclient side stack trace from my client ( that uses https transport
> and a some more complex data structures) ... let me know if you notice
> anything untoward here 
> 
> Please note that this happens after I call the service method on my port
> object that uploads large object  "port.uploadObject(objReqParam);
> 
> 
> 
> Opened file:src/main/InfantHealthcare.jpg for read...( this is a BIG file) 
> Exception in thread "main" java.lang.OutOfMemoryError: Java heap space
>        at java.util.Arrays.copyOf(Arrays.java:2271)
>        at
> java.io.ByteArrayOutputStream.toByteArray(ByteArrayOutputStream.java:178)
>        at
> org.apache.cxf.helpers.IOUtils.readBytesFromStream(IOUtils.java:235)
>        at
> org.apache.cxf.io.CachedOutputStream.getBytes(CachedOutputStream.java:264)
>        at
> org.apache.cxf.transport.http.HTTPConduit$WrappedOutputStream.handleRetransmits(HTTPConduit.java:2015)


Looking in there:

if (LOG.isLoggable(Level.FINE) && cachedStream != null) {
                    LOG.fine("Conduit \""
                             + getConduitName() 
                             + "\" Transmit cached message to: " 
                             + url
                             + ": "
                             + new String(cachedStream.getBytes()));
                }


You wouldn’t by any chance of FINE logging turned on?  

It looks like you have auto redirects turned on or similar so that the entire request is cached PLUS you have FINE logging turned on.  Looks like the combination of the two is causing an issue.   Can you verify and log an issue?


-- 
Daniel Kulp
dkulp@apache.org - http://dankulp.com/blog
Talend Community Coder - http://coders.talend.com


Re: MTOM OutOfMemory

Posted by "yogesh_d1@yahoo.com" <yo...@yahoo.com>.
Dan,
You're right, it was the byte array that was becoming too big. 
After I commented out the first send to server and the MTOM client code
seems to send file, 
as you said , now the OOM error has moved to server .


However - I am still splitting my hair to see what wrongdoing I did in my
applications client which still continues to give me OOM error due to heap
space
 
Below isclient side stack trace from my client ( that uses https transport
and a some more complex data structures) ... let me know if you notice
anything untoward here 

Please note that this happens after I call the service method on my port
object that uploads large object  "port.uploadObject(objReqParam);



Opened file:src/main/InfantHealthcare.jpg for read...( this is a BIG file) 
Exception in thread "main" java.lang.OutOfMemoryError: Java heap space
        at java.util.Arrays.copyOf(Arrays.java:2271)
        at
java.io.ByteArrayOutputStream.toByteArray(ByteArrayOutputStream.java:178)
        at
org.apache.cxf.helpers.IOUtils.readBytesFromStream(IOUtils.java:235)
        at
org.apache.cxf.io.CachedOutputStream.getBytes(CachedOutputStream.java:264)
        at
org.apache.cxf.transport.http.HTTPConduit$WrappedOutputStream.handleRetransmits(HTTPConduit.java:2015)
        at
org.apache.cxf.transport.http.HTTPConduit$WrappedOutputStream.handleResponse(HTTPConduit.java:2066)
        at
org.apache.cxf.transport.http.HTTPConduit$WrappedOutputStream.close(HTTPConduit.java:1925)
        at
org.apache.cxf.transport.AbstractConduit.close(AbstractConduit.java:56)
        at
org.apache.cxf.transport.http.HTTPConduit.close(HTTPConduit.java:662)
        at
org.apache.cxf.interceptor.MessageSenderInterceptor$MessageSenderEndingInterceptor.handleMessage(MessageSenderInterceptor.java:62)
        at
org.apache.cxf.phase.PhaseInterceptorChain.doIntercept(PhaseInterceptorChain.java:247)
        at org.apache.cxf.endpoint.ClientImpl.invoke(ClientImpl.java:516)
        at org.apache.cxf.endpoint.ClientImpl.invoke(ClientImpl.java:313)
        at org.apache.cxf.endpoint.ClientImpl.invoke(ClientImpl.java:265)
        at
org.apache.cxf.frontend.ClientProxy.invokeSync(ClientProxy.java:73)
        at
org.apache.cxf.jaxws.JaxWsClientProxy.invoke(JaxWsClientProxy.java:124)
        at $Proxy36.uploadObject(Unknown Source)
        at
com.dell.dcca.webservice.objectstore.client.Client.main(Client.java:127)
 







--
View this message in context: http://cxf.547215.n5.nabble.com/MTOM-OutOfMemory-tp547525p5738495.html
Sent from the cxf-user mailing list archive at Nabble.com.

Re: MTOM OutOfMemory

Posted by Daniel Kulp <dk...@apache.org>.
On Jan 10, 2014, at 2:14 AM, Yogesh Devi <yo...@yahoo.com> wrote:

> Dan,
> Thanks for your reponse 
> 
> I am able to reproduce the same issue with the mtom sample that ships with CXF 
> 
> More specifically 
> 
> I used apache-cxf-2.7.7   samples/mtom
> 
> 
> All I did is , replace the "me.bmp" with a 1.23 GB file  and I get exactly same client side exception that I get in my code 

You would also need to update the Client.java to NOT do the first call to the server.   The first call loads the bmp into a byte[] and calls the port.testByteArray to show how that would get mapped into MTOM.   With a 1.3GB file, loading that into the byte[] likely is failing. 

If I do:
 dd if=/dev/zero of=src/main/resources/me.bmp bs=4096 count=204800

to create a 800MB file and comment out the code around first call to the service,  the client does transfer the file fine.   It OOM’s on the server as the server loads the attachment into a ByteArrayOutputStream, but all the data does get there.


Dan


> 
>  reproduced below from "mvn -Pclient" run of "samples/mtom"
> 
> -------------------------------------
> [INFO] ------------------------------------------------------------------------
> [ERROR] Failed to execute goal org.codehaus.mojo:exec-maven-plugin:1.2:java (def
> ault) on project mtom: An exception occured while executing the Java class. null
> : InvocationTargetException: Java heap space -> [Help 1]
> ----------------------------------------------------------
> 
> Note - ( I ack. that happen to use 2.7.7 which is a tad older , however I checked release
> notes for 2.7.8 and 3.X milestone release and found no reference to 
> MTOM fixes so for now I am still sticking to 2.7.7) 
> 
> 
> Best regards 
> 
> 
> Yogesh 
> 
> 
> 
> ________________________________
> From: Daniel Kulp <dk...@apache.org>
> To: users@cxf.apache.org; yogesh_d1@yahoo.com 
> Sent: Thursday, January 9, 2014 9:28 PM
> Subject: Re: MTOM OutOfMemory
> 
> 
> 
> On Jan 9, 2014, at 1:11 AM, yogesh_d1@yahoo.com wrote:
> 
>> List -I am facing a similar problem and have made a post for this. Looking at
>> this I would like to know if any of the users here were able to establish
>> working MTOM with large attachments. I would hugely appreciate a working
>> sample  
> 
> You could try modifying the mtom sample in the CXF kits to use a larger attachment.   The samples is fairly small since it’s going in the kit, but feel free to play with it and see if you can reproduce your issue.
> 
> 
> -- 
> Daniel Kulp
> dkulp@apache.org - http://dankulp.com/blog
> Talend Community Coder - http://coders.talend.com

-- 
Daniel Kulp
dkulp@apache.org - http://dankulp.com/blog
Talend Community Coder - http://coders.talend.com


Re: MTOM OutOfMemory

Posted by Yogesh Devi <yo...@yahoo.com>.
Dan,
Thanks for your reponse 

I am able to reproduce the same issue with the mtom sample that ships with CXF 

More specifically 

I used apache-cxf-2.7.7   samples/mtom


All I did is , replace the "me.bmp" with a 1.23 GB file  and I get exactly same client side exception that I get in my code 

 reproduced below from "mvn -Pclient" run of "samples/mtom"

-------------------------------------
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.codehaus.mojo:exec-maven-plugin:1.2:java (def
ault) on project mtom: An exception occured while executing the Java class. null
: InvocationTargetException: Java heap space -> [Help 1]
----------------------------------------------------------

Note - ( I ack. that happen to use 2.7.7 which is a tad older , however I checked release
 notes for 2.7.8 and 3.X milestone release and found no reference to 
MTOM fixes so for now I am still sticking to 2.7.7) 


Best regards 


Yogesh 



________________________________
 From: Daniel Kulp <dk...@apache.org>
To: users@cxf.apache.org; yogesh_d1@yahoo.com 
Sent: Thursday, January 9, 2014 9:28 PM
Subject: Re: MTOM OutOfMemory
 


On Jan 9, 2014, at 1:11 AM, yogesh_d1@yahoo.com wrote:

> List -I am facing a similar problem and have made a post for this. Looking at
> this I would like to know if any of the users here were able to establish
> working MTOM with large attachments. I would hugely appreciate a working
> sample  

You could try modifying the mtom sample in the CXF kits to use a larger attachment.   The samples is fairly small since it’s going in the kit, but feel free to play with it and see if you can reproduce your issue.


-- 
Daniel Kulp
dkulp@apache.org - http://dankulp.com/blog
Talend Community Coder - http://coders.talend.com

Re: MTOM OutOfMemory

Posted by Daniel Kulp <dk...@apache.org>.
On Jan 9, 2014, at 1:11 AM, yogesh_d1@yahoo.com wrote:

> List -I am facing a similar problem and have made a post for this. Looking at
> this I would like to know if any of the users here were able to establish
> working MTOM with large attachments. I would hugely appreciate a working
> sample  

You could try modifying the mtom sample in the CXF kits to use a larger attachment.   The samples is fairly small since it’s going in the kit, but feel free to play with it and see if you can reproduce your issue.


-- 
Daniel Kulp
dkulp@apache.org - http://dankulp.com/blog
Talend Community Coder - http://coders.talend.com