Mule2 and JMS client: Out Of Memory

View: New views
4 Messages — Rating Filter:   Alert me  

Mule2 and JMS client: Out Of Memory

by NabiL :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hi,

I use mule 2.2.1 running on host1 & activemq 5.2 running on host2. My mule conf is below.

Scenario : File -> JMS -> FTP

All works fine, except when i put a big file (~14 MB) i got errors indicating "java out of memory".

<service name="Send_Files" >
                    <inbound>
                    <inbound-endpoint ref="ComingFiles"  />
                    </inbound>
            <outbound>
              <pass-through-router>
                      <jms:outbound-endpoint connector-ref="activeMqConnector" topic="test" transformer-refs="jms_stream"/>  
                </pass-through-router>
          </outbound>            
  </service>            
             
          <service name="ToFTP" >
                  <inbound>
          <jms:inbound-endpoint connector-ref="activeMqXaConnector"  topic="test"  synchronous="true">
   <xa-transaction action="ALWAYS_BEGIN"  timeout="30000"/>
                                                  <properties>
                                                    <spring:entry key="pollingFrequency" value="1000"/>
                                                  </properties>
                                        </jms:inbound-endpoint>
            </inbound>
             <outbound>
              <chaining-router>
                          <outbound-endpoint ref="SendingToPartner" >
                    <xa-transaction action="ALWAYS_JOIN"  timeout="10000"/>
                    </outbound-endpoint>
     
                </chaining-router>
             </outbound>
       
          </service>    


Mule log:

INFO  2009-06-23 20:05:22,750 [activeMqXaConnector.receiver.1] com.arjuna.ats.arjuna.logging.arjLoggerI18N: [com.arjuna.ats.arjuna.recovery.TransactionStatusManager_1] - Starting service com.arjuna.ats.arjuna.recovery.ActionStatusService on port 11458
INFO  2009-06-23 20:05:22,750 [activeMqXaConnector.receiver.1] com.arjuna.ats.arjuna.logging.arjLogger: TransactionStatusManagerItem - host: 10.97.247.219 port: 11458
INFO  2009-06-23 20:05:22,796 [activeMqXaConnector.receiver.1] com.arjuna.ats.arjuna.logging.arjLoggerI18N: [com.arjuna.ats.arjuna.recovery.TransactionStatusManager_3] - TransactionStatusManager started on port 11458 with service com.arjuna.ats.arjuna.recovery.ActionStatusService
INFO  2009-06-23 20:05:40,453 [Myfile.receiver.1] org.mule.transport.file.FileMessageReceiver: Lock obtained on file: C:\temp\files\MySQL_Sanae.pdf
INFO  2009-06-23 20:05:41,281 [activeMqConnector.dispatcher.1] org.mule.transport.jms.JmsMessageDispatcher: Connected: endpoint.outbound.jms://topic:test
INFO  2009-06-23 20:05:42,750 [activeMqXaConnector.receiver.1] org.mule.transport.ftp.FtpMessageDispatcher: Connected: endpoint.outbound.ftp://userftp:lydecftp@localhost:21
INFO  2009-06-23 20:05:58,453 [Myfile.receiver.1] org.mule.transport.file.FileMessageReceiver: Lock obtained on file: C:\temp\files\ESS_final.mdb
ERROR 2009-06-23 20:06:03,265 [Myfile.receiver.1] org.mule.DefaultExceptionStrategy:
********************************************************************************
Message               : Failed to create "Message Adapter" with "org.mule.transport.file.FileContentsMessageAdapter"
Type                  : org.mule.transport.service.TransportServiceException
Code                  : MULE_ERROR-73
JavaDoc               : http://www.mulesource.org/docs/site/current2/apidocs/org/mule/transport/service/TransportServiceException.html
********************************************************************************
Exception stack is:
1. Java heap space (java.lang.OutOfMemoryError)
  org.apache.commons.io.output.ByteArrayOutputStream:237 (null)
