Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

server crashes with JDBC memory leak error

Status
Not open for further replies.

manirana007

Programmer
Jul 11, 2006
17
GB
A server hosting an e-commerce website goes down every 3-4 hours with out of memory error (JDBC Memory Leak error). I have looked into this problem and found that the leak could be from database connection not being closed properly. I have taken care of this issue, and although the situation improved, it is not 100%. What can be done about this aside from checking the application for improper closing of database connections. The server is Weblogic, with about >1GB RAM. It is running on RedHat Linux. Thanks.
 
If I remember ok, the weblogic console has an option to monitorize the number of open connections. I bet more for a bug releasing connections in the application rather than the driver itself.

Cheers,
Dian
 
Dian,

I checked the Weblogic console, and there I found that active connections are equal to maximum allowed capacity. I notice a problem with the memory usage graph. The memory alloted to Java Heap memory is >1GB, and the usage creeps up slowly and gets close to the max memory. There is a option to enforce garbage collection, and after clicking it, there is a noticeable drop in memory usage. Is there a way to enforce garbage collection every prescribed time period without having to do it manually? Or is there anything else I can try. Thanks.
 
I'd check the application that's keeping the connectios, that's the only way to stop this.

Cheers,
Dian
 
There is no way (or atleast that I know of) to check which application is keeping the connections. The server log shows that many JDBC memory leak errors are thrown and then eventually the server shutsdown with OutOfMemory error. The stack trace doesn't show which java file or JSP file caused the error. After I fixed the database connections problem, I notice a lot NullPointer Exceptions being thrown. Can they also pose memory leak problems? Thanks.
 
I imagine you know when this started and which application is on and off. And I take you have a test environment where you can modify the code to chech wether the apps are releasing its connections ...

Cheers,
Dian
 
This problem started occuring when this e-commerce website was put in place. I know that the problem is with the JSP and Java files used, but I took care of database connnections problem. Namely, the database connections were opened and closed in a single try block. I implemented finally blocks to all JSP and Java files. I also noted that by defaut the memory alloted to Java Heap memory was only 128 MB out of >1GB. I have changed this too, to allow more memory for Heap memory. Now the performance increased, but it seems that there might me some other issue. There is no development environment, only production. Is there is way to check the code automatically for any possible leaks? Or any other thing I should check for that might be adding to this problem? The website is a general e-commerce website, not too big. Thanks.
 
Maybe the application needs more available database connections. Did you try increasing that number?

Cheers,
Dian
 
If I increase the number of connections, then won't this problem get worse, considering there is leak somewhere? How will increasing the number of connections help with Memory leak problem? Right now, all connections are active. If I increase the number, I suspect that all the more connections will be occupied and take up more memory. Do it make any sense? Do you know any way to pinpoint which files may need a closer look? Thanks.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top