| Author |
Weblogic 8.1 SP5 server got shutdown due to Connection leak and java.lang.OutofMemory
|
Baseet Ahmed
Ranch Hand
Joined: Dec 18, 2006
Posts: 174
|
|
Hi Objects, This is regarding Weblogic 8.1 SP5 and MVC based application. We have an application(MVC based) deployed on Weblogic 8.1 prod server. We have created the Data Source and Connection Pool as well. Few days we are facing some problems. During transaction,suddenly the application site gets down. While looking at the server's log, it states: <Sep 1, 2007 11:50:03 AM IST> <Warning> <JDBC> <BEA-001074> <A JDBC pool connect ion leak was detected. A connection leak occurs when a connection obtained from the pool was not closed explicitly by calling close() and then was disposed by the garbage collector and returned to the connection pool. The following stack trace at create shows where the leaked connection was created. Stack trace at connection create: at weblogic.jdbc.wrapper.PoolConnection.init(PoolConnection.java:61) at weblogic.jdbc.pool.Driver.allocateConnection(Driver.java:254) at weblogic.jdbc.pool.Driver.connect(Driver.java:164) at weblogic.jdbc.jts.Driver.getNonTxConnection(Driver.java:540) at weblogic.jdbc.jts.Driver.connect(Driver.java:139) at weblogic.jdbc.common.internal.RmiDataSource.getConnection(RmiDataSource.java:329) And the Weblogic instance for this particular application got shutdown. And we have to restart it to recover from the problem. In the application's log file the following message appears: java.lang.OutOfMemoryError OutOfMemoryError occured on server Please suggest what can be done to overcome this problem. We have searched on Bea's website,but the link for this is not available at present. "Investigating JDBC Connection Leaks" --not available Thank you in advance. Baseet Ahmed *********************************** Tip: Sincerity is mother of all acheivements. ***********************************
|
 |
Roger Chung-Wee
Ranch Hand
Joined: Sep 29, 2002
Posts: 1683
|
|
|
Your applications should obtain Connections from the pool as late as possible and return them to the pool (by invoking the close() method) as soon as they are finished with them. Failure to do this can cause memory leaks and pool exhaustion.
|
SCJP 1.4, SCWCD 1.3, SCBCD 1.3
|
 |
Baseet Ahmed
Ranch Hand
Joined: Dec 18, 2006
Posts: 174
|
|
Hi, Well, using close() method for closing connection can avoid this problem or some other step need to be taken? Beacause this has not happened in Webloic6.1. The same code has been moved to WL 8.1 What about the following attributes of WL Connection Pooling: 1)Enable Connection Leak Profiling 2)Enable Connection Profiling 3)Inactive Connection Timeout 4)Maximum Waiting for Connection Pls suggest. *********************************** Tip: Sincerity is mother of all acheivements. ***********************************
|
 |
Baseet Ahmed
Ranch Hand
Joined: Dec 18, 2006
Posts: 174
|
|
Hi, Waiting for reply... Error Message: "java.lan.OutofMemory Out of memory occured on Server." (Server gets shutdown). Please assist. *********************************** Tip: Sincerity is mother of all acheivements. ***********************************
|
 |
suravarapu sridhar
Greenhorn
Joined: Oct 29, 2002
Posts: 26
|
|
The earlier versions of weblogic didnt have the feature of spitting out the fact that the connections of the connection pool are getting closed because of a timeout and that it was not closed properly from the code. The current versions tell you that explicitly. enabling JDBC attributes can help get more info on this. But what you need to do is look into your code and in each place you are trying to get a connection, close it explicitly, and also dont forget to add the close statment in the finally blocks. The OOM need not necessarily be related to the connection leak. you may want to run a profiler to check whats causing the leak. If you are using Jrockit its got a profiler with it.
|
 |