2. Failed to create "Message Adapter" with "org.mule.transport.file.FileContentsMessageAdapter" (org.mule.transport.service.TransportServiceException)
  org.mule.transport.service.DefaultTransportServiceDescriptor:157 (http://www.mulesource.org/docs/site/current2/apidocs/org/mule/transport/service/TransportServiceException.html)
********************************************************************************
Root Exception stack trace:
java.lang.OutOfMemoryError: Java heap space
        at org.apache.commons.io.output.ByteArrayOutputStream.toByteArray(ByteArrayOutputStream.java:237)
        at org.apache.commons.io.IOUtils.toByteArray(IOUtils.java:219)
        at org.mule.util.IOUtils.toByteArray(IOUtils.java:276)
        at org.mule.transport.file.FileContentsMessageAdapter.getPayload(FileContentsMessageAdapter.java:61)
        at org.mule.transport.file.FileContentsMessageAdapter.<init>(FileContentsMessageAdapter.java:39)
        at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
        at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:39)
        at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:27)
        at java.lang.reflect.Constructor.newInstance(Constructor.java:513)
        at org.mule.util.ClassUtils.instanciateClass(ClassUtils.java:376)
        at org.mule.util.ClassUtils.instanciateClass(ClassUtils.java:411)
        at org.mule.transport.service.DefaultTransportServiceDescriptor.createMessageAdapter(DefaultTransportServiceDescriptor.java:153)
        at org.mule.transport.service.DefaultTransportServiceDescriptor.createMessageAdapter(DefaultTransportServiceDescriptor.java:139)
        at org.mule.transport.AbstractConnector.getMessageAdapter(AbstractConnector.java:2206)
        at org.mule.transport.file.FileConnector.getMessageAdapter(FileConnector.java:610)
        at org.mule.transport.file.FileMessageReceiver.moveAndDelete(FileMessageReceiver.java:274)
        at org.mule.transport.file.FileMessageReceiver.processFile(FileMessageReceiver.java:238)
        at org.mule.transport.file.FileMessageReceiver.poll(FileMessageReceiver.java:144)
        at org.mule.transport.PollingReceiverWorker.run(PollingReceiverWorker.java:47)
        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(Thread.java:619)


Any help wil appreciated.
Thanks in advance

Re: Mule2 and JMS client: Out Of Memory

by Andrew Perepelytsya :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

JMS must read full file contents in memory, there's no streaming in specification. Increase java heap size for your run.

HTH,
Andrew

Re: Mule2 and JMS client: Out Of Memory

by NabiL :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hi Andrew,

Thanks for your response.
I use jms in order to apply xa-transaction between file and ftp
Increase java heap size, Do you think is a good approach ?

Andrew Perepelytsya wrote:
JMS must read full file contents in memory, there's no streaming in
specification. Increase java heap size for your run.

HTH,
Andrew

Re: Mule2 and JMS client: Out Of Memory

by antoine.borg :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

If you're using JMS purely for the transactionality, why not use VM instead?

A

NabiL wrote:

> Hi Andrew,
>
> Thanks for your response.
> I use jms in order to apply xa-transaction between file and ftp
> Increase java heap size, Do you think is a good approach ?
>
>
> Andrew Perepelytsya wrote:
>  
>> JMS must read full file contents in memory, there's no streaming in
>> specification. Increase java heap size for your run.
>>
>> HTH,
>> Andrew
>>
>>
>>    
>
>  
--

Antoine Borg, Senior Consultant | Tel: +32 28 504 696
ricston Ltd., BP 2, 1180 Uccle, Brussels, BELGIUM

See our full schedule of Mule and Android courses:
http://www.ricston.com/courses/schedules/

email: _antoine.borg_@... <mailto:antoine.borg@...> |
blog: blog.ricston.com <http://blog.ricston.com> | web: ricston.com
<http://www.ricston.com/>



---------------------------------------------------------------------
To unsubscribe from this list, please visit:

    http://xircles.codehaus.org/manage_email