[Bug 53088] Give PoolCleaner TimerTask a better name
https://issues.apache.org/bugzilla/show_bug.cgi?id=53088 Filip Hanik changed: What|Removed |Added Status|REOPENED|RESOLVED Resolution|--- |FIXED --- Comment #5 from Filip Hanik --- Fixed in r1616639 -- You are receiving this mail because: You are the assignee for the bug. - To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org For additional commands, e-mail: dev-h...@tomcat.apache.org
svn commit: r1616644 - in /tomcat/trunk/modules/jdbc-pool: doc/jdbc-pool.xml src/main/java/org/apache/tomcat/jdbc/pool/interceptor/StatementFinalizer.java
Author: fhanik Date: Fri Aug 8 00:04:51 2014 New Revision: 1616644 URL: http://svn.apache.org/r1616644 Log: Fix https://issues.apache.org/bugzilla/show_bug.cgi?id=56318 Contribution by Danila Galimov Ability to log statement creation stacks Modified: tomcat/trunk/modules/jdbc-pool/doc/jdbc-pool.xml tomcat/trunk/modules/jdbc-pool/src/main/java/org/apache/tomcat/jdbc/pool/interceptor/StatementFinalizer.java Modified: tomcat/trunk/modules/jdbc-pool/doc/jdbc-pool.xml URL: http://svn.apache.org/viewvc/tomcat/trunk/modules/jdbc-pool/doc/jdbc-pool.xml?rev=1616644&r1=1616643&r2=1616644&view=diff == --- tomcat/trunk/modules/jdbc-pool/doc/jdbc-pool.xml (original) +++ tomcat/trunk/modules/jdbc-pool/doc/jdbc-pool.xml Fri Aug 8 00:04:51 2014 @@ -608,6 +608,13 @@ and closes these statements when the connection is returned to the pool. + +(boolean as String) Enable tracing of unclosed statements. + When enabled and a connection is closed, and statements are not closed, + the interceptor will log all stack traces. + The default value is false. + + Modified: tomcat/trunk/modules/jdbc-pool/src/main/java/org/apache/tomcat/jdbc/pool/interceptor/StatementFinalizer.java URL: http://svn.apache.org/viewvc/tomcat/trunk/modules/jdbc-pool/src/main/java/org/apache/tomcat/jdbc/pool/interceptor/StatementFinalizer.java?rev=1616644&r1=1616643&r2=1616644&view=diff == --- tomcat/trunk/modules/jdbc-pool/src/main/java/org/apache/tomcat/jdbc/pool/interceptor/StatementFinalizer.java (original) +++ tomcat/trunk/modules/jdbc-pool/src/main/java/org/apache/tomcat/jdbc/pool/interceptor/StatementFinalizer.java Fri Aug 8 00:04:51 2014 @@ -19,6 +19,7 @@ package org.apache.tomcat.jdbc.pool.inte import org.apache.juli.logging.Log; import org.apache.juli.logging.LogFactory; import org.apache.tomcat.jdbc.pool.ConnectionPool; +import org.apache.tomcat.jdbc.pool.PoolProperties; import org.apache.tomcat.jdbc.pool.PooledConnection; import java.lang.ref.WeakReference; @@ -26,6 +27,8 @@ import java.lang.reflect.Method; import java.sql.Statement; import java.util.LinkedList; import java.util.List; +import java.util.Map; + /** * Keeps track of statements associated with a connection and invokes close upon {@link java.sql.Connection#close()} * Useful for applications that dont close the associated statements after being done with a connection. @@ -34,13 +37,15 @@ import java.util.List; public class StatementFinalizer extends AbstractCreateStatementInterceptor { private static final Log log = LogFactory.getLog(StatementFinalizer.class); -protected List> statements = new LinkedList<>(); - +protected List> statements = new LinkedList<>(); + +private boolean logCreationStack = false; + @Override public Object createStatement(Object proxy, Method method, Object[] args, Object statement, long time) { try { if (statement instanceof Statement) -statements.add(new WeakReference<>((Statement)statement)); +statements.add(new WeakReference<>(new StatementEntry((Statement)statement))); }catch (ClassCastException x) { //ignore this one } @@ -50,25 +55,58 @@ public class StatementFinalizer extends @Override public void closeInvoked() { while (statements.size()>0) { -WeakReference ws = statements.remove(0); -Statement st = ws.get(); +WeakReference ws = statements.remove(0); +StatementEntry st = ws.get(); if (st!=null) { try { -st.close(); +st.getStatement().close(); } catch (Exception ignore) { if (log.isDebugEnabled()) { log.debug("Unable to closed statement upon connection close.",ignore); } } +if (logCreationStack) { +log.warn("Statement created, but was not closed at:", st.getAllocationStack()); +} } } } @Override +public void setProperties(Map properties) { +super.setProperties(properties); + +PoolProperties.InterceptorProperty logProperty = properties.get("trace"); +if (null != logProperty) { +logCreationStack = logProperty.getValueAsBoolean(logCreationStack); +} +} + +@Override public void reset(ConnectionPool parent, PooledConnection con) { statements.clear(); super.reset(parent, con); } +protected class StatementEntry { +private Statement statement; + private Throwable allocationStack; + +public StatementEntry(Statement statement) {
[Bug 56318] Oracle DB cursors are leaking when using org.apache.tomcat.jdbc.pool.DataSourceFactory
https://issues.apache.org/bugzilla/show_bug.cgi?id=56318 Filip Hanik changed: What|Removed |Added Status|REOPENED|RESOLVED Resolution|--- |FIXED --- Comment #17 from Filip Hanik --- Fixed in r161644 -- You are receiving this mail because: You are the assignee for the bug. - To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org For additional commands, e-mail: dev-h...@tomcat.apache.org
svn commit: r1616649 - /tomcat/trunk/modules/jdbc-pool/src/test/java/org/apache/tomcat/jdbc/test/TestValidationQueryTimeout.java
Author: fhanik Date: Fri Aug 8 00:22:51 2014 New Revision: 1616649 URL: http://svn.apache.org/r1616649 Log: Fix suspect test cases. If validation times out, it should be treated as a validation error. Modified: tomcat/trunk/modules/jdbc-pool/src/test/java/org/apache/tomcat/jdbc/test/TestValidationQueryTimeout.java Modified: tomcat/trunk/modules/jdbc-pool/src/test/java/org/apache/tomcat/jdbc/test/TestValidationQueryTimeout.java URL: http://svn.apache.org/viewvc/tomcat/trunk/modules/jdbc-pool/src/test/java/org/apache/tomcat/jdbc/test/TestValidationQueryTimeout.java?rev=1616649&r1=1616648&r2=1616649&view=diff == --- tomcat/trunk/modules/jdbc-pool/src/test/java/org/apache/tomcat/jdbc/test/TestValidationQueryTimeout.java (original) +++ tomcat/trunk/modules/jdbc-pool/src/test/java/org/apache/tomcat/jdbc/test/TestValidationQueryTimeout.java Fri Aug 8 00:22:51 2014 @@ -34,6 +34,8 @@ import org.junit.Test; import org.apache.tomcat.jdbc.pool.interceptor.QueryTimeoutInterceptor; +import static org.junit.Assert.fail; + public class TestValidationQueryTimeout extends DefaultTestCase { private static int TIMEOUT = 10; @@ -131,7 +133,7 @@ public class TestValidationQueryTimeout @Test(expected=SQLException.class) public void testValidationInvalidOnConnection() throws Exception { -// use our mock driver +// use a real driver cause we have an invalid query to validate this.datasource.setDriverClassName("org.h2.Driver"); this.datasource.setUrl("jdbc:h2:~/.h2/test;QUERY_TIMEOUT=0;DB_CLOSE_ON_EXIT=FALSE"); @@ -161,38 +163,31 @@ public class TestValidationQueryTimeout // this is a requirement for other tests to run properly start = System.currentTimeMillis(); stmt.execute(longQuery); -} catch (SQLException ex) {} -finally { +} catch (SQLTimeoutException ex) { + +} catch (SQLException x) { +fail("We should have got a timeout exception."); +} finally { end = System.currentTimeMillis(); if (stmt != null) { stmt.close(); } if (con != null) { con.close(); } Assert.assertTrue(start != 0 && end != 0); -Assert.assertTrue((end - start) > 1000); +//we're faking it +//Assert.assertTrue((end - start) > 1000); } } -@Test +@Test(expected = SQLException.class) public void testValidationQueryTimeoutOnBorrow() throws Exception { -// use our mock driver -this.datasource.setDriverClassName("org.h2.Driver"); - this.datasource.setUrl("jdbc:h2:~/.h2/test;QUERY_TIMEOUT=0;DB_CLOSE_ON_EXIT=FALSE"); - // Required to trigger validation query's execution this.datasource.setTestOnBorrow(true); this.datasource.setValidationInterval(-1); this.datasource.setValidationQuery(longQuery); this.datasource.setValidationQueryTimeout(1); - -// assert that even though the validation query times out, we still get a connection +// assert that even though the validation query we don't get a connection Connection con = this.datasource.getConnection(); -Assert.assertNotNull(con); -Statement st = con.createStatement(); -ResultSet rs = st.executeQuery("SELECT 1"); -rs.close(); -st.close(); -con.close(); } /** @@ -261,10 +256,6 @@ public class TestValidationQueryTimeout @Override public boolean execute(String sql) throws SQLException { if (longQuery.equals(sql)) { -try { -Thread.sleep(getQueryTimeout() * 1000); -}catch (Exception x) { -} throw new SQLTimeoutException(); } else { return super.execute(sql); - To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org For additional commands, e-mail: dev-h...@tomcat.apache.org
[GUMP@vmgump]: Project tomcat-trunk-validate (in module tomcat-trunk) failed
To whom it may engage... This is an automated request, but not an unsolicited one. For more information please visit http://gump.apache.org/nagged.html, and/or contact the folk at gene...@gump.apache.org. Project tomcat-trunk-validate has an issue affecting its community integration. This issue affects 1 projects, and has been outstanding for 12 runs. The current state of this project is 'Failed', with reason 'Build Failed'. For reference only, the following projects are affected by this: - tomcat-trunk-validate : Tomcat 8.x, a web server implementing the Java Servlet 3.1, ... Full details are available at: http://vmgump.apache.org/gump/public/tomcat-trunk/tomcat-trunk-validate/index.html That said, some information snippets are provided here. The following annotations (debug/informational/warning/error messages) were provided: -DEBUG- Dependency on checkstyle exists, no need to add for property checkstyle.jar. -INFO- Failed with reason build failed The following work was performed: http://vmgump.apache.org/gump/public/tomcat-trunk/tomcat-trunk-validate/gump_work/build_tomcat-trunk_tomcat-trunk-validate.html Work Name: build_tomcat-trunk_tomcat-trunk-validate (Type: Build) Work ended in a state of : Failed Elapsed: 25 secs Command Line: /usr/lib/jvm/java-7-oracle/bin/java -Djava.awt.headless=true -Dbuild.sysclasspath=only org.apache.tools.ant.Main -Dgump.merge=/srv/gump/public/gump/work/merge.xml -Dcheckstyle.jar=/srv/gump/public/workspace/checkstyle/target/checkstyle-5.8-SNAPSHOT.jar -Dexecute.validate=true validate [Working Directory: /srv/gump/public/workspace/tomcat-trunk] CLASSPATH: /usr/lib/jvm/java-7-oracle/lib/tools.jar:/srv/gump/public/workspace/ant/dist/lib/ant.jar:/srv/gump/public/workspace/ant/dist/lib/ant-launcher.jar:/srv/gump/public/workspace/ant/dist/lib/ant-jmf.jar:/srv/gump/public/workspace/ant/dist/lib/ant-junit.jar:/srv/gump/public/workspace/ant/dist/lib/ant-junit4.jar:/srv/gump/public/workspace/ant/dist/lib/ant-swing.jar:/srv/gump/public/workspace/ant/dist/lib/ant-apache-resolver.jar:/srv/gump/public/workspace/ant/dist/lib/ant-apache-xalan2.jar:/srv/gump/public/workspace/xml-commons/java/build/resolver.jar:/srv/gump/packages/antlr/antlr-3.1.3.jar:/srv/gump/public/workspace/checkstyle/target/checkstyle-5.8-SNAPSHOT.jar:/srv/gump/public/workspace/apache-commons/beanutils/dist/commons-beanutils-20140808.jar:/srv/gump/public/workspace/apache-commons/cli/target/commons-cli-1.3-SNAPSHOT.jar:/srv/gump/public/workspace/commons-collections-3.x/target/commons-collections-3.3-SNAPSHOT.jar:/srv/gump/public/workspace/apache-commons/exec/target/comm ons-exec-1.3-SNAPSHOT.jar:/srv/gump/public/workspace/apache-commons/logging/target/commons-logging-20140808.jar:/srv/gump/public/workspace/apache-commons/logging/target/commons-logging-api-20140808.jar:/srv/gump/public/workspace/apache-commons/validator/dist/commons-validator-20140808.jar:/srv/gump/public/workspace/google-guava/guava/target/guava-19.0-SNAPSHOT.jar - [checkstyle] /srv/gump/public/workspace/tomcat-trunk/modules/jdbc-pool/doc/jdbc-pool.xml:173: Line matches the illegal pattern '\s+$'. [checkstyle] /srv/gump/public/workspace/tomcat-trunk/modules/jdbc-pool/doc/jdbc-pool.xml:178: Line matches the illegal pattern '\s+$'. [checkstyle] /srv/gump/public/workspace/tomcat-trunk/modules/jdbc-pool/doc/jdbc-pool.xml:179: Line matches the illegal pattern '\s+$'. [checkstyle] /srv/gump/public/workspace/tomcat-trunk/modules/jdbc-pool/doc/jdbc-pool.xml:182: Line matches the illegal pattern '\s+$'. [checkstyle] /srv/gump/public/workspace/tomcat-trunk/modules/jdbc-pool/doc/jdbc-pool.xml:612: Line matches the illegal pattern '\s+$'. [checkstyle] /srv/gump/public/workspace/tomcat-trunk/modules/jdbc-pool/doc/jdbc-pool.xml:613: Line matches the illegal pattern '\s+$'. [checkstyle] /srv/gump/public/workspace/tomcat-trunk/modules/jdbc-pool/src/main/java/org/apache/tomcat/jdbc/naming/GenericNamingResourcesFactory.java:62: Line matches the illegal pattern '\s+$'. [checkstyle] /srv/gump/public/workspace/tomcat-trunk/modules/jdbc-pool/src/main/java/org/apache/tomcat/jdbc/pool/ClassLoaderUtil.java:25: Line matches the illegal pattern '\s+$'. [checkstyle] /srv/gump/public/workspace/tomcat-trunk/modules/jdbc-pool/src/main/java/org/apache/tomcat/jdbc/pool/ClassLoaderUtil.java:26: Line matches the illegal pattern '\s+$'. [checkstyle] /srv/gump/public/workspace/tomcat-trunk/modules/jdbc-pool/src/main/java/org/apache/tomcat/jdbc/pool/ClassLoaderUtil.java:27: Line matches the illegal pattern '\s+$'. [checkstyle] /srv/gump/public/workspace/tomcat-trunk/modules/jdbc-pool/src/main/java/org/apache/tomcat/jdbc/pool/ClassLoaderUtil.java:28: Line matches the illegal pattern '\s+$'. [checkstyle] /srv/gump/public/workspace/tomcat-trunk/modules/jdbc-pool/src/main/java/org/apache/tomcat/jdbc/pool/ConnectionPool.java:797: Line matches the illegal pattern '\s+$'. [checkstyle] /s
[GUMP@vmgump]: Project tomcat-trunk-test-nio2 (in module tomcat-trunk) failed
To whom it may engage... This is an automated request, but not an unsolicited one. For more information please visit http://gump.apache.org/nagged.html, and/or contact the folk at gene...@gump.apache.org. Project tomcat-trunk-test-nio2 has an issue affecting its community integration. This issue affects 1 projects, and has been outstanding for 7 runs. The current state of this project is 'Failed', with reason 'Build Failed'. For reference only, the following projects are affected by this: - tomcat-trunk-test-nio2 : Tomcat 8.x, a web server implementing the Java Servlet 3.1, ... Full details are available at: http://vmgump.apache.org/gump/public/tomcat-trunk/tomcat-trunk-test-nio2/index.html That said, some information snippets are provided here. The following annotations (debug/informational/warning/error messages) were provided: -DEBUG- Dependency on commons-daemon exists, no need to add for property commons-daemon.native.src.tgz. -DEBUG- Dependency on commons-daemon exists, no need to add for property tomcat-native.tar.gz. -INFO- Failed with reason build failed -INFO- Project Reports in: /srv/gump/public/workspace/tomcat-trunk/output/logs-NIO2 -INFO- Project Reports in: /srv/gump/public/workspace/tomcat-trunk/output/test-tmp-NIO2/logs The following work was performed: http://vmgump.apache.org/gump/public/tomcat-trunk/tomcat-trunk-test-nio2/gump_work/build_tomcat-trunk_tomcat-trunk-test-nio2.html Work Name: build_tomcat-trunk_tomcat-trunk-test-nio2 (Type: Build) Work ended in a state of : Failed Elapsed: 25 mins 11 secs Command Line: /usr/lib/jvm/java-7-oracle/bin/java -Djava.awt.headless=true -Dbuild.sysclasspath=only org.apache.tools.ant.Main -Dgump.merge=/srv/gump/public/gump/work/merge.xml -Djunit.jar=/srv/gump/public/workspace/junit/target/junit-4.12-SNAPSHOT.jar -Dobjenesis.jar=/srv/gump/public/workspace/objenesis/main/target/objenesis-2.2-SNAPSHOT.jar -Dtest.reports=output/logs-NIO2 -Dtomcat-native.tar.gz=/srv/gump/public/workspace/apache-commons/daemon/dist/bin/commons-daemon-20140808-native-src.tar.gz -Dexamples.sources.skip=true -Djdt.jar=/srv/gump/packages/eclipse/plugins/P20140317-1600/ecj-P20140317-1600.jar -Dcommons-daemon.jar=/srv/gump/public/workspace/apache-commons/daemon/dist/commons-daemon-20140808.jar -Dcommons-daemon.native.src.tgz=/srv/gump/public/workspace/apache-commons/daemon/dist/bin/commons-daemon-20140808-native-src.tar.gz -Dtest.temp=output/test-tmp-NIO2 -Dtest.accesslog=true -Dexecute.test.nio=false -Dexecute.test.apr=false -Dexecute.test.bio=false -Dexecute.test.nio2=t rue -Deasymock.jar=/srv/gump/public/workspace/easymock/easymock/target/easymock-3.3-SNAPSHOT.jar -Dhamcrest.jar=/srv/gump/public/workspace/hamcrest/hamcrest-java/build/hamcrest-core-20140808.jar -Dcglib.jar=/srv/gump/packages/cglib/cglib-nodep-2.2.jar test [Working Directory: /srv/gump/public/workspace/tomcat-trunk] CLASSPATH: /usr/lib/jvm/java-7-oracle/lib/tools.jar:/srv/gump/public/workspace/tomcat-trunk/output/build/webapps/examples/WEB-INF/classes:/srv/gump/public/workspace/tomcat-trunk/output/testclasses:/srv/gump/public/workspace/ant/dist/lib/ant.jar:/srv/gump/public/workspace/ant/dist/lib/ant-launcher.jar:/srv/gump/public/workspace/ant/dist/lib/ant-jmf.jar:/srv/gump/public/workspace/ant/dist/lib/ant-junit.jar:/srv/gump/public/workspace/ant/dist/lib/ant-junit4.jar:/srv/gump/public/workspace/ant/dist/lib/ant-swing.jar:/srv/gump/public/workspace/ant/dist/lib/ant-apache-resolver.jar:/srv/gump/public/workspace/ant/dist/lib/ant-apache-xalan2.jar:/srv/gump/public/workspace/xml-commons/java/build/resolver.jar:/srv/gump/public/workspace/tomcat-trunk/output/build/bin/bootstrap.jar:/srv/gump/public/workspace/tomcat-trunk/output/build/bin/tomcat-juli.jar:/srv/gump/public/workspace/tomcat-trunk/output/build/lib/annotations-api.jar:/srv/gump/public/workspace/tomcat-trunk/output/build/lib/servlet-api.ja r:/srv/gump/public/workspace/tomcat-trunk/output/build/lib/jsp-api.jar:/srv/gump/public/workspace/tomcat-trunk/output/build/lib/el-api.jar:/srv/gump/public/workspace/tomcat-trunk/output/build/lib/websocket-api.jar:/srv/gump/public/workspace/tomcat-trunk/output/build/lib/catalina.jar:/srv/gump/public/workspace/tomcat-trunk/output/build/lib/catalina-ant.jar:/srv/gump/public/workspace/tomcat-trunk/output/build/lib/catalina-storeconfig.jar:/srv/gump/public/workspace/tomcat-trunk/output/build/lib/tomcat-coyote.jar:/srv/gump/public/workspace/tomcat-trunk/output/build/lib/jasper.jar:/srv/gump/public/workspace/tomcat-trunk/output/build/lib/jasper-el.jar:/srv/gump/public/workspace/tomcat-trunk/output/build/lib/catalina-tribes.jar:/srv/gump/public/workspace/tomcat-trunk/output/build/lib/catalina-ha.jar:/srv/gump/public/workspace/tomcat-trunk/output/build/lib/tomcat-api.jar:/srv/gump/public/workspace/tomcat-trunk/output/build/lib/tomcat-jni.jar:/srv/gump/public/workspace/tomcat-trunk/output/bu ild/lib/tomcat-spdy.jar:/srv/gump/public/workspace/tomcat-trunk/output/
Re: svn commit: r1616594 - in /tomcat/trunk/modules/jdbc-pool/src: main/java/org/apache/tomcat/jdbc/pool/ConnectionPool.java main/java/org/apache/tomcat/jdbc/pool/PooledConnection.java test/java/org/a
On 7. August 2014 23:04:12 MESZ, fha...@apache.org wrote: >Author: fhanik >Date: Thu Aug 7 21:04:11 2014 >New Revision: 1616594 > >URL: http://svn.apache.org/r1616594 >Log: >Fix https://issues.apache.org/bugzilla/show_bug.cgi?id=54227 >MaxAge should be honored upon borrow as well, to assure that no >connection is ever used if it has been connected longer than designated >time. > >Added: >tomcat/trunk/modules/jdbc-pool/src/test/java/org/apache/tomcat/jdbc/bugs/Bug54227.java > (with props) >Modified: >tomcat/trunk/modules/jdbc-pool/src/main/java/org/apache/tomcat/jdbc/pool/ConnectionPool.java >tomcat/trunk/modules/jdbc-pool/src/main/java/org/apache/tomcat/jdbc/pool/PooledConnection.java > >Modified: >tomcat/trunk/modules/jdbc-pool/src/main/java/org/apache/tomcat/jdbc/pool/ConnectionPool.java >URL: >http://svn.apache.org/viewvc/tomcat/trunk/modules/jdbc-pool/src/main/java/org/apache/tomcat/jdbc/pool/ConnectionPool.java?rev=1616594&r1=1616593&r2=1616594&view=diff >== >--- >tomcat/trunk/modules/jdbc-pool/src/main/java/org/apache/tomcat/jdbc/pool/ConnectionPool.java >(original) >+++ >tomcat/trunk/modules/jdbc-pool/src/main/java/org/apache/tomcat/jdbc/pool/ConnectionPool.java >Thu Aug 7 21:04:11 2014 >@@ -279,6 +279,10 @@ public class ConnectionPool { >* @throws SQLException if an interceptor can't be configured, if the >proxy can't be instantiated > */ >protected Connection setupConnection(PooledConnection con) throws >SQLException { >+//check if it's been sitting in the pool too long >+if (con.isMaxAgeExpired()) { >+con.reconnect(); >+} > //fetch previously cached interceptor proxy - one per connection > JdbcInterceptor handler = con.getHandler(); > if (handler==null) { >@@ -862,11 +866,8 @@ public class ConnectionPool { > if (isClosed()) return true; > if (!con.validate(action)) return true; > if (!terminateTransaction(con)) return true; >-if (getPoolProperties().getMaxAge()>0 ) { >-return (System.currentTimeMillis()-con.getLastConnected()) >> getPoolProperties().getMaxAge(); >-} else { >-return false; >-} >+if (con.isMaxAgeExpired()) return true; >+else return false; Wouldn't it be nicer to directly return con.isMaxAgeExpired()? Regards Felix > } > > /** > >Modified: >tomcat/trunk/modules/jdbc-pool/src/main/java/org/apache/tomcat/jdbc/pool/PooledConnection.java >URL: >http://svn.apache.org/viewvc/tomcat/trunk/modules/jdbc-pool/src/main/java/org/apache/tomcat/jdbc/pool/PooledConnection.java?rev=1616594&r1=1616593&r2=1616594&view=diff >== >--- >tomcat/trunk/modules/jdbc-pool/src/main/java/org/apache/tomcat/jdbc/pool/PooledConnection.java >(original) >+++ >tomcat/trunk/modules/jdbc-pool/src/main/java/org/apache/tomcat/jdbc/pool/PooledConnection.java >Thu Aug 7 21:04:11 2014 >@@ -318,6 +318,19 @@ public class PooledConnection { > } > > /** >+ * Returns true if the connection has been connected more than >+ * {@link PoolConfiguration#getMaxAge()} milliseconds. false >otherwise. >+ * @return Returns true if the connection has been connected more >than >+ * {@link PoolConfiguration#getMaxAge()} milliseconds. false >otherwise. >+ */ >+public boolean isMaxAgeExpired() { >+if (getPoolProperties().getMaxAge()>0 ) { >+return (System.currentTimeMillis() - getLastConnected()) > >getPoolProperties().getMaxAge(); >+} else { >+return false; >+} >+} >+/** >* Issues a call to {@link #disconnect(boolean)} with the argument false >followed by a call to > * {@link #connect()} > * @throws SQLException if the call to {@link #connect()} fails. > >Added: >tomcat/trunk/modules/jdbc-pool/src/test/java/org/apache/tomcat/jdbc/bugs/Bug54227.java >URL: >http://svn.apache.org/viewvc/tomcat/trunk/modules/jdbc-pool/src/test/java/org/apache/tomcat/jdbc/bugs/Bug54227.java?rev=1616594&view=auto >== >--- >tomcat/trunk/modules/jdbc-pool/src/test/java/org/apache/tomcat/jdbc/bugs/Bug54227.java >(added) >+++ >tomcat/trunk/modules/jdbc-pool/src/test/java/org/apache/tomcat/jdbc/bugs/Bug54227.java >Thu Aug 7 21:04:11 2014 >@@ -0,0 +1,65 @@ >+/* >+ * Licensed to the Apache Software Foundation (ASF) under one or more >+ * contributor license agreements. See the NOTICE file distributed >with >+ * this work for additional information regarding copyright ownership. >+ * The ASF licenses this file to You under the Apache License, Version >2.0 >+ * (the "License"); you may not use this file except in compliance >with >+ * the License. You may obtain a copy of the License at >+ * >+ * http://www.apache.org/licenses/LICENSE-2.0 >+ * >+ * Unless required by applicable
Deprecation of SSLCertificateChainFile
I have noticed that as of apache httpd version 2.4.8, mod_ssl has deprecated SSLCertificateChainFile and has extended SSLCertificateFile to serve the same purpose by allowing the specification of the entire certificate chain, including the server certificate up to the root. This is easier to maintain, on a project that has to work with configuration both for apache httpd as well as tomcat. When can we expect tomcat's APR connector to support these newer configuration options as mod_ssl in httpd? Thanks. -- Matt
svn commit: r1616441 - in /tomcat/trunk: java/org/apache/catalina/connector/ java/org/apache/catalina/core/ java/org/apache/catalina/valves/ test/org/apache/catalina/core/ webapps/docs/
Author: markt Date: Thu Aug 7 08:53:01 2014 New Revision: 1616441 URL: http://svn.apache.org/r1616441 Log: Fix https://issues.apache.org/bugzilla/show_bug.cgi?id=56739 If an application handles an error on an application thread during asynchronous processing by calling HttpServletResponse.sendError(), then ensure that the application is given an opportunity to report that error via an appropriate application defined error page if one is configured. Modified: tomcat/trunk/java/org/apache/catalina/connector/CoyoteAdapter.java tomcat/trunk/java/org/apache/catalina/connector/Response.java tomcat/trunk/java/org/apache/catalina/core/LocalStrings.properties tomcat/trunk/java/org/apache/catalina/core/StandardHostValve.java tomcat/trunk/java/org/apache/catalina/valves/ErrorReportValve.java tomcat/trunk/test/org/apache/catalina/core/TestAsyncContextImpl.java tomcat/trunk/webapps/docs/changelog.xml Modified: tomcat/trunk/java/org/apache/catalina/connector/CoyoteAdapter.java URL: http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/catalina/connector/CoyoteAdapter.java?rev=1616441&r1=1616440&r2=1616441&view=diff == --- tomcat/trunk/java/org/apache/catalina/connector/CoyoteAdapter.java (original) +++ tomcat/trunk/java/org/apache/catalina/connector/CoyoteAdapter.java Thu Aug 7 08:53:01 2014 @@ -400,6 +400,14 @@ public class CoyoteAdapter implements Ad } } +// Has an error occurred during async processing that needs to be +// processed by the application's error page mechanism (or Tomcat's +// if the application doesn't define one)? +if (!request.isAsyncDispatching() && request.isAsync() && +response.isErrorReportRequired()) { + connector.getService().getContainer().getPipeline().getFirst().invoke(request, response); +} + if (request.isAsyncDispatching()) { success = true; connector.getService().getContainer().getPipeline().getFirst().invoke(request, response); Modified: tomcat/trunk/java/org/apache/catalina/connector/Response.java URL: http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/catalina/connector/Response.java?rev=1616441&r1=1616440&r2=1616441&view=diff == --- tomcat/trunk/java/org/apache/catalina/connector/Response.java (original) +++ tomcat/trunk/java/org/apache/catalina/connector/Response.java Thu Aug 7 08:53:01 2014 @@ -32,6 +32,7 @@ import java.util.List; import java.util.Locale; import java.util.TimeZone; import java.util.Vector; +import java.util.concurrent.atomic.AtomicInteger; import javax.servlet.ServletOutputStream; import javax.servlet.SessionTrackingMode; @@ -195,10 +196,35 @@ public class Response private boolean isCharacterEncodingSet = false; /** - * The error flag. + * With the introduction of async processing and the possibility of + * non-container threads calling sendError() tracking the current error + * state and ensuring that the correct error page is called becomes more + * complicated. This state attribute helps by tracking the current error + * state and informing callers that attempt to change state if the change + * was successful or if another thread got there first. + * + * + * The state machine is very simple: + * + * 0 - NONE + * 1 - NOT_REPORTED + * 2 - REPORTED + * + * + * -->>-- >NONE + * | || + * | || setError() + * ^ ^| + * | | \|/ + * | |-<-NOT_REPORTED + * || + * ^| report() + * || + * | \|/ + * |
[Bug 56739] Error response body generated only occasionally
https://issues.apache.org/bugzilla/show_bug.cgi?id=56739 Mark Thomas changed: What|Removed |Added Component|Catalina|Catalina Version|8.0.9 |7.0.55 Product|Tomcat 8|Tomcat 7 Target Milestone||--- --- Comment #4 from Mark Thomas --- This has been fixed in 8.0.x for 8.0.11 onwards. I'm going to leave it a little while to give folks a chance to review the changes before back-porting it to 7.0.x. -- You are receiving this mail because: You are the assignee for the bug. - To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org For additional commands, e-mail: dev-h...@tomcat.apache.org
buildbot retry in ASF Buildbot on tomcat-trunk
on builder tomcat-trunk while building ASF Buildbot. Full details are available at: http://ci.apache.org/builders/tomcat-trunk/builds/335 Buildbot URL: http://ci.apache.org/ Buildslave for this Build: bb-vm_ubuntu Build Reason: scheduler Build Source Stamp: [branch tomcat/trunk] 1616441 Blamelist: markt BUILD FAILED: retry exception slave lost sincerely, -The Buildbot - To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org For additional commands, e-mail: dev-h...@tomcat.apache.org
svn commit: r1616452 - /tomcat/trunk/java/org/apache/coyote/AsyncStateMachine.java
Author: markt Date: Thu Aug 7 09:44:05 2014 New Revision: 1616452 URL: http://svn.apache.org/r1616452 Log: Fix https://issues.apache.org/bugzilla/show_bug.cgi?id=56736 Avoid incorrect ISE if the timeout fires after a non-container thread has called dispatch() but before a container thread processed the dispatch() Modified: tomcat/trunk/java/org/apache/coyote/AsyncStateMachine.java Modified: tomcat/trunk/java/org/apache/coyote/AsyncStateMachine.java URL: http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/coyote/AsyncStateMachine.java?rev=1616452&r1=1616451&r2=1616452&view=diff == --- tomcat/trunk/java/org/apache/coyote/AsyncStateMachine.java (original) +++ tomcat/trunk/java/org/apache/coyote/AsyncStateMachine.java Thu Aug 7 09:44:05 2014 @@ -259,9 +259,10 @@ public class AsyncStateMachine { state = AsyncState.TIMING_OUT; return true; } else if (state == AsyncState.COMPLETING || +state == AsyncState.DISPATCHING || state == AsyncState.DISPATCHED) { -// NOOP - App called complete between the the timeout firing and -// execution reaching this point +// NOOP - App called complete() or dispatch() between the the +// timeout firing and execution reaching this point return false; } else { throw new IllegalStateException( - To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org For additional commands, e-mail: dev-h...@tomcat.apache.org
svn commit: r1616458 - /tomcat/trunk/webapps/docs/changelog.xml
Author: markt Date: Thu Aug 7 10:01:58 2014 New Revision: 1616458 URL: http://svn.apache.org/r1616458 Log: Update changelog Modified: tomcat/trunk/webapps/docs/changelog.xml Modified: tomcat/trunk/webapps/docs/changelog.xml URL: http://svn.apache.org/viewvc/tomcat/trunk/webapps/docs/changelog.xml?rev=1616458&r1=1616457&r2=1616458&view=diff == --- tomcat/trunk/webapps/docs/changelog.xml (original) +++ tomcat/trunk/webapps/docs/changelog.xml Thu Aug 7 10:01:58 2014 @@ -81,6 +81,12 @@ Cédric Couralet. (markt) +56736: Avoid an incorrect IllegalStateException +if the async timeout fires after a non-container thread has called +AsyncContext.dispatch() but before a container thread +starts processing the dispatch. (markt) + + 56739: If an application handles an error on an application thread during asynchronous processing by calling HttpServletResponse.sendError(), then ensure that the - To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org For additional commands, e-mail: dev-h...@tomcat.apache.org
svn commit: r1616464 - in /tomcat/trunk: java/org/apache/coyote/AbstractProtocol.java java/org/apache/coyote/ContainerThreadMarker.java webapps/docs/changelog.xml
Author: markt Date: Thu Aug 7 10:28:18 2014 New Revision: 1616464 URL: http://svn.apache.org/r1616464 Log: Do not mark threads from the container thread pool as container threads when being used to process AsyncContext.start(Runnable) so processing is correctly transferred back to a genuine container thread when necessary. Modified: tomcat/trunk/java/org/apache/coyote/AbstractProtocol.java tomcat/trunk/java/org/apache/coyote/ContainerThreadMarker.java tomcat/trunk/webapps/docs/changelog.xml Modified: tomcat/trunk/java/org/apache/coyote/AbstractProtocol.java URL: http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/coyote/AbstractProtocol.java?rev=1616464&r1=1616463&r2=1616464&view=diff == --- tomcat/trunk/java/org/apache/coyote/AbstractProtocol.java (original) +++ tomcat/trunk/java/org/apache/coyote/AbstractProtocol.java Thu Aug 7 10:28:18 2014 @@ -609,7 +609,7 @@ public abstract class AbstractProtocolhttp://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/coyote/ContainerThreadMarker.java?rev=1616464&r1=1616463&r2=1616464&view=diff == --- tomcat/trunk/java/org/apache/coyote/ContainerThreadMarker.java (original) +++ tomcat/trunk/java/org/apache/coyote/ContainerThreadMarker.java Thu Aug 7 10:28:18 2014 @@ -16,6 +16,12 @@ */ package org.apache.coyote; +/** + * Used to mark threads that have been allocated by the container to process + * data from an incoming connection. Application created threads are not + * container threads and neither are threads taken from the container thread + * pool to execute AsyncContext.start(Runnable). + */ public class ContainerThreadMarker { private static final ThreadLocal marker = new ThreadLocal<>(); @@ -29,7 +35,11 @@ public class ContainerThreadMarker { } } -public static void markAsContainerThread() { +public static void set() { marker.set(Boolean.TRUE); } + +public static void clear() { +marker.set(Boolean.FALSE); +} } Modified: tomcat/trunk/webapps/docs/changelog.xml URL: http://svn.apache.org/viewvc/tomcat/trunk/webapps/docs/changelog.xml?rev=1616464&r1=1616463&r2=1616464&view=diff == --- tomcat/trunk/webapps/docs/changelog.xml (original) +++ tomcat/trunk/webapps/docs/changelog.xml Thu Aug 7 10:28:18 2014 @@ -118,6 +118,12 @@ header is returned for resources that might be returned directly in compressed form. (markt) + +Do not mark threads from the container thread pool as container threads +when being used to process AsyncContext.start(Runnable) so +processing is correctly transferred back to a genuine container thread +when necessary. (markt) + - To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org For additional commands, e-mail: dev-h...@tomcat.apache.org
[Bug 56736] IllegalStateException after calling AsyncContext.dispatch
https://issues.apache.org/bugzilla/show_bug.cgi?id=56736 Mark Thomas changed: What|Removed |Added Status|NEW |RESOLVED Resolution|--- |FIXED --- Comment #1 from Mark Thomas --- This has been fixed in 8.0.x for 8.0.11 onwards. There were actually two problems here. The first was that calls to dispatch() from threads started with AsyncContext.start(Runnable) were not being processed until the AsyncContext timed out. The second was a rare timing issue made much more likely by the previous bug. The timing issue has also been fixed in 7.0.x for 7.0.56 onwards. -- You are receiving this mail because: You are the assignee for the bug. - To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org For additional commands, e-mail: dev-h...@tomcat.apache.org
svn commit: r1616465 - in /tomcat/tc7.0.x/trunk: ./ java/org/apache/coyote/AsyncStateMachine.java webapps/docs/changelog.xml
Author: markt Date: Thu Aug 7 10:34:20 2014 New Revision: 1616465 URL: http://svn.apache.org/r1616465 Log: Fix https://issues.apache.org/bugzilla/show_bug.cgi?id=56736 Avoid incorrect ISE if the timeout fires after a non-container thread has called dispatch() but before a container thread processed the dispatch() Modified: tomcat/tc7.0.x/trunk/ (props changed) tomcat/tc7.0.x/trunk/java/org/apache/coyote/AsyncStateMachine.java tomcat/tc7.0.x/trunk/webapps/docs/changelog.xml Propchange: tomcat/tc7.0.x/trunk/ -- Merged /tomcat/trunk:r1616452,1616458 Modified: tomcat/tc7.0.x/trunk/java/org/apache/coyote/AsyncStateMachine.java URL: http://svn.apache.org/viewvc/tomcat/tc7.0.x/trunk/java/org/apache/coyote/AsyncStateMachine.java?rev=1616465&r1=1616464&r2=1616465&view=diff == --- tomcat/tc7.0.x/trunk/java/org/apache/coyote/AsyncStateMachine.java (original) +++ tomcat/tc7.0.x/trunk/java/org/apache/coyote/AsyncStateMachine.java Thu Aug 7 10:34:20 2014 @@ -240,9 +240,10 @@ public class AsyncStateMachine { state = AsyncState.TIMING_OUT; return true; } else if (state == AsyncState.COMPLETING || +state == AsyncState.DISPATCHING || state == AsyncState.DISPATCHED) { -// NOOP - App called complete between the the timeout firing and -// execution reaching this point +// NOOP - App called complete() or dispatch() between the the +// timeout firing and execution reaching this point return false; } else { throw new IllegalStateException( Modified: tomcat/tc7.0.x/trunk/webapps/docs/changelog.xml URL: http://svn.apache.org/viewvc/tomcat/tc7.0.x/trunk/webapps/docs/changelog.xml?rev=1616465&r1=1616464&r2=1616465&view=diff == --- tomcat/tc7.0.x/trunk/webapps/docs/changelog.xml (original) +++ tomcat/tc7.0.x/trunk/webapps/docs/changelog.xml Thu Aug 7 10:34:20 2014 @@ -71,6 +71,12 @@ Cédric Couralet. (markt) +56736: Avoid an incorrect IllegalStateException +if the async timeout fires after a non-container thread has called +AsyncContext.dispatch() but before a container thread +starts processing the dispatch. (markt) + + 56771: When lookup for a resource in all the alternate or backup javax.naming.directory.DirContext, javax.naming.NameNotFoundException will be thrown at the - To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org For additional commands, e-mail: dev-h...@tomcat.apache.org
buildbot failure in ASF Buildbot on tomcat-trunk
The Buildbot has detected a new failure on builder tomcat-trunk while building ASF Buildbot. Full details are available at: http://ci.apache.org/builders/tomcat-trunk/builds/337 Buildbot URL: http://ci.apache.org/ Buildslave for this Build: bb-vm_ubuntu Build Reason: scheduler Build Source Stamp: [branch tomcat/trunk] 1616441 Blamelist: markt BUILD FAILED: failed compile_1 sincerely, -The Buildbot - To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org For additional commands, e-mail: dev-h...@tomcat.apache.org
[Bug 56756] VM argument javaagent is not working
https://issues.apache.org/bugzilla/show_bug.cgi?id=56756 Mark Thomas changed: What|Removed |Added Status|REOPENED|RESOLVED Resolution|--- |WORKSFORME --- Comment #9 from Mark Thomas --- Unsurprisingly this still works for me when running Tomcat via Eclipse. Please stop re-opening this bug and use the users mailing list to debug your configuration error. -- You are receiving this mail because: You are the assignee for the bug. - To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org For additional commands, e-mail: dev-h...@tomcat.apache.org
[Bug 53085] [perf] [concurrency] DefaultInstanceManager.annotationCache is not optimal for more threads
https://issues.apache.org/bugzilla/show_bug.cgi?id=53085 --- Comment #4 from Manoj --- Am also facing similar issue. This issue stalls the application throughput after a certain load. When can we expect a patch for annotationCache concurrency? -- You are receiving this mail because: You are the assignee for the bug. - To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org For additional commands, e-mail: dev-h...@tomcat.apache.org
[Bug 56614] Add a switch to ignore annotations detection on tag instances for performance reason
https://issues.apache.org/bugzilla/show_bug.cgi?id=56614 --- Comment #3 from Manoj --- Is this patch included in any of the tomcat build? -- You are receiving this mail because: You are the assignee for the bug. - To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org For additional commands, e-mail: dev-h...@tomcat.apache.org
buildbot success in ASF Buildbot on tomcat-7-trunk
The Buildbot has detected a restored build on builder tomcat-7-trunk while building ASF Buildbot. Full details are available at: http://ci.apache.org/builders/tomcat-7-trunk/builds/204 Buildbot URL: http://ci.apache.org/ Buildslave for this Build: bb-vm_ubuntu Build Reason: scheduler Build Source Stamp: [branch tomcat/tc7.0.x/trunk] 1616465 Blamelist: markt Build succeeded! sincerely, -The Buildbot - To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org For additional commands, e-mail: dev-h...@tomcat.apache.org
[Bug 55943] Provide a way prevent looking at the System classloader before the webapp classloaders
https://issues.apache.org/bugzilla/show_bug.cgi?id=55943 Christopher Schultz changed: What|Removed |Added Status|RESOLVED|REOPENED Resolution|WORKSFORME |--- -- You are receiving this mail because: You are the assignee for the bug. - To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org For additional commands, e-mail: dev-h...@tomcat.apache.org
[Bug 56825] New: AuthenticatorBase not looking for Coyote Request certificate
https://issues.apache.org/bugzilla/show_bug.cgi?id=56825 Bug ID: 56825 Summary: AuthenticatorBase not looking for Coyote Request certificate Product: Tomcat 7 Version: trunk Hardware: PC Status: NEW Severity: normal Priority: P2 Component: Catalina Assignee: dev@tomcat.apache.org Reporter: jlmonte...@tomitribe.com When using Tomcat SSL coyote connector, the request does not by default contain the certificate chain under the key javax.servlet.request.X509Certificate The following coyote action must be invoked in order to extract the certificate chain and enrich the request under the right key. This makes it impossible to use the SSLAuthenticator with preemptive mode for example. Provided a test to reproduce and the fix within the patch file. I tried to follow Tomcat guidelines and coding rules. If not lemme know so that I can resubmit a new patch. Not tested under Tomcat 6 and 8 but, the AuthenticatorBase does not change a lot over versions so I guess the bug existed before Tomcat 7 and still exists in Tomcat 8. -- You are receiving this mail because: You are the assignee for the bug. - To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org For additional commands, e-mail: dev-h...@tomcat.apache.org
[Bug 56825] AuthenticatorBase not looking for Coyote Request certificate
https://issues.apache.org/bugzilla/show_bug.cgi?id=56825 jlmonteiro changed: What|Removed |Added OS||All -- You are receiving this mail because: You are the assignee for the bug. - To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org For additional commands, e-mail: dev-h...@tomcat.apache.org
[Bug 56825] AuthenticatorBase not looking for Coyote Request certificate
https://issues.apache.org/bugzilla/show_bug.cgi?id=56825 --- Comment #1 from jlmonteiro --- Created attachment 31885 --> https://issues.apache.org/bugzilla/attachment.cgi?id=31885&action=edit Patch with the test to reproduce and a fix -- You are receiving this mail because: You are the assignee for the bug. - To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org For additional commands, e-mail: dev-h...@tomcat.apache.org
[Bug 56826] New: https connector failing to initialise when using apr/native library
https://issues.apache.org/bugzilla/show_bug.cgi?id=56826 Bug ID: 56826 Summary: https connector failing to initialise when using apr/native library Product: Tomcat 7 Version: 7.0.55 Hardware: PC OS: Linux Status: NEW Severity: normal Priority: P2 Component: Connectors Assignee: dev@tomcat.apache.org Reporter: p.d.a...@btinternet.com Created attachment 31886 --> https://issues.apache.org/bugzilla/attachment.cgi?id=31886&action=edit tomcat 8.0.9 server.xml When using the https connector on tomcat 7.0.53+ and tomcat 8.0.9 with Native library installed the connector is failing to start. I have tested on 7.0.52 and all is working as expected. Tomcat: binary install from http://tomcat.apache.org/download-80.cgi OS: CentOS 5.10 & CentOS 6.5 JDK: jdk-1.7.0_67-fcs -- You are receiving this mail because: You are the assignee for the bug. - To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org For additional commands, e-mail: dev-h...@tomcat.apache.org
[Bug 56826] https connector failing to initialise when using apr/native library
https://issues.apache.org/bugzilla/show_bug.cgi?id=56826 --- Comment #1 from Paul Abel --- Created attachment 31887 --> https://issues.apache.org/bugzilla/attachment.cgi?id=31887&action=edit tomcat 8.0.9 catalina.out -- You are receiving this mail because: You are the assignee for the bug. - To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org For additional commands, e-mail: dev-h...@tomcat.apache.org
[Bug 56826] https connector failing to initialise when using apr/native library
https://issues.apache.org/bugzilla/show_bug.cgi?id=56826 Chuck Caldarale changed: What|Removed |Added Status|NEW |RESOLVED Resolution|--- |INVALID --- Comment #2 from Chuck Caldarale --- You have explicitly specified use of the NIO connector, not APR. If you want APR, either leave the default protocol setting as is, or specify org.apache.coyote.http11.Http11AprProtocol. Note that bugzilla is not a support forum; you should have posted your issue on the Tomcat users' mailing list before cluttering up the bug data base. -- You are receiving this mail because: You are the assignee for the bug. - To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org For additional commands, e-mail: dev-h...@tomcat.apache.org
[Bug 56739] Error response body generated only occasionally
https://issues.apache.org/bugzilla/show_bug.cgi?id=56739 --- Comment #5 from marko asplund --- That's great news, thanks! Almost forgot: do you think the "java.lang.IllegalStateException: Calling [asyncTimeout()] is not valid …" issue with TC 8 described on https://github.com/marko-asplund/servlet3-async is related to this? Or should I report it as a separate issue? -- You are receiving this mail because: You are the assignee for the bug. - To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org For additional commands, e-mail: dev-h...@tomcat.apache.org
[Bug 56739] Error response body generated only occasionally
https://issues.apache.org/bugzilla/show_bug.cgi?id=56739 --- Comment #6 from Mark Thomas --- (In reply to marko asplund from comment #5) > That's great news, thanks! > > Almost forgot: do you think the "java.lang.IllegalStateException: Calling > [asyncTimeout()] is not valid …" issue with TC 8 described on > https://github.com/marko-asplund/servlet3-async is related to this? > Or should I report it as a separate issue? Didn't you already report that as Bug 56736 ? -- You are receiving this mail because: You are the assignee for the bug. - To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org For additional commands, e-mail: dev-h...@tomcat.apache.org
[Bug 56827] New: Writer threads are getting stuck when using APR/AJP
https://issues.apache.org/bugzilla/show_bug.cgi?id=56827 Bug ID: 56827 Summary: Writer threads are getting stuck when using APR/AJP Product: Tomcat 7 Version: 7.0.55 Hardware: PC OS: Linux Status: NEW Severity: normal Priority: P2 Component: Connectors Assignee: dev@tomcat.apache.org Reporter: oxyg...@gmail.com Writer threads are getting blocked by APR/AJP implementation, this was not happening on Tomcat 7.0.54, when we upgrade we recompile the APR using the existing Tomcat and environment, for our case Ubuntu Server 12.04 LTS: Threads stuck using probe webapp: stop 252 async-streaming-executor-20 org.apache.tomcat.util.net.AprEndpoint.processSocketAsync ( AprEndpoint.java:860 ) BLOCKED false false 1821 1 stop 251 async-streaming-executor-19 org.apache.tomcat.util.net.AprEndpoint.processSocketAsync ( AprEndpoint.java:860 ) BLOCKED false false 772 1 stop 227 async-streaming-executor-4 org.apache.tomcat.util.net.AprEndpoint.processSocketAsync ( AprEndpoint.java:860 ) BLOCKED false false 2524 2 Stack trace of blocking code: org.apache.tomcat.util.net.AprEndpoint.processSocketAsync ( AprEndpoint.java:860 ) org.apache.coyote.AbstractProcessor.setErrorState ( AbstractProcessor.java:84 ) org.apache.coyote.ajp.AbstractAjpProcessor.action ( AbstractAjpProcessor.java:368 ) org.apache.coyote.Response.action ( Response.java:174 ) org.apache.coyote.Response.finish ( Response.java:274 ) org.apache.catalina.connector.OutputBuffer.close ( OutputBuffer.java:319 ) org.apache.catalina.connector.CoyoteOutputStream.close ( CoyoteOutputStream.java:108 ) org.apache.commons.io.IOUtils.closeQuietly ( IOUtils.java:303 ) org.apache.commons.io.IOUtils.closeQuietly ( IOUtils.java:274 ) com.temetra.wms.utils.filter.QueueOutputStream$1.call ( QueueOutputStream.java:93 ) com.temetra.wms.utils.filter.QueueOutputStream$1.call ( QueueOutputStream.java:79 ) java.util.concurrent.FutureTask.run ( FutureTask.java:262 ) java.util.concurrent.ThreadPoolExecutor.runWorker ( ThreadPoolExecutor.java:1145 ) java.util.concurrent.ThreadPoolExecutor$Worker.run ( ThreadPoolExecutor.java:615 ) java.lang.Thread.run ( Thread.java:745 ) -- You are receiving this mail because: You are the assignee for the bug. - To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org For additional commands, e-mail: dev-h...@tomcat.apache.org
[Bug 56827] Writer threads are getting stuck when using APR/AJP
https://issues.apache.org/bugzilla/show_bug.cgi?id=56827 Mark Thomas changed: What|Removed |Added Status|NEW |RESOLVED Resolution|--- |INVALID --- Comment #1 from Mark Thomas --- There is no evidence of a Tomcat bug in this report. Neither is there sufficient information for a Tomcat developer to reproduce the behaviour you are seeing. Please use the Tomcat users mailing list to debug this issue. If, and only if, that discussion concludes that there is a genuine bug here then re-open this issue and provide the necessary steps to reproduce using the simplest possible test case. -- You are receiving this mail because: You are the assignee for the bug. - To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org For additional commands, e-mail: dev-h...@tomcat.apache.org
svn commit: r1616510 - in /tomcat/trunk: build.properties.default build.xml java/org/apache/tomcat/buildutil/SignCode.java res/checkstyle/org-import-control.xml
Author: markt Date: Thu Aug 7 15:28:19 2014 New Revision: 1616510 URL: http://svn.apache.org/r1616510 Log: Add all the necessary plumbing to use the code signing service. This is currently pointing at the test environment. It needs to be switched to production once that service is available. Modified: tomcat/trunk/build.properties.default tomcat/trunk/build.xml tomcat/trunk/java/org/apache/tomcat/buildutil/SignCode.java tomcat/trunk/res/checkstyle/org-import-control.xml Modified: tomcat/trunk/build.properties.default URL: http://svn.apache.org/viewvc/tomcat/trunk/build.properties.default?rev=1616510&r1=1616509&r2=1616510&view=diff == --- tomcat/trunk/build.properties.default (original) +++ tomcat/trunk/build.properties.default Thu Aug 7 15:28:19 2014 @@ -48,6 +48,12 @@ test.cobertura=false # Location of GPG executable (used only for releases) gpg.exec=/path/to/gpg +# Code signing of Windows installer +do.codesigning=false +codesigning.user=request-via-pmc +codesigning.pwd=request-via-pmc +codesigning.partnercode=request-via-pmc + # - Settings to use when downloading files - trydownload.httpusecaches=true Modified: tomcat/trunk/build.xml URL: http://svn.apache.org/viewvc/tomcat/trunk/build.xml?rev=1616510&r1=1616509&r2=1616510&view=diff == --- tomcat/trunk/build.xml (original) +++ tomcat/trunk/build.xml Thu Aug 7 15:28:19 2014 @@ -2119,19 +2119,20 @@ Apache Tomcat ${version} native binaries - + - + - - - Modified: tomcat/trunk/java/org/apache/tomcat/buildutil/SignCode.java URL: http://svn.apache.org/viewvc/tomcat/trunk/java/org/apache/tomcat/buildutil/SignCode.java?rev=1616510&r1=1616509&r2=1616510&view=diff == --- tomcat/trunk/java/org/apache/tomcat/buildutil/SignCode.java (original) +++ tomcat/trunk/java/org/apache/tomcat/buildutil/SignCode.java Thu Aug 7 15:28:19 2014 @@ -16,28 +16,98 @@ */ package org.apache.tomcat.buildutil; +import java.io.ByteArrayInputStream; +import java.io.ByteArrayOutputStream; import java.io.File; +import java.io.FileInputStream; +import java.io.FileOutputStream; +import java.io.IOException; +import java.net.URL; import java.util.ArrayList; import java.util.List; +import java.util.zip.ZipEntry; +import java.util.zip.ZipInputStream; +import java.util.zip.ZipOutputStream; +import javax.xml.soap.MessageFactory; +import javax.xml.soap.SOAPBody; +import javax.xml.soap.SOAPConnection; +import javax.xml.soap.SOAPConnectionFactory; +import javax.xml.soap.SOAPConstants; +import javax.xml.soap.SOAPElement; +import javax.xml.soap.SOAPEnvelope; +import javax.xml.soap.SOAPException; +import javax.xml.soap.SOAPMessage; +import javax.xml.soap.SOAPPart; + +import org.apache.tomcat.util.codec.binary.Base64; import org.apache.tools.ant.BuildException; import org.apache.tools.ant.DirectoryScanner; import org.apache.tools.ant.Task; import org.apache.tools.ant.types.FileSet; +import org.w3c.dom.Node; +import org.w3c.dom.NodeList; /** * Ant task that submits a file to the Symantec code-signing service. */ public class SignCode extends Task { -private final List filesets = new ArrayList<>(); +private static final String NS = "cod"; + +private static final MessageFactory SOAP_MSG_FACTORY; + +static { +try { +SOAP_MSG_FACTORY = MessageFactory.newInstance(SOAPConstants.SOAP_1_1_PROTOCOL); +} catch (SOAPException e) { +throw new IllegalArgumentException(e); +} +} +private final List filesets = new ArrayList<>(); +private String userName; +private String password; +private String partnerCode; +private String applicationName; +private String applicationVersion; +private String signingService; public void addFileset(FileSet fileset) { filesets.add(fileset); } +public void setUserName(String userName) { +this.userName = userName; +} + + +public void setPassword(String password) { +this.password = password; +} + + +public void setPartnerCode(String partnerCode) { +this.partnerCode = partnerCode; +} + + +public void setApplicationName(String applicationName) { +this.applicationName = applicationName; +} + + +public void setApplicationVersion(String applicationVersion) { +this.applicationVersion = applicationVersion; +} + + +public void setSigningService(String signingService) { +this.signingService = signingService; +} + + @Override public void execute() throws BuildException { @@ -53,7 +123,236 @@ public class SignCode extends Task { for (int i = 0; i < files.length; i++) {
[Bug 56739] Error response body generated only occasionally
https://issues.apache.org/bugzilla/show_bug.cgi?id=56739 --- Comment #7 from marko asplund --- yeah, so it seems :-) sorry about the confusion. -- You are receiving this mail because: You are the assignee for the bug. - To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org For additional commands, e-mail: dev-h...@tomcat.apache.org
svn commit: r1616562 - /tomcat/trunk/test/org/apache/catalina/valves/TestRemoteIpValve.java
Author: fhanik Date: Thu Aug 7 18:31:49 2014 New Revision: 1616562 URL: http://svn.apache.org/r1616562 Log: Add in test for different possible configurations using the RemoteIpValve More complex expressions like 172/12 can be supported Modified: tomcat/trunk/test/org/apache/catalina/valves/TestRemoteIpValve.java Modified: tomcat/trunk/test/org/apache/catalina/valves/TestRemoteIpValve.java URL: http://svn.apache.org/viewvc/tomcat/trunk/test/org/apache/catalina/valves/TestRemoteIpValve.java?rev=1616562&r1=1616561&r2=1616562&view=diff == --- tomcat/trunk/test/org/apache/catalina/valves/TestRemoteIpValve.java (original) +++ tomcat/trunk/test/org/apache/catalina/valves/TestRemoteIpValve.java Thu Aug 7 18:31:49 2014 @@ -319,6 +319,85 @@ public class TestRemoteIpValve { } @Test +public void test172dash12InternalProxies() throws Exception { + +// PREPARE +RemoteIpValve remoteIpValve = new RemoteIpValve(); + remoteIpValve.setInternalProxies("172\\.1[6-9]{1}\\.\\d{1,3}\\.\\d{1,3}|172\\.2[0-9]{1}\\.\\d{1,3}\\.\\d{1,3}|172\\.3[0-1]{1}\\.\\d{1,3}\\.\\d{1,3}"); +remoteIpValve.setRemoteIpHeader("x-forwarded-for"); +remoteIpValve.setProtocolHeader("x-forwarded-proto"); +RemoteAddrAndHostTrackerValve remoteAddrAndHostTrackerValve = new RemoteAddrAndHostTrackerValve(); +remoteIpValve.setNext(remoteAddrAndHostTrackerValve); + +Request request = new MockRequest(); +request.setCoyoteRequest(new org.apache.coyote.Request()); +request.setRemoteAddr("172.16.0.5"); +request.setRemoteHost("remote-host-original-value"); + request.getCoyoteRequest().getMimeHeaders().addValue("x-forwarded-for").setString("209.244.0.3"); + request.getCoyoteRequest().getMimeHeaders().addValue("x-forwarded-proto").setString("https"); + +// TEST +remoteIpValve.invoke(request, null); + +// VERIFY +String actualXForwardedFor = request.getHeader("x-forwarded-for"); +assertNull("all proxies are trusted, x-forwarded-for must be null", actualXForwardedFor); + +String actualRemoteAddr = remoteAddrAndHostTrackerValve.getRemoteAddr(); +assertEquals("remoteAddr", "209.244.0.3", actualRemoteAddr); + +String actualRemoteHost = remoteAddrAndHostTrackerValve.getRemoteHost(); +assertEquals("remoteHost", "209.244.0.3", actualRemoteHost); + +String actualPostInvokeRemoteAddr = remoteAddrAndHostTrackerValve.getRemoteAddr(); +assertEquals("postInvoke remoteAddr", "209.244.0.3", actualPostInvokeRemoteAddr); + +String actualPostInvokeRemoteHost = request.getRemoteHost(); +assertEquals("postInvoke remoteAddr", "remote-host-original-value", actualPostInvokeRemoteHost); + +boolean isSecure = remoteAddrAndHostTrackerValve.isSecure(); +assertTrue("request from internal proxy should be marked secure", isSecure); + +String scheme = remoteAddrAndHostTrackerValve.getScheme(); +assertEquals("Scheme should be marked to https.","https",scheme); + +request = new MockRequest(); +request.setCoyoteRequest(new org.apache.coyote.Request()); +request.setRemoteAddr("172.25.250.250"); +request.setRemoteHost("remote-host-original-value"); + request.getCoyoteRequest().getMimeHeaders().addValue("x-forwarded-for").setString("209.244.0.3"); + request.getCoyoteRequest().getMimeHeaders().addValue("x-forwarded-proto").setString("https"); + +// TEST +remoteIpValve.invoke(request, null); + +// VERIFY +actualXForwardedFor = request.getHeader("x-forwarded-for"); +assertNull("all proxies are trusted, x-forwarded-for must be null", actualXForwardedFor); + +actualRemoteAddr = remoteAddrAndHostTrackerValve.getRemoteAddr(); +assertEquals("remoteAddr", "209.244.0.3", actualRemoteAddr); + +actualRemoteHost = remoteAddrAndHostTrackerValve.getRemoteHost(); +assertEquals("remoteHost", "209.244.0.3", actualRemoteHost); + +actualPostInvokeRemoteAddr = remoteAddrAndHostTrackerValve.getRemoteAddr(); +assertEquals("postInvoke remoteAddr", "209.244.0.3", actualPostInvokeRemoteAddr); + +actualPostInvokeRemoteHost = request.getRemoteHost(); +assertEquals("postInvoke remoteAddr", "remote-host-original-value", actualPostInvokeRemoteHost); + +isSecure = remoteAddrAndHostTrackerValve.isSecure(); +assertTrue("request from internal proxy should be marked secure", isSecure); + +scheme = remoteAddrAndHostTrackerValve.getScheme(); +assertEquals("Scheme should be marked to https.","https",scheme); + + +} + + +@Test public void testInvokeXforwardedProtoSaysHttpsForIncomingHttpRequest() throws Exception { // PREPARE ---
svn commit: r1616569 - in /tomcat/trunk/modules/jdbc-pool: build.properties.default pom.xml src/test/java/org/apache/tomcat/jdbc/test/DefaultTestCase.java
Author: fhanik Date: Thu Aug 7 19:07:21 2014 New Revision: 1616569 URL: http://svn.apache.org/r1616569 Log: Clean up dependencies and advance snapshot version Modified: tomcat/trunk/modules/jdbc-pool/build.properties.default tomcat/trunk/modules/jdbc-pool/pom.xml tomcat/trunk/modules/jdbc-pool/src/test/java/org/apache/tomcat/jdbc/test/DefaultTestCase.java Modified: tomcat/trunk/modules/jdbc-pool/build.properties.default URL: http://svn.apache.org/viewvc/tomcat/trunk/modules/jdbc-pool/build.properties.default?rev=1616569&r1=1616568&r2=1616569&view=diff == --- tomcat/trunk/modules/jdbc-pool/build.properties.default (original) +++ tomcat/trunk/modules/jdbc-pool/build.properties.default Thu Aug 7 19:07:21 2014 @@ -75,23 +75,15 @@ hamcrest.home=${base.path}/hamcrest-${ha hamcrest.jar=${hamcrest.home}/hamcrest-core-${hamcrest.version}.jar hamcrest.loc=http://repo.maven.apache.org/maven2/org/hamcrest/hamcrest-core/${hamcrest.version}/hamcrest-core-${hamcrest.version}.jar -c3p0.home=${base.path}/c3p0-0.9.1.2 -c3p0.jar=${c3p0.home}/lib/c3p0-0.9.1.2.jar -c3p0.loc=http://superb-east.dl.sourceforge.net/sourceforge/c3p0/c3p0-0.9.1.2.bin.zip - mysql.home=${base.path}/mysql-connector-java-5.1.12 mysql.jar=${mysql.home}/mysql-connector-java-5.1.12-bin.jar mysql.loc=http://mysql.mirrors.hoobly.com/Downloads/Connector-J/mysql-connector-java-5.1.12.zip -dbcp.home=${base.path}/commons-dbcp-1.3 -dbcp.jar=${dbcp.home}/commons-dbcp-1.3.jar -dbcp.loc=http://archive.apache.org/dist/commons/dbcp/binaries/commons-dbcp-1.3.zip - -tomcat.version=6.0.32 +tomcat.version=8.0.9 tomcat.home=${base.path}/apache-tomcat-${tomcat.version} tomcat.dbcp.jar=${tomcat.home}/lib/tomcat-dbcp.jar tomcat.juli.jar=${tomcat.home}/bin/tomcat-juli.jar -tomcat.loc=http://archive.apache.org/dist/tomcat/tomcat-6/v${tomcat.version}/bin/apache-tomcat-${tomcat.version}.zip +tomcat.loc=http://archive.apache.org/dist/tomcat/tomcat-8/v${tomcat.version}/bin/apache-tomcat-${tomcat.version}.zip tomcat.project.loc=http://svn.apache.org/repos/asf/tomcat/trunk/webapps/docs/project.xml tomcat.project.dest=${base.path}/project.xml Modified: tomcat/trunk/modules/jdbc-pool/pom.xml URL: http://svn.apache.org/viewvc/tomcat/trunk/modules/jdbc-pool/pom.xml?rev=1616569&r1=1616568&r2=1616569&view=diff == --- tomcat/trunk/modules/jdbc-pool/pom.xml (original) +++ tomcat/trunk/modules/jdbc-pool/pom.xml Thu Aug 7 19:07:21 2014 @@ -27,7 +27,7 @@ org.apache.tomcat jdbc-pool - 1.2-SNAPSHOT + 1.3-SNAPSHOT jar jdbc-pool @@ -72,8 +72,8 @@ org.apache.tomcat - dbcp - 6.0.32 + tomcat-dbcp + 8.0.9 test Modified: tomcat/trunk/modules/jdbc-pool/src/test/java/org/apache/tomcat/jdbc/test/DefaultTestCase.java URL: http://svn.apache.org/viewvc/tomcat/trunk/modules/jdbc-pool/src/test/java/org/apache/tomcat/jdbc/test/DefaultTestCase.java?rev=1616569&r1=1616568&r2=1616569&view=diff == --- tomcat/trunk/modules/jdbc-pool/src/test/java/org/apache/tomcat/jdbc/test/DefaultTestCase.java (original) +++ tomcat/trunk/modules/jdbc-pool/src/test/java/org/apache/tomcat/jdbc/test/DefaultTestCase.java Thu Aug 7 19:07:21 2014 @@ -24,16 +24,11 @@ import java.util.Properties; import org.junit.After; import org.junit.Before; -//import org.apache.commons.dbcp2.BasicDataSource; -//import org.apache.commons.dbcp2.BasicDataSourceFactory; import org.apache.tomcat.dbcp.dbcp2.BasicDataSource; import org.apache.tomcat.dbcp.dbcp2.BasicDataSourceFactory; import org.apache.tomcat.jdbc.pool.PoolConfiguration; import org.apache.tomcat.jdbc.pool.PoolProperties; -//import com.mchange.v2.c3p0.ComboPooledDataSource; -//import com.mchange.v2.log.MLevel; -//import com.mchange.v2.log.MLog; /** * @version 1.0 - To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org For additional commands, e-mail: dev-h...@tomcat.apache.org
svn commit: r1616570 - in /tomcat/trunk/modules/jdbc-pool: doc/jdbc-pool.xml src/main/java/org/apache/tomcat/jdbc/pool/interceptor/SlowQueryReport.java
Author: fhanik Date: Thu Aug 7 19:20:00 2014 New Revision: 1616570 URL: http://svn.apache.org/r1616570 Log: Fix https://issues.apache.org/bugzilla/show_bug.cgi?id=53200 Enable selective logging of slow/failed queries Modified: tomcat/trunk/modules/jdbc-pool/doc/jdbc-pool.xml tomcat/trunk/modules/jdbc-pool/src/main/java/org/apache/tomcat/jdbc/pool/interceptor/SlowQueryReport.java Modified: tomcat/trunk/modules/jdbc-pool/doc/jdbc-pool.xml URL: http://svn.apache.org/viewvc/tomcat/trunk/modules/jdbc-pool/doc/jdbc-pool.xml?rev=1616570&r1=1616569&r2=1616570&view=diff == --- tomcat/trunk/modules/jdbc-pool/doc/jdbc-pool.xml (original) +++ tomcat/trunk/modules/jdbc-pool/doc/jdbc-pool.xml Thu Aug 7 19:20:00 2014 @@ -658,6 +658,16 @@ The default value is 1000. + +(boolean as String) Set to true if you wish to log slow queries +The default value is true. + + + +(boolean as String) Set to true if you wish to log slow queries +The default value is true. + + Modified: tomcat/trunk/modules/jdbc-pool/src/main/java/org/apache/tomcat/jdbc/pool/interceptor/SlowQueryReport.java URL: http://svn.apache.org/viewvc/tomcat/trunk/modules/jdbc-pool/src/main/java/org/apache/tomcat/jdbc/pool/interceptor/SlowQueryReport.java?rev=1616570&r1=1616569&r2=1616570&view=diff == --- tomcat/trunk/modules/jdbc-pool/src/main/java/org/apache/tomcat/jdbc/pool/interceptor/SlowQueryReport.java (original) +++ tomcat/trunk/modules/jdbc-pool/src/main/java/org/apache/tomcat/jdbc/pool/interceptor/SlowQueryReport.java Thu Aug 7 19:20:00 2014 @@ -58,6 +58,16 @@ public class SlowQueryReport extends Abs protected int maxQueries= 1000; //don't store more than this amount of queries /** + * Flag to enable disable logging of slow queries + */ +protected boolean logSlow = true; + +/** + * Flag to enable disable logging of failed queries + */ +protected boolean logFailed = true; + +/** * Returns the query stats for a given pool * @param poolname - the name of the pool we want to retrieve stats for * @return a hash map containing statistics for 0 to maxQueries @@ -86,7 +96,7 @@ public class SlowQueryReport extends Abs long delta = now - start; QueryStats qs = this.getQueryStats(sql); qs.failure(delta, now); -if (log.isWarnEnabled()) { +if (isLogFailed() && log.isWarnEnabled()) { log.warn("Failed Query Report SQL="+sql+"; time="+delta+" ms;"); } } @@ -99,7 +109,7 @@ public class SlowQueryReport extends Abs if (this.maxQueries > 0 ) { QueryStats qs = this.getQueryStats(sql); qs.add(delta, start); -if (log.isWarnEnabled()) { +if (isLogSlow() && log.isWarnEnabled()) { log.warn("Slow Query Report SQL="+sql+"; time="+delta+" ms;"); } } @@ -199,19 +209,45 @@ public class SlowQueryReport extends Abs } +public boolean isLogSlow() { +return logSlow; +} + +public void setLogSlow(boolean logSlow) { +this.logSlow = logSlow; +} + +public boolean isLogFailed() { +return logFailed; +} + +public void setLogFailed(boolean logFailed) { +this.logFailed = logFailed; +} + @Override public void setProperties(Map properties) { super.setProperties(properties); final String threshold = "threshold"; final String maxqueries= "maxQueries"; +final String logslow = "logSlow"; +final String logfailed = "logFailed"; InterceptorProperty p1 = properties.get(threshold); InterceptorProperty p2 = properties.get(maxqueries); +InterceptorProperty p3 = properties.get(logSlow); +InterceptorProperty p4 = properties.get(logfailed); if (p1!=null) { setThreshold(Long.parseLong(p1.getValue())); } if (p2!=null) { setMaxQueries(Integer.parseInt(p2.getValue())); } +if (p3!=null) { +setLogSlow(Boolean.getBoolean(p3.getValue())); +} +if (p4!=null) { +setLogFailed(Boolean.getBoolean(p4.getValue())); +} } - To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org For additional commands, e-mail: dev-h...@tomcat.apache.org
[Bug 53200] Be able to use SlowQueryReport without reporting failed queries
https://issues.apache.org/bugzilla/show_bug.cgi?id=53200 Filip Hanik changed: What|Removed |Added Status|NEW |RESOLVED Resolution|--- |FIXED --- Comment #1 from Filip Hanik --- Fixed in r161657 -- You are receiving this mail because: You are the assignee for the bug. - To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org For additional commands, e-mail: dev-h...@tomcat.apache.org
[Bug 53200] Be able to use SlowQueryReport without reporting failed queries
https://issues.apache.org/bugzilla/show_bug.cgi?id=53200 --- Comment #2 from Filip Hanik --- Fixed in r1616570 -- You are receiving this mail because: You are the assignee for the bug. - To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org For additional commands, e-mail: dev-h...@tomcat.apache.org
[Bug 53770] tomcat-pool: always log validation query syntax errors
https://issues.apache.org/bugzilla/show_bug.cgi?id=53770 Filip Hanik changed: What|Removed |Added Status|NEW |RESOLVED Resolution|--- |WONTFIX --- Comment #1 from Filip Hanik --- Marking as wontfix. I don't have a list of the SQL error codes for a syntax error. The logValidationErrors property is put in place to trap and log these errors. validation queries generally are so simple, and a tool, an admin or a developer would validate his/her validation query first. please reopen if you feel strongly about this, and kindly supply list of error codes for different databases. -- You are receiving this mail because: You are the assignee for the bug. - To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org For additional commands, e-mail: dev-h...@tomcat.apache.org
svn commit: r1616584 - in /tomcat/trunk/modules/jdbc-pool: doc/ src/main/java/org/apache/tomcat/jdbc/naming/ src/main/java/org/apache/tomcat/jdbc/pool/
Author: fhanik Date: Thu Aug 7 20:15:19 2014 New Revision: 1616584 URL: http://svn.apache.org/r1616584 Log: Fix https://issues.apache.org/bugzilla/show_bug.cgi?id=53853 Dynamic class loading of driver, validator and interceptors can be done from libraries on the context class loader. Behavior is partly backwards compatible, always try the current loader first, but then attempts the current thread's context class loader Added: tomcat/trunk/modules/jdbc-pool/src/main/java/org/apache/tomcat/jdbc/pool/ClassLoaderUtil.java (with props) Modified: tomcat/trunk/modules/jdbc-pool/doc/jdbc-pool.xml tomcat/trunk/modules/jdbc-pool/src/main/java/org/apache/tomcat/jdbc/naming/GenericNamingResourcesFactory.java tomcat/trunk/modules/jdbc-pool/src/main/java/org/apache/tomcat/jdbc/pool/PoolProperties.java tomcat/trunk/modules/jdbc-pool/src/main/java/org/apache/tomcat/jdbc/pool/PooledConnection.java Modified: tomcat/trunk/modules/jdbc-pool/doc/jdbc-pool.xml URL: http://svn.apache.org/viewvc/tomcat/trunk/modules/jdbc-pool/doc/jdbc-pool.xml?rev=1616584&r1=1616583&r2=1616584&view=diff == --- tomcat/trunk/modules/jdbc-pool/doc/jdbc-pool.xml (original) +++ tomcat/trunk/modules/jdbc-pool/doc/jdbc-pool.xml Thu Aug 7 20:15:19 2014 @@ -170,6 +170,22 @@ + + +System properties are JVM wide, affect all pools created in the JVM + + +(boolean) Controls classloading of dynamic classes, such as + jdbc drivers, interceptors and validators. If set to false, default value, + the pool will first attempt to load using the current loader and if class loading fails + attempt to load using the thread context loader. + Set this value to try, if you wish to remain backwards compatible, + Apache Tomcat 8.0.8 and earlier, and only attempt the current loader. + If not set then the default value is false.) + + + + These attributes are shared between commons-dbcp and tomcat-jdbc-pool, in some cases default values are different. Modified: tomcat/trunk/modules/jdbc-pool/src/main/java/org/apache/tomcat/jdbc/naming/GenericNamingResourcesFactory.java URL: http://svn.apache.org/viewvc/tomcat/trunk/modules/jdbc-pool/src/main/java/org/apache/tomcat/jdbc/naming/GenericNamingResourcesFactory.java?rev=1616584&r1=1616583&r2=1616584&view=diff == --- tomcat/trunk/modules/jdbc-pool/src/main/java/org/apache/tomcat/jdbc/naming/GenericNamingResourcesFactory.java (original) +++ tomcat/trunk/modules/jdbc-pool/src/main/java/org/apache/tomcat/jdbc/naming/GenericNamingResourcesFactory.java Thu Aug 7 20:15:19 2014 @@ -31,6 +31,8 @@ import javax.naming.spi.ObjectFactory; import org.apache.juli.logging.Log; import org.apache.juli.logging.LogFactory; +import org.apache.tomcat.jdbc.pool.ClassLoaderUtil; + /** * Simple way of configuring generic resources by using reflection. * Example usage: @@ -57,7 +59,12 @@ public class GenericNamingResourcesFacto Enumeration refs = ref.getAll(); String type = ref.getClassName(); -Object o = Class.forName(type).newInstance(); +Object o = +ClassLoaderUtil.loadClass( +type, +GenericNamingResourcesFactory.class.getClassLoader(), +Thread.currentThread().getContextClassLoader()) +.newInstance(); while (refs.hasMoreElements()) { RefAddr addr = refs.nextElement(); Added: tomcat/trunk/modules/jdbc-pool/src/main/java/org/apache/tomcat/jdbc/pool/ClassLoaderUtil.java URL: http://svn.apache.org/viewvc/tomcat/trunk/modules/jdbc-pool/src/main/java/org/apache/tomcat/jdbc/pool/ClassLoaderUtil.java?rev=1616584&view=auto == --- tomcat/trunk/modules/jdbc-pool/src/main/java/org/apache/tomcat/jdbc/pool/ClassLoaderUtil.java (added) +++ tomcat/trunk/modules/jdbc-pool/src/main/java/org/apache/tomcat/jdbc/pool/ClassLoaderUtil.java Thu Aug 7 20:15:19 2014 @@ -0,0 +1,61 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing
[Bug 53853] Can tomcat-jdbc consider Thread#getContextClassLoader() for interceptors & JDBC drivers please?
https://issues.apache.org/bugzilla/show_bug.cgi?id=53853 Filip Hanik changed: What|Removed |Added Status|NEW |RESOLVED Resolution|--- |FIXED --- Comment #2 from Filip Hanik --- Fixed in r1616584 -- You are receiving this mail because: You are the assignee for the bug. - To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org For additional commands, e-mail: dev-h...@tomcat.apache.org
[Bug 54225] if initSQL property is set to an empty string a NullPointerException is thrown by DataSource#getConnection()
https://issues.apache.org/bugzilla/show_bug.cgi?id=54225 Filip Hanik changed: What|Removed |Added Status|NEW |RESOLVED Resolution|--- |FIXED --- Comment #1 from Filip Hanik --- Fixed in r1616592 -- You are receiving this mail because: You are the assignee for the bug. - To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org For additional commands, e-mail: dev-h...@tomcat.apache.org
svn commit: r1616592 - in /tomcat/trunk/modules/jdbc-pool/src: main/java/org/apache/tomcat/jdbc/pool/PoolProperties.java test/java/org/apache/tomcat/jdbc/bugs/Bug54225.java
Author: fhanik Date: Thu Aug 7 20:31:19 2014 New Revision: 1616592 URL: http://svn.apache.org/r1616592 Log: Fix https://issues.apache.org/bugzilla/show_bug.cgi?id=54225 Don't allow empty strings as initSQL Added: tomcat/trunk/modules/jdbc-pool/src/test/java/org/apache/tomcat/jdbc/bugs/Bug54225.java (with props) Modified: tomcat/trunk/modules/jdbc-pool/src/main/java/org/apache/tomcat/jdbc/pool/PoolProperties.java Modified: tomcat/trunk/modules/jdbc-pool/src/main/java/org/apache/tomcat/jdbc/pool/PoolProperties.java URL: http://svn.apache.org/viewvc/tomcat/trunk/modules/jdbc-pool/src/main/java/org/apache/tomcat/jdbc/pool/PoolProperties.java?rev=1616592&r1=1616591&r2=1616592&view=diff == --- tomcat/trunk/modules/jdbc-pool/src/main/java/org/apache/tomcat/jdbc/pool/PoolProperties.java (original) +++ tomcat/trunk/modules/jdbc-pool/src/main/java/org/apache/tomcat/jdbc/pool/PoolProperties.java Thu Aug 7 20:31:19 2014 @@ -791,7 +791,7 @@ public class PoolProperties implements P @Override public void setInitSQL(String initSQL) { -this.initSQL = initSQL; +this.initSQL = initSQL!=null && initSQL.trim().length()>0 ? initSQL : null; } /** Added: tomcat/trunk/modules/jdbc-pool/src/test/java/org/apache/tomcat/jdbc/bugs/Bug54225.java URL: http://svn.apache.org/viewvc/tomcat/trunk/modules/jdbc-pool/src/test/java/org/apache/tomcat/jdbc/bugs/Bug54225.java?rev=1616592&view=auto == --- tomcat/trunk/modules/jdbc-pool/src/test/java/org/apache/tomcat/jdbc/bugs/Bug54225.java (added) +++ tomcat/trunk/modules/jdbc-pool/src/test/java/org/apache/tomcat/jdbc/bugs/Bug54225.java Thu Aug 7 20:31:19 2014 @@ -0,0 +1,74 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.tomcat.jdbc.bugs; + +import java.sql.Connection; +import java.sql.DriverManager; +import java.sql.SQLException; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.Collection; +import java.util.List; +import java.util.concurrent.ArrayBlockingQueue; +import java.util.concurrent.CountDownLatch; +import java.util.concurrent.atomic.AtomicInteger; + +import org.junit.Assert; +import org.junit.Test; +import org.junit.runner.RunWith; +import org.junit.runners.Parameterized; + +import org.apache.tomcat.jdbc.pool.ConnectionPool; +import org.apache.tomcat.jdbc.pool.DataSource; +import org.apache.tomcat.jdbc.pool.PoolExhaustedException; +import org.apache.tomcat.jdbc.pool.PoolProperties; +import org.apache.tomcat.jdbc.test.DefaultProperties; + +import static org.junit.Assert.assertNull; + +@RunWith(Parameterized.class) +public class Bug54225 { + +private String initSQL; + +public Bug54225(String initSQL) { +this.initSQL = initSQL; +} + +@Parameterized.Parameters +public static Collection parameters() { +return Arrays.asList(new Object[][]{ +new Object[] {""}, +new Object[] {null}, +}); +} + +@Test +public void testPool() throws SQLException, InterruptedException { +PoolProperties poolProperties = new DefaultProperties(); +poolProperties.setMinIdle(0); +poolProperties.setInitialSize(0); +poolProperties.setMaxWait(5000); +poolProperties.setRemoveAbandoned(true); +poolProperties.setRemoveAbandonedTimeout(300); +poolProperties.setRollbackOnReturn(true); +poolProperties.setInitSQL(initSQL); +final DataSource ds = new DataSource(poolProperties); +ds.getConnection().close(); +assertNull(poolProperties.getInitSQL()); +} +} \ No newline at end of file Propchange: tomcat/trunk/modules/jdbc-pool/src/test/java/org/apache/tomcat/jdbc/bugs/Bug54225.java -- svn:eol-style = native - To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org For additional commands, e-mail: dev-h...@tomcat.apache.org
[Bug 54227] maxAge should be checked on borrow
https://issues.apache.org/bugzilla/show_bug.cgi?id=54227 Filip Hanik changed: What|Removed |Added Status|NEW |RESOLVED Resolution|--- |FIXED --- Comment #1 from Filip Hanik --- Fixed in r1616594 -- You are receiving this mail because: You are the assignee for the bug. - To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org For additional commands, e-mail: dev-h...@tomcat.apache.org
svn commit: r1616594 - in /tomcat/trunk/modules/jdbc-pool/src: main/java/org/apache/tomcat/jdbc/pool/ConnectionPool.java main/java/org/apache/tomcat/jdbc/pool/PooledConnection.java test/java/org/apach
Author: fhanik Date: Thu Aug 7 21:04:11 2014 New Revision: 1616594 URL: http://svn.apache.org/r1616594 Log: Fix https://issues.apache.org/bugzilla/show_bug.cgi?id=54227 MaxAge should be honored upon borrow as well, to assure that no connection is ever used if it has been connected longer than designated time. Added: tomcat/trunk/modules/jdbc-pool/src/test/java/org/apache/tomcat/jdbc/bugs/Bug54227.java (with props) Modified: tomcat/trunk/modules/jdbc-pool/src/main/java/org/apache/tomcat/jdbc/pool/ConnectionPool.java tomcat/trunk/modules/jdbc-pool/src/main/java/org/apache/tomcat/jdbc/pool/PooledConnection.java Modified: tomcat/trunk/modules/jdbc-pool/src/main/java/org/apache/tomcat/jdbc/pool/ConnectionPool.java URL: http://svn.apache.org/viewvc/tomcat/trunk/modules/jdbc-pool/src/main/java/org/apache/tomcat/jdbc/pool/ConnectionPool.java?rev=1616594&r1=1616593&r2=1616594&view=diff == --- tomcat/trunk/modules/jdbc-pool/src/main/java/org/apache/tomcat/jdbc/pool/ConnectionPool.java (original) +++ tomcat/trunk/modules/jdbc-pool/src/main/java/org/apache/tomcat/jdbc/pool/ConnectionPool.java Thu Aug 7 21:04:11 2014 @@ -279,6 +279,10 @@ public class ConnectionPool { * @throws SQLException if an interceptor can't be configured, if the proxy can't be instantiated */ protected Connection setupConnection(PooledConnection con) throws SQLException { +//check if it's been sitting in the pool too long +if (con.isMaxAgeExpired()) { +con.reconnect(); +} //fetch previously cached interceptor proxy - one per connection JdbcInterceptor handler = con.getHandler(); if (handler==null) { @@ -862,11 +866,8 @@ public class ConnectionPool { if (isClosed()) return true; if (!con.validate(action)) return true; if (!terminateTransaction(con)) return true; -if (getPoolProperties().getMaxAge()>0 ) { -return (System.currentTimeMillis()-con.getLastConnected()) > getPoolProperties().getMaxAge(); -} else { -return false; -} +if (con.isMaxAgeExpired()) return true; +else return false; } /** Modified: tomcat/trunk/modules/jdbc-pool/src/main/java/org/apache/tomcat/jdbc/pool/PooledConnection.java URL: http://svn.apache.org/viewvc/tomcat/trunk/modules/jdbc-pool/src/main/java/org/apache/tomcat/jdbc/pool/PooledConnection.java?rev=1616594&r1=1616593&r2=1616594&view=diff == --- tomcat/trunk/modules/jdbc-pool/src/main/java/org/apache/tomcat/jdbc/pool/PooledConnection.java (original) +++ tomcat/trunk/modules/jdbc-pool/src/main/java/org/apache/tomcat/jdbc/pool/PooledConnection.java Thu Aug 7 21:04:11 2014 @@ -318,6 +318,19 @@ public class PooledConnection { } /** + * Returns true if the connection has been connected more than + * {@link PoolConfiguration#getMaxAge()} milliseconds. false otherwise. + * @return Returns true if the connection has been connected more than + * {@link PoolConfiguration#getMaxAge()} milliseconds. false otherwise. + */ +public boolean isMaxAgeExpired() { +if (getPoolProperties().getMaxAge()>0 ) { +return (System.currentTimeMillis() - getLastConnected()) > getPoolProperties().getMaxAge(); +} else { +return false; +} +} +/** * Issues a call to {@link #disconnect(boolean)} with the argument false followed by a call to * {@link #connect()} * @throws SQLException if the call to {@link #connect()} fails. Added: tomcat/trunk/modules/jdbc-pool/src/test/java/org/apache/tomcat/jdbc/bugs/Bug54227.java URL: http://svn.apache.org/viewvc/tomcat/trunk/modules/jdbc-pool/src/test/java/org/apache/tomcat/jdbc/bugs/Bug54227.java?rev=1616594&view=auto == --- tomcat/trunk/modules/jdbc-pool/src/test/java/org/apache/tomcat/jdbc/bugs/Bug54227.java (added) +++ tomcat/trunk/modules/jdbc-pool/src/test/java/org/apache/tomcat/jdbc/bugs/Bug54227.java Thu Aug 7 21:04:11 2014 @@ -0,0 +1,65 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the Lice
svn commit: r1616595 - /tomcat/trunk/modules/jdbc-pool/src/main/java/org/apache/tomcat/jdbc/pool/PoolProperties.java
Author: fhanik Date: Thu Aug 7 21:08:59 2014 New Revision: 1616595 URL: http://svn.apache.org/r1616595 Log: Fix https://issues.apache.org/bugzilla/show_bug.cgi?id=54235 Make sure misconfigurations can not happen. Modified: tomcat/trunk/modules/jdbc-pool/src/main/java/org/apache/tomcat/jdbc/pool/PoolProperties.java Modified: tomcat/trunk/modules/jdbc-pool/src/main/java/org/apache/tomcat/jdbc/pool/PoolProperties.java URL: http://svn.apache.org/viewvc/tomcat/trunk/modules/jdbc-pool/src/main/java/org/apache/tomcat/jdbc/pool/PoolProperties.java?rev=1616595&r1=1616594&r2=1616595&view=diff == --- tomcat/trunk/modules/jdbc-pool/src/main/java/org/apache/tomcat/jdbc/pool/PoolProperties.java (original) +++ tomcat/trunk/modules/jdbc-pool/src/main/java/org/apache/tomcat/jdbc/pool/PoolProperties.java Thu Aug 7 21:08:59 2014 @@ -1144,6 +1144,9 @@ public class PoolProperties implements P */ @Override public void setDataSource(Object ds) { +if (ds instanceof DataSourceProxy) { +throw new IllegalArgumentException("Layered pools are not allowed."); +} this.dataSource = ds; } - To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org For additional commands, e-mail: dev-h...@tomcat.apache.org
[Bug 54235] tomcat jdbc pool stackoverflow error used with spring
https://issues.apache.org/bugzilla/show_bug.cgi?id=54235 Filip Hanik changed: What|Removed |Added Status|NEW |RESOLVED Resolution|--- |FIXED --- Comment #3 from Filip Hanik --- This can only happen if you inject your datasource (the actual pool). So this must be a misconfiguration on the users part. Pool now prevents it through r1616595 -- You are receiving this mail because: You are the assignee for the bug. - To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org For additional commands, e-mail: dev-h...@tomcat.apache.org
buildbot success in ASF Buildbot on tomcat-trunk
The Buildbot has detected a restored build on builder tomcat-trunk while building ASF Buildbot. Full details are available at: http://ci.apache.org/builders/tomcat-trunk/builds/340 Buildbot URL: http://ci.apache.org/ Buildslave for this Build: bb-vm_ubuntu Build Reason: scheduler Build Source Stamp: [branch tomcat/trunk] 1616562 Blamelist: fhanik Build succeeded! sincerely, -The Buildbot - To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org For additional commands, e-mail: dev-h...@tomcat.apache.org
svn commit: r1616599 - in /tomcat/trunk/modules/jdbc-pool/src: main/java/org/apache/tomcat/jdbc/pool/PoolProperties.java test/java/org/apache/tomcat/jdbc/test/TestJdbcInterceptorConfigParsing.java
Author: fhanik Date: Thu Aug 7 21:32:27 2014 New Revision: 1616599 URL: http://svn.apache.org/r1616599 Log: Fix https://issues.apache.org/bugzilla/show_bug.cgi?id=54395 Fix JdbcInterceptor parsing Added: tomcat/trunk/modules/jdbc-pool/src/test/java/org/apache/tomcat/jdbc/test/TestJdbcInterceptorConfigParsing.java (with props) Modified: tomcat/trunk/modules/jdbc-pool/src/main/java/org/apache/tomcat/jdbc/pool/PoolProperties.java Modified: tomcat/trunk/modules/jdbc-pool/src/main/java/org/apache/tomcat/jdbc/pool/PoolProperties.java URL: http://svn.apache.org/viewvc/tomcat/trunk/modules/jdbc-pool/src/main/java/org/apache/tomcat/jdbc/pool/PoolProperties.java?rev=1616599&r1=1616598&r2=1616599&view=diff == --- tomcat/trunk/modules/jdbc-pool/src/main/java/org/apache/tomcat/jdbc/pool/PoolProperties.java (original) +++ tomcat/trunk/modules/jdbc-pool/src/main/java/org/apache/tomcat/jdbc/pool/PoolProperties.java Thu Aug 7 21:32:27 2014 @@ -481,7 +481,7 @@ public class PoolProperties implements P } else { String name = interceptorValues[i].substring(0,propIndex).trim(); definitions[i+1] = new InterceptorDefinition(name); -String propsAsString = interceptorValues[i].substring(propIndex+1, interceptorValues[i].length()-1); +String propsAsString = interceptorValues[i].substring(propIndex+1, endIndex); String[] props = propsAsString.split(","); for (int j=0; jhttp://svn.apache.org/viewvc/tomcat/trunk/modules/jdbc-pool/src/test/java/org/apache/tomcat/jdbc/test/TestJdbcInterceptorConfigParsing.java?rev=1616599&view=auto == --- tomcat/trunk/modules/jdbc-pool/src/test/java/org/apache/tomcat/jdbc/test/TestJdbcInterceptorConfigParsing.java (added) +++ tomcat/trunk/modules/jdbc-pool/src/test/java/org/apache/tomcat/jdbc/test/TestJdbcInterceptorConfigParsing.java Thu Aug 7 21:32:27 2014 @@ -0,0 +1,178 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.tomcat.jdbc.test; + +import org.apache.tomcat.jdbc.pool.PoolProperties; +import org.apache.tomcat.jdbc.pool.PoolProperties.InterceptorDefinition; +import org.apache.tomcat.jdbc.pool.PoolProperties.InterceptorProperty; +import org.apache.tomcat.jdbc.pool.TrapException; +import org.junit.Test; + +import java.util.Map; + +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertNotNull; +import static org.junit.Assert.fail; + +/** + * Test of JdbcInterceptor configuration parsing in the + * {@link org.apache.tomcat.jdbc.pool.PoolProperties PoolProperties} class. + * Added in context of bug 54395. + */ +public class TestJdbcInterceptorConfigParsing { + +@Test +public void testBasic() throws Exception { +String interceptorConfig = "FirstInterceptor;SecondInterceptor(parm1=value1,parm2=value2)"; +PoolProperties props = new PoolProperties(); +props.setJdbcInterceptors(interceptorConfig); +InterceptorDefinition[] interceptorDefs = props.getJdbcInterceptorsAsArray(); +assertNotNull(interceptorDefs); + +// 3 items because parser automatically inserts TrapException interceptor to front of list +assertEquals(interceptorDefs.length, 3); +assertEquals(interceptorDefs[0].getClassName(), TrapException.class.getName()); + +assertNotNull(interceptorDefs[1]); +assertEquals(interceptorDefs[1].getClassName(), "FirstInterceptor"); +assertNotNull(interceptorDefs[2]); +assertEquals(interceptorDefs[2].getClassName(), "SecondInterceptor"); + +Map secondProps = interceptorDefs[2].getProperties(); +assertNotNull(secondProps); +assertEquals(secondProps.size(), 2); +assertNotNull(secondProps.get("parm1")); +assertEquals(secondProps.get("parm1").getValue(), "value1"); +assertNotNull(secondProps.get("parm2")); +assertEquals(secondProps.get("parm2").getValue(), "value2"); +} + +@Test +public void
[Bug 54395] JdbcInterceptor config parameter parsing errors
https://issues.apache.org/bugzilla/show_bug.cgi?id=54395 Filip Hanik changed: What|Removed |Added Status|NEW |RESOLVED Resolution|--- |FIXED --- Comment #7 from Filip Hanik --- Love nothing more than receiving tests The assertions are backwards (parameters swapped), other than that looks great. org.junit.ComparisonFailure: Expected :value2 ) Actual :value2 Thanks for the report Fixed in r1616599 -- You are receiving this mail because: You are the assignee for the bug. - To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org For additional commands, e-mail: dev-h...@tomcat.apache.org
svn commit: r1616602 - in /tomcat/trunk/modules/jdbc-pool/src: main/java/org/apache/tomcat/jdbc/pool/interceptor/StatementFinalizer.java test/java/org/apache/tomcat/jdbc/test/StatementFinalizerTest.ja
Author: fhanik Date: Thu Aug 7 21:47:11 2014 New Revision: 1616602 URL: http://svn.apache.org/r1616602 Log: Fix https://issues.apache.org/bugzilla/show_bug.cgi?id=54537 Use a linked list to handle O(1) insert and remove operations. Modified: tomcat/trunk/modules/jdbc-pool/src/main/java/org/apache/tomcat/jdbc/pool/interceptor/StatementFinalizer.java tomcat/trunk/modules/jdbc-pool/src/test/java/org/apache/tomcat/jdbc/test/StatementFinalizerTest.java Modified: tomcat/trunk/modules/jdbc-pool/src/main/java/org/apache/tomcat/jdbc/pool/interceptor/StatementFinalizer.java URL: http://svn.apache.org/viewvc/tomcat/trunk/modules/jdbc-pool/src/main/java/org/apache/tomcat/jdbc/pool/interceptor/StatementFinalizer.java?rev=1616602&r1=1616601&r2=1616602&view=diff == --- tomcat/trunk/modules/jdbc-pool/src/main/java/org/apache/tomcat/jdbc/pool/interceptor/StatementFinalizer.java (original) +++ tomcat/trunk/modules/jdbc-pool/src/main/java/org/apache/tomcat/jdbc/pool/interceptor/StatementFinalizer.java Thu Aug 7 21:47:11 2014 @@ -16,15 +16,16 @@ */ package org.apache.tomcat.jdbc.pool.interceptor; -import java.lang.ref.WeakReference; -import java.lang.reflect.Method; -import java.sql.Statement; -import java.util.ArrayList; - import org.apache.juli.logging.Log; import org.apache.juli.logging.LogFactory; import org.apache.tomcat.jdbc.pool.ConnectionPool; import org.apache.tomcat.jdbc.pool.PooledConnection; + +import java.lang.ref.WeakReference; +import java.lang.reflect.Method; +import java.sql.Statement; +import java.util.LinkedList; +import java.util.List; /** * Keeps track of statements associated with a connection and invokes close upon {@link java.sql.Connection#close()} * Useful for applications that dont close the associated statements after being done with a connection. @@ -33,7 +34,7 @@ import org.apache.tomcat.jdbc.pool.Poole public class StatementFinalizer extends AbstractCreateStatementInterceptor { private static final Log log = LogFactory.getLog(StatementFinalizer.class); -protected ArrayList> statements = new ArrayList<>(); +protected List> statements = new LinkedList<>(); @Override public Object createStatement(Object proxy, Method method, Object[] args, Object statement, long time) { Modified: tomcat/trunk/modules/jdbc-pool/src/test/java/org/apache/tomcat/jdbc/test/StatementFinalizerTest.java URL: http://svn.apache.org/viewvc/tomcat/trunk/modules/jdbc-pool/src/test/java/org/apache/tomcat/jdbc/test/StatementFinalizerTest.java?rev=1616602&r1=1616601&r2=1616602&view=diff == --- tomcat/trunk/modules/jdbc-pool/src/test/java/org/apache/tomcat/jdbc/test/StatementFinalizerTest.java (original) +++ tomcat/trunk/modules/jdbc-pool/src/test/java/org/apache/tomcat/jdbc/test/StatementFinalizerTest.java Thu Aug 7 21:47:11 2014 @@ -35,4 +35,22 @@ public class StatementFinalizerTest exte con.close(); Assert.assertTrue("Statement should be closed.",st.isClosed()); } + + +@Test +public void testStatementFinalizationForMultiple() throws Exception { +datasource.setJdbcInterceptors(StatementFinalizer.class.getName()); +Connection con = datasource.getConnection(); +Statement[] statements = new Statement[1000]; +for (int i = 0; i < statements.length; i++) { +statements[i] = con.createStatement(); +} +for (Statement st : statements) { +Assert.assertFalse("Statement should not be closed.", st.isClosed()); +} +con.close(); +for (Statement st : statements) { +Assert.assertTrue("Statement should be closed.", st.isClosed()); +} +} } - To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org For additional commands, e-mail: dev-h...@tomcat.apache.org
[Bug 54537] StatementFinalizer closeInvoked is too slow for large batch jobs.
https://issues.apache.org/bugzilla/show_bug.cgi?id=54537 Filip Hanik changed: What|Removed |Added Status|NEW |RESOLVED Resolution|--- |FIXED --- Comment #2 from Filip Hanik --- Fixed in r1616602 -- You are receiving this mail because: You are the assignee for the bug. - To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org For additional commands, e-mail: dev-h...@tomcat.apache.org
[Bug 54929] jdbc-pool cannot be used with Java 1.5, "java.lang.NoClassDefFoundError: java/sql/SQLFeatureNotSupportedException"
https://issues.apache.org/bugzilla/show_bug.cgi?id=54929 Filip Hanik changed: What|Removed |Added Status|NEW |NEEDINFO --- Comment #2 from Filip Hanik --- I'm considering closing the development of jdbc-pool on the Tomcat 7 branch. and just continue on Tomcat 8, at which point I do believe Java 6 should be the minimum required. Is this still an issue? Anyone still using Java 1.5 out there? -- You are receiving this mail because: You are the assignee for the bug. - To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org For additional commands, e-mail: dev-h...@tomcat.apache.org
svn commit: r1616625 - in /tomcat/trunk/modules/jdbc-pool/src: main/java/org/apache/tomcat/jdbc/pool/ConnectionPool.java test/java/org/apache/tomcat/jdbc/bugs/Bug54978.java
Author: fhanik Date: Thu Aug 7 23:16:14 2014 New Revision: 1616625 URL: http://svn.apache.org/r1616625 Log: Fixed validation when testOnConnect=false. In this case, we need to verify, do we have an init query, if so, do an init validation, otherwise do a borrow validation. Added: tomcat/trunk/modules/jdbc-pool/src/test/java/org/apache/tomcat/jdbc/bugs/Bug54978.java (with props) Modified: tomcat/trunk/modules/jdbc-pool/src/main/java/org/apache/tomcat/jdbc/pool/ConnectionPool.java Modified: tomcat/trunk/modules/jdbc-pool/src/main/java/org/apache/tomcat/jdbc/pool/ConnectionPool.java URL: http://svn.apache.org/viewvc/tomcat/trunk/modules/jdbc-pool/src/main/java/org/apache/tomcat/jdbc/pool/ConnectionPool.java?rev=1616625&r1=1616624&r2=1616625&view=diff == --- tomcat/trunk/modules/jdbc-pool/src/main/java/org/apache/tomcat/jdbc/pool/ConnectionPool.java (original) +++ tomcat/trunk/modules/jdbc-pool/src/main/java/org/apache/tomcat/jdbc/pool/ConnectionPool.java Thu Aug 7 23:16:14 2014 @@ -794,7 +794,11 @@ public class ConnectionPool { //the connection shouldn't have to poll again. try { con.reconnect(); -if (con.validate(PooledConnection.VALIDATE_INIT)) { +int validationMode = getPoolProperties().isTestOnConnect() || getPoolProperties().getInitSQL()!=null ? +PooledConnection.VALIDATE_INIT : +PooledConnection.VALIDATE_BORROW; + +if (con.validate(validationMode)) { //set the timestamp con.setTimestamp(now); if (getPoolProperties().isLogAbandoned()) { Added: tomcat/trunk/modules/jdbc-pool/src/test/java/org/apache/tomcat/jdbc/bugs/Bug54978.java URL: http://svn.apache.org/viewvc/tomcat/trunk/modules/jdbc-pool/src/test/java/org/apache/tomcat/jdbc/bugs/Bug54978.java?rev=1616625&view=auto == --- tomcat/trunk/modules/jdbc-pool/src/test/java/org/apache/tomcat/jdbc/bugs/Bug54978.java (added) +++ tomcat/trunk/modules/jdbc-pool/src/test/java/org/apache/tomcat/jdbc/bugs/Bug54978.java Thu Aug 7 23:16:14 2014 @@ -0,0 +1,66 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.tomcat.jdbc.bugs; + +import org.apache.tomcat.jdbc.pool.DataSource; +import org.apache.tomcat.jdbc.pool.PoolProperties; +import org.apache.tomcat.jdbc.test.DefaultProperties; +import org.junit.Test; + +import java.sql.SQLException; + +import static org.junit.Assert.fail; + +public class Bug54978 { + +@Test +public void testIllegalValidationQuery() throws SQLException, InterruptedException { +PoolProperties poolProperties = new DefaultProperties(); +poolProperties.setMinIdle(0); +poolProperties.setInitialSize(1); +poolProperties.setMaxActive(1); +poolProperties.setMaxWait(5000); +poolProperties.setMaxAge(100); +poolProperties.setRemoveAbandoned(false); +poolProperties.setTestOnBorrow(true); +poolProperties.setTestOnConnect(false); +poolProperties.setValidationQuery("sdadsada"); +final DataSource ds = new DataSource(poolProperties); +try { +ds.getConnection().close(); +fail("Validation should have failed."); +}catch (SQLException x) { +} +} + +@Test +public void testIllegalValidationQueryWithLegalInit() throws SQLException, InterruptedException { +PoolProperties poolProperties = new DefaultProperties(); +poolProperties.setMinIdle(0); +poolProperties.setInitialSize(1); +poolProperties.setMaxActive(1); +poolProperties.setMaxWait(5000); +poolProperties.setMaxAge(100); +poolProperties.setRemoveAbandoned(false); +poolProperties.setTestOnBorrow(true); +poolProperties.setTestOnConnect(false); +poolProperties.setValidationQuery("sdadsada"); +poolProperties.setInitSQL("SELECT 1"); +final DataSource ds = new DataSource(poolProperties); +ds.getConnecti
[Bug 54978] Validate on Borrow should be tested on Reconnect instead of Validate On Connect
https://issues.apache.org/bugzilla/show_bug.cgi?id=54978 Filip Hanik changed: What|Removed |Added Status|NEW |RESOLVED Resolution|--- |FIXED --- Comment #2 from Filip Hanik --- Thank you for the report, tricky indeed. Fixed in r1616625 -- You are receiving this mail because: You are the assignee for the bug. - To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org For additional commands, e-mail: dev-h...@tomcat.apache.org
[Bug 53853] Can tomcat-jdbc consider Thread#getContextClassLoader() for interceptors & JDBC drivers please?
https://issues.apache.org/bugzilla/show_bug.cgi?id=53853 Filip Hanik changed: What|Removed |Added CC||david.blev...@gmail.com --- Comment #3 from Filip Hanik --- *** Bug 55444 has been marked as a duplicate of this bug. *** -- You are receiving this mail because: You are the assignee for the bug. - To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org For additional commands, e-mail: dev-h...@tomcat.apache.org
[Bug 55444] Support JDBC Drivers outside of tomcat/lib/
https://issues.apache.org/bugzilla/show_bug.cgi?id=55444 Filip Hanik changed: What|Removed |Added Status|NEW |RESOLVED Resolution|--- |DUPLICATE --- Comment #1 from Filip Hanik --- *** This bug has been marked as a duplicate of bug 53853 *** -- You are receiving this mail because: You are the assignee for the bug. - To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org For additional commands, e-mail: dev-h...@tomcat.apache.org
svn commit: r1616629 - /tomcat/trunk/modules/jdbc-pool/src/main/java/org/apache/tomcat/jdbc/pool/DataSourceProxy.java
Author: fhanik Date: Thu Aug 7 23:28:19 2014 New Revision: 1616629 URL: http://svn.apache.org/r1616629 Log: Fix https://issues.apache.org/bugzilla/show_bug.cgi?id=56789 Always return a pool, never null Modified: tomcat/trunk/modules/jdbc-pool/src/main/java/org/apache/tomcat/jdbc/pool/DataSourceProxy.java Modified: tomcat/trunk/modules/jdbc-pool/src/main/java/org/apache/tomcat/jdbc/pool/DataSourceProxy.java URL: http://svn.apache.org/viewvc/tomcat/trunk/modules/jdbc-pool/src/main/java/org/apache/tomcat/jdbc/pool/DataSourceProxy.java?rev=1616629&r1=1616628&r2=1616629&view=diff == --- tomcat/trunk/modules/jdbc-pool/src/main/java/org/apache/tomcat/jdbc/pool/DataSourceProxy.java (original) +++ tomcat/trunk/modules/jdbc-pool/src/main/java/org/apache/tomcat/jdbc/pool/DataSourceProxy.java Thu Aug 7 23:28:19 2014 @@ -191,7 +191,12 @@ public class DataSourceProxy implements } public ConnectionPool getPool() { -return pool; +try { +return createPool(); +}catch (SQLException x) { +log.error("Error during connection pool creation.", x); +return null; +} } @@ -208,7 +213,7 @@ public class DataSourceProxy implements } } }catch (Exception x) { -log.warn("Error duing connection pool closure.", x); +log.warn("Error during connection pool closure.", x); } } - To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org For additional commands, e-mail: dev-h...@tomcat.apache.org
[Bug 56789] DataSourceProxy.getPool() returns NULL when pool is not started
https://issues.apache.org/bugzilla/show_bug.cgi?id=56789 Filip Hanik changed: What|Removed |Added Status|NEW |RESOLVED Resolution|--- |FIXED --- Comment #1 from Filip Hanik --- Fixed in r1616629 -- You are receiving this mail because: You are the assignee for the bug. - To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org For additional commands, e-mail: dev-h...@tomcat.apache.org
svn commit: r1616639 - /tomcat/trunk/modules/jdbc-pool/src/main/java/org/apache/tomcat/jdbc/pool/ConnectionPool.java
Author: fhanik Date: Thu Aug 7 23:51:55 2014 New Revision: 1616639 URL: http://svn.apache.org/r1616639 Log: Fix https://issues.apache.org/bugzilla/show_bug.cgi?id=53088 More readable and understandable name Modified: tomcat/trunk/modules/jdbc-pool/src/main/java/org/apache/tomcat/jdbc/pool/ConnectionPool.java Modified: tomcat/trunk/modules/jdbc-pool/src/main/java/org/apache/tomcat/jdbc/pool/ConnectionPool.java URL: http://svn.apache.org/viewvc/tomcat/trunk/modules/jdbc-pool/src/main/java/org/apache/tomcat/jdbc/pool/ConnectionPool.java?rev=1616639&r1=1616638&r2=1616639&view=diff == --- tomcat/trunk/modules/jdbc-pool/src/main/java/org/apache/tomcat/jdbc/pool/ConnectionPool.java (original) +++ tomcat/trunk/modules/jdbc-pool/src/main/java/org/apache/tomcat/jdbc/pool/ConnectionPool.java Thu Aug 7 23:51:55 2014 @@ -1283,7 +1283,7 @@ public class ConnectionPool { ClassLoader loader = Thread.currentThread().getContextClassLoader(); try { Thread.currentThread().setContextClassLoader(ConnectionPool.class.getClassLoader()); -poolCleanTimer = new Timer("PoolCleaner["+ System.identityHashCode(ConnectionPool.class.getClassLoader()) + ":"+ +poolCleanTimer = new Timer("Tomcat JDBC Pool Cleaner["+ System.identityHashCode(ConnectionPool.class.getClassLoader()) + ":"+ System.currentTimeMillis() + "]", true); }finally { Thread.currentThread().setContextClassLoader(loader); - To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org For additional commands, e-mail: dev-h...@tomcat.apache.org