Baseet Ahmed
Ranch Hand
Joined: Dec 18, 2006
Posts: 174
|
|
Hi, I have added the close() method for connection leak problem in my program. But Out of Memory problem still persist. I am getting following error message in addition to java.lang.OutOfMemoryError java.io.IOException: Bad file number at java.io.FileOutputStream.writeBytes(Native Method) at java.io.FileOutputStream.write(FileOutputStream.java:260) at java.io.BufferedOutputStream.write(BufferedOutputStream.java:106) at java.io.FilterOutputStream.write(FilterOutputStream.java:80) java.lang.OutOfMemoryError java.lang.OutOfMemoryError ------------------------------------------------------------------------- Also sometime this error message: java.sql.SQLException: ORA-01722: invalid number at oracle.jdbc.driver.DatabaseError.throwSqlException(DatabaseError.java:125) at oracle.jdbc.driver.T4CTTIoer.processError(T4CTTIoer.java:305) at oracle.jdbc.driver.T4CTTIoer.processError(T4CTTIoer.java:272) at oracle.jdbc.driver.T4C8Oall.receive(T4C8Oall.java:626) at oracle.jdbc.driver.T4CPreparedStatement.doOall8(T4CPreparedStatement.java:182) at oracle.jdbc.driver.T4CPreparedStatement.execute_for_rows(T4CPreparedStatement.java:630) at oracle.jdbc.driver.OracleStatement.execute_maybe_describe(OracleStatement.java:961) at oracle.jdbc.driver.T4CPreparedStatement.execute_maybe_describe(T4CPreparedStatement.java:532) at oracle.jdbc.driver.OracleStatement.doExecuteWithTimeout(OracleStatement.java:1037) at oracle.jdbc.driver.OraclePreparedStatement.executeInternal(OraclePreparedStatement.java:2905) at oracle.jdbc.driver.OraclePreparedStatement.execute(OraclePreparedStatement.java:2996) at weblogic.jdbc.wrapper.PreparedStatement.execute(PreparedStatement.java:102) java.lang.OutOfMemoryError OutOfMemoryError occured on server ----------------------------------------------------------------- Any help in this context. Thank you. *********************************** Tip: Sincerity is mother of all acheivements. ***********************************
|
 |
Roger Chung-Wee
Ranch Hand
Joined: Sep 29, 2002
Posts: 1683
|
|
|
It looks like a bug in your SQL. Post the details in the JDBC forum.
|
 |
Baseet Ahmed
Ranch Hand
Joined: Dec 18, 2006
Posts: 174
|
|
Hope anybody knows the solution for 1st issue i.e java.lang.OutOfMemoryError. Any further help would be greatful. Thank you once again. Information Technologist ( as done B.Sc[I.T] ) *********************************** Tip: Sincerity is mother of all acheivements. ***********************************
|
 |
Tasja Mango
Greenhorn
Joined: Mar 03, 2004
Posts: 8
|
|
Hey, there are some profilers on the market, which you can download and test during 20 days. I think, this is enough time to find your bug. A simple but handy tool for memory leak detection is http://www.jb2works.com/. Download it, modify your script startWebLogic.cmd: a) set CLASSPATH=%WEBLOGIC_CLASSPATH%;...;%CLASSPATH%;D:\Tools\Jb2Works\jb2refscan-XXXXXX.jar b) Add the Reference Scanner class path argument just before "weblogic.Server": %JAVA_HOME%\bin\java –Xms128m –Xmx512m … com.jb2works.reference.Launcher weblogic.Server Restart the server, open a browser window to this address: http://localhost:4040/ Good Luck Tasja
|
 |
Roger Chung-Wee
Ranch Hand
Joined: Sep 29, 2002
Posts: 1683
|
|
|
You should fix all the other problems and then see if you get OutOfMemoryError.
|
 |
Baseet Ahmed
Ranch Hand
Joined: Dec 18, 2006
Posts: 174
|
|
Hi, Thank you for help. But still my problem persist.(Out of Memory issue) Now few days back I got following error message on Weblogic 8.1 during my Web application execution(running mode). (in WL error log file) java.io.IOException: Bad file number at java.io.FileOutputStream.writeBytes(Native Method) at java.io.FileOutputStream.write(FileOutputStream.java:260) at java.io.BufferedOutputStream.write(BufferedOutputStream.java:106) at java.io.FilterOutputStream.write(FilterOutputStream.java:80) .... at weblogic.servlet.internal.ServletRequestImpl.execute(ServletRequestIm pl.java:2766) at weblogic.kernel.ExecuteThread.execute(ExecuteThread.java:224) at weblogic.kernel.ExecuteThread.run(ExecuteThread.java:183) java.lang.OutOfMemoryError java.lang.OutOfMemoryError java.lang.OutOfMemoryError And second error message(in WL domain log file): ####<Oct 13, 2007 2:26:49 PM IST> <Error> <Kernel> <servername> <appname> <ExecuteThread: '0' for queue: 'weblogic.kernel.System'> <<WLS Kernel>> <> <BEA-000802> <ExecuteRequest failed java.lang.OutOfMemoryError. java.lang.Throwable > Please do let me know what causing these errors.(Not able to uderstand the loophole) Thank you. *********************************** Tip: Modesty is all virtue. ***********************************
|
 |
 |
|
|
subject: Weblogic 8.1 SP5 server got shutdown due to Connection leak and java.lang.OutofMemory
|
|
|