Re: Cleaning up after tomcat jdbc-pool?
It seems that only using the new jdbc pool has solved the memory leak :] it's funny that the idea to use it came from a different thread here in the users list. :] Thanks for your help Hila בתאריך 9 במרס 2011 22:33, מאת הילה hilavalen...@gmail.com: Sure, when I'll have a final results and see that the leak is no longer exist (prays the lord :P) I'll post a final thread with the solution :] 2011/3/9 André Warnier a...@ice-sa.com הילה wrote: I'll define it. thanks :] I've implemented 2 changes in production servers - one with the new pool (and still jtds drivers) and one with new pool + switching to jdbc drivers. both has windows authentication enabled. the servers look pretty stable until now, but I'm waiting to see the memory behaviour in the next few days. on servers with the jtds driver, basic pool and windows authentication, the leak appeared pretty fast, so I'm expecting results real soon. I'll keep you posted. Thanks you guys, you've been a great help so far :] Hila So, if I understand this correctly, this also terminates the other thread, now with a subject Tomcat NTLM Authentication, right ? Meaning that the MS JDBC driver works, it does NTLM authentication, and does not have a memory leak ? If so, you may want to post a final message to the other thread, so that people following that one would know how it ends, and what the solution was. - To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org For additional commands, e-mail: users-h...@tomcat.apache.org
Re: Cleaning up after tomcat jdbc-pool?
On 03/07/2011 06:46 PM, Nicholas Sushkin wrote: I don't think the default pool has any glaring leaks. However, your db may. I have ran into cases when Oracle would run out of PGA memory, which cleared with tomcat restart. It may help to use connection validation feature of tomcat's new pool to close connections that ran out of memory. Look at the maxAge property in http://people.apache.org/~fhanik/jdbc-pool/jdbc-pool.html it is created just to deal with the database sessions that have memory leaks, and the leak is somewhat predictable timing wise best Filip Don't know if such a scenario has been tested. I am curious to hear. On Mar 7, 2011 10:46 AM, הילהhilavalen...@gmail.com wrote: Thanks :] Let's see if it'll somewhat help with the memory leak, or with memory management at all 2011/3/7 Filip Hanik - Dev Listsdevli...@hanik.com On 3/7/2011 3:48 AM, Mark Thomas wrote: On 07/03/2011 10:39, הילה wrote: I found this... - To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org For additional commands, e-mail: users-h...@tomcat.apache.org
Re: Cleaning up after tomcat jdbc-pool?
I'll define it. thanks :] I've implemented 2 changes in production servers - one with the new pool (and still jtds drivers) and one with new pool + switching to jdbc drivers. both has windows authentication enabled. the servers look pretty stable until now, but I'm waiting to see the memory behaviour in the next few days. on servers with the jtds driver, basic pool and windows authentication, the leak appeared pretty fast, so I'm expecting results real soon. I'll keep you posted. Thanks you guys, you've been a great help so far :] Hila 2011/3/9 Filip Hanik - Dev Lists devli...@hanik.com On 03/07/2011 06:46 PM, Nicholas Sushkin wrote: I don't think the default pool has any glaring leaks. However, your db may. I have ran into cases when Oracle would run out of PGA memory, which cleared with tomcat restart. It may help to use connection validation feature of tomcat's new pool to close connections that ran out of memory. Look at the maxAge property in http://people.apache.org/~fhanik/jdbc-pool/jdbc-pool.html it is created just to deal with the database sessions that have memory leaks, and the leak is somewhat predictable timing wise best Filip Don't know if such a scenario has been tested. I am curious to hear. On Mar 7, 2011 10:46 AM, הילהhilavalen...@gmail.com wrote: Thanks :] Let's see if it'll somewhat help with the memory leak, or with memory management at all 2011/3/7 Filip Hanik - Dev Listsdevli...@hanik.com On 3/7/2011 3:48 AM, Mark Thomas wrote: On 07/03/2011 10:39, הילה wrote: I found this... - To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org For additional commands, e-mail: users-h...@tomcat.apache.org
Re: Cleaning up after tomcat jdbc-pool?
הילה wrote: I'll define it. thanks :] I've implemented 2 changes in production servers - one with the new pool (and still jtds drivers) and one with new pool + switching to jdbc drivers. both has windows authentication enabled. the servers look pretty stable until now, but I'm waiting to see the memory behaviour in the next few days. on servers with the jtds driver, basic pool and windows authentication, the leak appeared pretty fast, so I'm expecting results real soon. I'll keep you posted. Thanks you guys, you've been a great help so far :] Hila So, if I understand this correctly, this also terminates the other thread, now with a subject Tomcat NTLM Authentication, right ? Meaning that the MS JDBC driver works, it does NTLM authentication, and does not have a memory leak ? If so, you may want to post a final message to the other thread, so that people following that one would know how it ends, and what the solution was. - To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org For additional commands, e-mail: users-h...@tomcat.apache.org
Re: Cleaning up after tomcat jdbc-pool?
Sure, when I'll have a final results and see that the leak is no longer exist (prays the lord :P) I'll post a final thread with the solution :] 2011/3/9 André Warnier a...@ice-sa.com הילה wrote: I'll define it. thanks :] I've implemented 2 changes in production servers - one with the new pool (and still jtds drivers) and one with new pool + switching to jdbc drivers. both has windows authentication enabled. the servers look pretty stable until now, but I'm waiting to see the memory behaviour in the next few days. on servers with the jtds driver, basic pool and windows authentication, the leak appeared pretty fast, so I'm expecting results real soon. I'll keep you posted. Thanks you guys, you've been a great help so far :] Hila So, if I understand this correctly, this also terminates the other thread, now with a subject Tomcat NTLM Authentication, right ? Meaning that the MS JDBC driver works, it does NTLM authentication, and does not have a memory leak ? If so, you may want to post a final message to the other thread, so that people following that one would know how it ends, and what the solution was. - To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org For additional commands, e-mail: users-h...@tomcat.apache.org
Re: Cleaning up after tomcat jdbc-pool?
On 3/7/2011 8:00 AM, הילה wrote: How do I know if I use the new pool? just by specifying the org.apache.tomcat.jdbc.pool.DataSourceFactory AFAICT yes. what is the advantages of using the new pool? in which cases should I use it? See http://people.apache.org/~fhanik/jdbc-pool/jdbc-pool.html I guess that will be merged into the Tomcat docs eventually. -- O.L. - To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org For additional commands, e-mail: users-h...@tomcat.apache.org
Re: Cleaning up after tomcat jdbc-pool?
So it's only for use on Tomcat 7? I have installed tomcat 6.0.29 2011/3/7 Olivier Lefevre lefev...@yahoo.com On 3/7/2011 8:00 AM, הילה wrote: How do I know if I use the new pool? just by specifying the org.apache.tomcat.jdbc.pool.DataSourceFactory AFAICT yes. what is the advantages of using the new pool? in which cases should I use it? See http://people.apache.org/~fhanik/jdbc-pool/jdbc-pool.html I guess that will be merged into the Tomcat docs eventually. -- O.L. - To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org For additional commands, e-mail: users-h...@tomcat.apache.org
Re: Cleaning up after tomcat jdbc-pool?
I found this http://people.apache.org/~fhanik/tomcat/jdbc-pool.html that I see that it suits for tomcat 6 as well but I can't find tomcat-jdbc.jar for download, and I understood I need it to use the new pool. from where can I download it? Thanks Hila בתאריך 7 במרס 2011 12:28, מאת הילה hilavalen...@gmail.com: So it's only for use on Tomcat 7? I have installed tomcat 6.0.29 2011/3/7 Olivier Lefevre lefev...@yahoo.com On 3/7/2011 8:00 AM, הילה wrote: How do I know if I use the new pool? just by specifying the org.apache.tomcat.jdbc.pool.DataSourceFactory AFAICT yes. what is the advantages of using the new pool? in which cases should I use it? See http://people.apache.org/~fhanik/jdbc-pool/jdbc-pool.html I guess that will be merged into the Tomcat docs eventually. -- O.L. - To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org For additional commands, e-mail: users-h...@tomcat.apache.org
Re: Cleaning up after tomcat jdbc-pool?
On 07/03/2011 10:39, הילה wrote: I found this http://people.apache.org/~fhanik/tomcat/jdbc-pool.html that I see that it suits for tomcat 6 as well but I can't find tomcat-jdbc.jar for download, and I understood I need it to use the new pool. from where can I download it? There is no download since that component has never been released. If you want to experiment with it then you'll need to build it from source. Mark Thanks Hila בתאריך 7 במרס 2011 12:28, מאת הילה hilavalen...@gmail.com: So it's only for use on Tomcat 7? I have installed tomcat 6.0.29 2011/3/7 Olivier Lefevre lefev...@yahoo.com On 3/7/2011 8:00 AM, הילה wrote: How do I know if I use the new pool? just by specifying the org.apache.tomcat.jdbc.pool.DataSourceFactory AFAICT yes. what is the advantages of using the new pool? in which cases should I use it? See http://people.apache.org/~fhanik/jdbc-pool/jdbc-pool.html I guess that will be merged into the Tomcat docs eventually. -- O.L. - To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org For additional commands, e-mail: users-h...@tomcat.apache.org - To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org For additional commands, e-mail: users-h...@tomcat.apache.org
Re: Cleaning up after tomcat jdbc-pool?
On 3/7/2011 3:48 AM, Mark Thomas wrote: On 07/03/2011 10:39, הילה wrote: I found this http://people.apache.org/~fhanik/tomcat/jdbc-pool.html that I see that it suits for tomcat 6 as well but I can't find tomcat-jdbc.jar for download, and I understood I need it to use the new pool. from where can I download it? You can download the iteration builds from http://people.apache.org/~fhanik/jdbc-pool/ That site has the latest doc as well Filip There is no download since that component has never been released. If you want to experiment with it then you'll need to build it from source. Mark Thanks Hila בתאריך 7 במרס 2011 12:28, מאת הילהhilavalen...@gmail.com: So it's only for use on Tomcat 7? I have installed tomcat 6.0.29 2011/3/7 Olivier Lefevrelefev...@yahoo.com On 3/7/2011 8:00 AM, הילה wrote: How do I know if I use the new pool? just by specifying the org.apache.tomcat.jdbc.pool.DataSourceFactory AFAICT yes. what is the advantages of using the new pool? in which cases should I use it? See http://people.apache.org/~fhanik/jdbc-pool/jdbc-pool.html I guess that will be merged into the Tomcat docs eventually. -- O.L. - To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org For additional commands, e-mail: users-h...@tomcat.apache.org - To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org For additional commands, e-mail: users-h...@tomcat.apache.org - No virus found in this message. Checked by AVG - www.avg.com Version: 10.0.1204 / Virus Database: 1435/3486 - Release Date: 03/06/11 - To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org For additional commands, e-mail: users-h...@tomcat.apache.org
Re: Cleaning up after tomcat jdbc-pool?
Thanks :] Let's see if it'll somewhat help with the memory leak, or with memory management at all 2011/3/7 Filip Hanik - Dev Lists devli...@hanik.com On 3/7/2011 3:48 AM, Mark Thomas wrote: On 07/03/2011 10:39, הילה wrote: I found this http://people.apache.org/~fhanik/tomcat/jdbc-pool.html that I see that it suits for tomcat 6 as well but I can't find tomcat-jdbc.jar for download, and I understood I need it to use the new pool. from where can I download it? You can download the iteration builds from http://people.apache.org/~fhanik/jdbc-pool/ That site has the latest doc as well Filip There is no download since that component has never been released. If you want to experiment with it then you'll need to build it from source. Mark Thanks Hila בתאריך 7 במרס 2011 12:28, מאת הילהhilavalen...@gmail.com: So it's only for use on Tomcat 7? I have installed tomcat 6.0.29 2011/3/7 Olivier Lefevrelefev...@yahoo.com On 3/7/2011 8:00 AM, הילה wrote: How do I know if I use the new pool? just by specifying the org.apache.tomcat.jdbc.pool.DataSourceFactory AFAICT yes. what is the advantages of using the new pool? in which cases should I use it? See http://people.apache.org/~fhanik/jdbc-pool/jdbc-pool.html I guess that will be merged into the Tomcat docs eventually. -- O.L. - To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org For additional commands, e-mail: users-h...@tomcat.apache.org - To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org For additional commands, e-mail: users-h...@tomcat.apache.org - No virus found in this message. Checked by AVG - www.avg.com Version: 10.0.1204 / Virus Database: 1435/3486 - Release Date: 03/06/11 - To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org For additional commands, e-mail: users-h...@tomcat.apache.org
Re: Cleaning up after tomcat jdbc-pool?
I don't think the default pool has any glaring leaks. However, your db may. I have ran into cases when Oracle would run out of PGA memory, which cleared with tomcat restart. It may help to use connection validation feature of tomcat's new pool to close connections that ran out of memory. Don't know if such a scenario has been tested. I am curious to hear. On Mar 7, 2011 10:46 AM, הילה hilavalen...@gmail.com wrote: Thanks :] Let's see if it'll somewhat help with the memory leak, or with memory management at all 2011/3/7 Filip Hanik - Dev Lists devli...@hanik.com On 3/7/2011 3:48 AM, Mark Thomas wrote: On 07/03/2011 10:39, הילה wrote: I found this...
Re: Cleaning up after tomcat jdbc-pool?
On Sunday, March 06, 2011 07:45:19 הילה wrote: Hey, i'd glad to get you help with something :] I tried to put org.apache.tomcat.jdbc.pool.DataSourceFactory but after restarting tomcat, i get the error could not load resource factory class why is that? how can I define my application to clean up the pool? Thanks Hila The Factory we were talking about was from Tomcat's new jdbc pool, not from the default pool. If you're using the default pool, you don't need to do anything special like specifying factory in your context. So, if you are using the _new_ pool, make sure to have the tomcat-jdbc.jar installed in your Tomcat. http://people.apache.org/~fhanik/tomcat/jdbc-pool.html - To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org For additional commands, e-mail: users-h...@tomcat.apache.org
Re: Cleaning up after tomcat jdbc-pool?
How do I know if I use the new pool? just by specifying the org.apache.tomcat.jdbc.pool.DataSourceFactory ? what is the advantages of using the new pool? in which cases should I use it? Thanks :) 2011/3/6 Nicholas Sushkin nsush...@openfinance.com On Sunday, March 06, 2011 07:45:19 הילה wrote: Hey, i'd glad to get you help with something :] I tried to put org.apache.tomcat.jdbc.pool.DataSourceFactory but after restarting tomcat, i get the error could not load resource factory class why is that? how can I define my application to clean up the pool? Thanks Hila The Factory we were talking about was from Tomcat's new jdbc pool, not from the default pool. If you're using the default pool, you don't need to do anything special like specifying factory in your context. So, if you are using the _new_ pool, make sure to have the tomcat-jdbc.jar installed in your Tomcat. http://people.apache.org/~fhanik/tomcat/jdbc-pool.html - To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org For additional commands, e-mail: users-h...@tomcat.apache.org
Re: Cleaning up after tomcat jdbc-pool?
On Thursday, March 03, 2011 19:24:11 Olivier Lefevre wrote: Can we see the relevant part of your context.xml, too? Sure. It's something like: ?xml version=1.0 encoding=UTF-8? Context antiJARLocking=true path=@deploy.path@ Resource auth=Container connectionProperties=v$session.program=MyApp-@release@ @instance.title@; driverClassName=oracle.jdbc.driver.OracleDriver factory=org.apache.tomcat.jdbc.pool.DataSourceFactory initialSize=1 maxActive=10 name=jdbc/Db1 password=@db1.password@ type=javax.sql.DataSource url=@db1.dburl@ username=@db1.username@/ Resource auth=Container connectionProperties=v$session.program=API-@release@ @instance.title@; driverClassName=oracle.jdbc.driver.OracleDriver factory=org.apache.tomcat.jdbc.pool.DataSourceFactory initialSize=1 maxActive=10 name=jdbc/Db2 password=@db2.password@ type=javax.sql.DataSource url=@db2.dburl@ username=@db2.username@/ /Context At build time, I run the file through ant target that replaces @*@ tokens with actual values. I build using ant -propertyfile myinstance.properties dist target name=-pre-dist replace dir=${build.web.dir}/WEB-INF replacefilterfile=${instance.properties}/ replace dir=${build.web.dir}/META-INF replacefilterfile=${instance.properties}/ /target -- Nicholas Sushkin, Senior Software Engineer, Manager of IT Operations Open Finance Aggregation eXchange http://www.aggex.com smime.p7s Description: S/MIME cryptographic signature
Re: Cleaning up after tomcat jdbc-pool?
Thanks! But this: factory=org.apache.tomcat.jdbc.pool.DataSourceFactory is the default, I believe. Didn't you say you were using something else? -- O.L. - To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org For additional commands, e-mail: users-h...@tomcat.apache.org
Re: Cleaning up after tomcat jdbc-pool?
On 03/04/2011 02:04 PM, Olivier Lefevre wrote: Thanks! But this: factory=org.apache.tomcat.jdbc.pool.DataSourceFactory is the default, I believe. Didn't you say you were using something else? is not the default. org.apache.tomcat.dbcp.dbcp.BasicDataSourceFactory is default Filip -- O.L. - To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org For additional commands, e-mail: users-h...@tomcat.apache.org - To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org For additional commands, e-mail: users-h...@tomcat.apache.org
Re: Cleaning up after tomcat jdbc-pool?
hi Nicholas, where is your pool configured? In server.xml or in your application context? If it is configured in server.xml, then this is a bug, the thread should have been created with the class loader from the pool itself. If it is configured in the application context, then this simply means you forgot to call DataSource.close on the connection pool when your web application is stopped. best Filip On 3/2/2011 8:32 PM, Nicholas Sushkin wrote: Hi, Filip, Is there a recommended way to clean up after the pool? I am getting the following error message and I wonder if I need to add some code to prevent memory leak. 2011-03-02 22:20:20,786 ERROR [http-8081-1] org.apache.catalina.loader.WebappClassLoader - The web application [/…] appears to have started a thread named [[Pool-Cleaner]:Tomcat Connection Pool[19-2018147830]] but has failed to stop it. This is very likely to create a memory leak. Thanks. ps. Also, thanks for offering to open a Bugzilla enhancement request for setting password via JMX. - To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org For additional commands, e-mail: users-h...@tomcat.apache.org
Re: Cleaning up after tomcat jdbc-pool?
On 3/3/2011 11:44 AM, Olivier Lefevre wrote: On 3/3/2011 5:17 PM, Filip Hanik - Dev Lists wrote: If it is configured in the application context, then this simply means you forgot to call DataSource.close on the connection pool when your web application is stopped. This is confusing advice because javax.sql.DataSource doesn't have a close() method. In order to call close, one has to cast it to what ever the data source you are using. That is why it's easier to define these types of resources as spring beans, since spring takes care of that for you Also, I have this element in my webapp context.xml Resource name=jdbc/AppDesignerDB auth=Container type=javax.sql.DataSource / and I don't get the error the OP reported. Are you both talking about something else? It will only start a thread if you have configured it to do clean up while running Filip Regards, -- O.L. - No virus found in this message. Checked by AVG - www.avg.com Version: 10.0.1204 / Virus Database: 1435/3479 - Release Date: 03/03/11 - To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org For additional commands, e-mail: users-h...@tomcat.apache.org
Re: Cleaning up after tomcat jdbc-pool?
Hi, Filip, My tomcat jdbc pool is configured in my app's context.xml. My app uses MyBatis 3 to do the work. I store MyBatis SqlSessionFactory in ServletContext attributes. I was able to get DataSources back from Batis SqlSessionFactory, and invoke .close on each. The leak seems to have gone away now. Thanks again for your help. ps. Here's a snippet, in case anyone runs a similar configuration import java.io.IOException; import javax.servlet.ServletContext; import javax.servlet.ServletContextEvent; import org.apache.ibatis.io.Resources; import org.apache.ibatis.session.SqlSessionFactory; import org.apache.ibatis.session.SqlSessionFactoryBuilder; import org.apache.tomcat.jdbc.pool.DataSource; /** * Initialize MyBatis Configuration in this application * * p Loads mybatis configuration for d1 and d2 Databases. Per user manual, * configures one {@link SqlSessionFactory} per Database and stores the factories * in the context attributes codesmsSqlSessionFactory/code and * coderiSqlSessionFactory/code * * @author nsushkin * @see http://blog.idleworx.com/2010/06/initialize-mybatis-servletcontextlisten.html */ public class MyBatisConfiguratingContextListener implements javax.servlet.ServletContextListener { @Override public void contextInitialized(ServletContextEvent sce) { ServletContext ctx = sce.getServletContext(); String myBatisConfigFile = …/mybatis-configuration.xml; try { ctx.setAttribute(sf1, new SqlSessionFactoryBuilder().build(Resources.getResourceAsReader(myBatisConfigFile), env1)); ctx.setAttribute(sf2, new SqlSessionFactoryBuilder().build(Resources.getResourceAsReader(myBatisConfigFile), env2)); } catch (IOException ex) { ctx.log(Unable to configure MyBatis from config file ` + myBatisConfigFile + ', ex); } } @Override public void contextDestroyed(ServletContextEvent sce) { ServletContext ctx = sce.getServletContext(); closeDataSource(ctx, sf1); closeDataSource(ctx, sf2); ctx.removeAttribute(sf1); ctx.removeAttribute(sf2); } private void closeDataSource(ServletContext ctx, String contextAttribute) { DataSource dataSource = (DataSource)((SqlSessionFactory) ctx.getAttribute(contextAttribute)).getConfiguration().getEnvironment().getDataSource(); dataSource.close(); } } On Thursday, March 03, 2011 11:17:43 Filip Hanik - Dev Lists wrote: hi Nicholas, where is your pool configured? In server.xml or in your application context? If it is configured in server.xml, then this is a bug, the thread should have been created with the class loader from the pool itself. If it is configured in the application context, then this simply means you forgot to call DataSource.close on the connection pool when your web application is stopped. best Filip -- Nicholas Sushkin, Senior Software Engineer, Manager of IT Operations Open Finance Aggregation eXchange http://www.aggex.com smime.p7s Description: S/MIME cryptographic signature
Re: Cleaning up after tomcat jdbc-pool?
Can we see the relevant part of your context.xml, too? Thanks, -- O.L. - To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org For additional commands, e-mail: users-h...@tomcat.apache.org
Cleaning up after tomcat jdbc-pool?
Hi, Filip, Is there a recommended way to clean up after the pool? I am getting the following error message and I wonder if I need to add some code to prevent memory leak. 2011-03-02 22:20:20,786 ERROR [http-8081-1] org.apache.catalina.loader.WebappClassLoader - The web application [/…] appears to have started a thread named [[Pool-Cleaner]:Tomcat Connection Pool[19-2018147830]] but has failed to stop it. This is very likely to create a memory leak. Thanks. ps. Also, thanks for offering to open a Bugzilla enhancement request for setting password via JMX. -- Nicholas Sushkin, Senior Software Engineer, Manager of IT Operations Open Finance Aggregation eXchange http://www.aggex.com - To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org For additional commands, e-mail: users-h...@tomcat.apache.org