• Post Reply Bookmark Topic Watch Topic
  • New Topic

Server restarting - Out of Memory Exception

 
Karan Jain
Ranch Hand
Posts: 82
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

We are using Websphere 5.1 and after our recent production deployment, server is restarting every 3-4 hrs. I am able to see some OutOfMemory and stack overflow exception.

Is there a way I can find out what piece of code is causing the problem and any tips for not getting in this problem in the future...

Thanks in advance...

Karan
 
Joe Ess
Bartender
Posts: 9362
11
Linux Mac OS X Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
There are a lot of things that can cause out of memory errors. If you notice that a particular operation, like a database query or file load, causes it, you may be trying to load too much data in the virtual machine. You can either increase the VM's size or process the data in smaller pieces.
If the problem is more intermittent, it may be caused by not freeing up resources correctly. Any file, socket, database connection or other resource must be freed by invoking close(). This must be done in the finally block of a try-catch-finally structure to make sure close() is invoked.
If the cause is not obvious, you are probably accumulating data somewhere and never freeing it. HashMap/Table can have this problem if your objects don't implement hashcode correctly. The JVM has some tools to help you monitor the VM: Monitoring and Managing Java SE 6 Applications.
 
Gurunath Policherla
Greenhorn
Posts: 16
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Apart from Joe said, the other potential area is executing a block of code infinitly. Pls look at the loops and recursive function calls in the code. If this is happening after a recent production code release, concentrate on the release code changes.
[ April 15, 2008: Message edited by: Gurunath Policherla ]
 
Joe Ess
Bartender
Posts: 9362
11
Linux Mac OS X Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by Gurunath Policherla:
the other potential area is executing a block of code infinitly. Pls look at the loops and recursive function calls in the code.


I would think that circumstance would cause a StackOverflowError rather than an OutOfMemoryError
In any case, please don't Wake The Zombies. I don't think Karan's been quietly watching this topic for 2 months waiting for more input.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!