0

I am getting out of memory exeception with the JMS. I am using wildfly server and in standalone-full.xml of this server I am configuring the JMS queues. I am running one servlet application on wildfly server and from front end I am uploading one xml file. This is input xml file once received in servlet controller I am converting it to xmlString (string) and sending this string to destination queue. Once this string message appears on queue it will be listened by one JMS listener which I have configured (having onMessage method).

From this listener's onMessage method I am calling one function from my code with this xmlString as parameter. In that called function I am further reading xml content in my application code and performing few calculations as per applilcation requirement. Finally I am generating few xml files (26 xml files) after calculation is done. Then I am zipping these files in one zipped folder and I am converting this zipped file into byte array and sending this byte array content as byteMessage back to client end. And there I am again converting back the byteMessage to byte array then byteArray to zip file and again I am extracting this zip file on client's system.

So below is the basic flow sequence of my application:

created 26 XML Files in one folder during application calculations ->covert to Zip (Cpmpression) at server-> Convert zip to ByteArray -> convert byteArray to ByteMessage -> Send ByteMessage Over Queue ->

Receive ByteMessage -> Convert ByteMessage to Zip -> Decompress the zip file to have output files at client

When I run this servlet the above flow I am able to run 2 times successfully. But when I execute it for 3rd time I get below exception on wildfly server console:

Message Reference[70866969224]:NON-             

RELIABLE:LargeServerMessage[messageID=70866969224,priority=4,expiration=[null], durable=false, address=jms.queue.MDBQueueRequest,properties=Typ
 edProperties[_HQ_LARGE_SIZE=81007,__HQ_CID=5187e412-e1f7-11e5-8c47-db91fee4705c,_HQ_LARGE_COMPRESSED=true]]@2036392775

has reached maximum delivery attempts, sending it to Dead Letter Address jms.queue.DLQ from jms.queue.MDBQueueRequest

java.lang.OutOfMemoryError: GC overhead limit exceeded
Jaywant Khedkar
  • 4,939
  • 2
  • 35
  • 49
  • That could be a memory leak. I suggest you do a heap dump on out of memory error and see where the memory is being retained. – Peter Lawrey Mar 11 '16 at 12:41
  • Thanks a lot Peter for the quick response . Could you please suggest how should I proceed to do heap dump and how can I drill down more into this issue? – Ajitkumar Patil Mar 11 '16 at 12:50
  • You enable http://stackoverflow.com/questions/542979/using-heapdumponoutofmemoryerror-parameter-for-heap-dump-for-jboss and then load the heap dump in a profiler like VisualVM to see where most of the memory is being retained and why. – Peter Lawrey Mar 11 '16 at 13:16
  • 1
    Thanks peter. I have updated JAVA_OPTS property in my standalone.conf file for wildfly server as below: JAVA_OPTS="--Xms1024m -Xmx2048m -XX:MaxPermSize=2048m XX:+HeapDumpOnOutOfMemoryError -XX:HeapDumpPath= C:\HeapDump\heapdump.txt -Djava.net.preferIPv4Stack=true" hope it will create the heap dump when I will come across out of memory error. I am checking the same now. Will let you know in case of any issue. – Ajitkumar Patil Mar 11 '16 at 13:34
  • I assume you mean `-Xmx1024m` instead of `--Xmx1024m` – Peter Lawrey Mar 11 '16 at 14:24
  • I would try reducing the max perm size and increasing the heap. 2 GB of Perm Gen sounds like a lot. – Peter Lawrey Mar 11 '16 at 14:24
  • I had increased that size to -Xmx2048m, so shall I keep it to -Xmx1024m only? Kindly advise. – Ajitkumar Patil Mar 14 '16 at 05:07
  • The max heap is `-Xmx` and that I would increase as 2 GB isn't much, the perm gen is `-XX:MaxPermSize=` and that I would reduce unless you have an insane amount of code. – Peter Lawrey Mar 14 '16 at 07:03
  • @Peter I have updated these fields accordingly and ran my servlet. Now its executing for 4 times but when I try to execute it for 5th time it gives below exception: Caused by: org.postgresql.util.PSQLException: FATAL: sorry, too many clients already at org.postgresql.core.v3.ConnectionFactoryImpl.doAuthentication(ConnectionFactoryImpl.java:408) at org.postgresql.core.v3.ConnectionFactoryImpl.openConnectionImpl(ConnectionFactoryImpl.java:181) at org.postgresql.core.ConnectionFactory.openConnection(ConnectionFactory.java:64) ... 98 more – Ajitkumar Patil Mar 14 '16 at 10:54
  • We are using the postgresql 9.2 database for our application. I checked with max_connection_size paramter under postgres.conf file. Its default one only i.e.100. But changing it another value wont be good solution. Also after receiving this error I ran below query on postgres admin : select * from pg_stat_activity where (state = 'idle in transaction') and xact_start is not null; SHOW config_file; and it showed me 59 queries in 'idle in transaction' state. – Ajitkumar Patil Mar 14 '16 at 11:01

0 Answers0