You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@commons.apache.org by Phil Steitz <ph...@gmail.com> on 2010/01/10 19:52:46 UTC

Re: svn commit: r897678 - in /commons/proper/dbcp/trunk/src/test/org/apache/commons/dbcp: TestConnectionPool.java datasources/TestPerUserPoolDataSource.java datasources/TestSharedPoolDataSource.java

>From the debugging added to some previously failed builds, I saw
loop = 2 for some threads.  Threads should not be looping.  Second
loop by a thread that succeeded the first time that throws will not
change success state - so it looks like a success -> not enough
failures.

Phil

psteitz@apache.org wrote:
> Author: psteitz
> Date: Sun Jan 10 18:21:03 2010
> New Revision: 897678
> 
> URL: http://svn.apache.org/viewvc?rev=897678&view=rev
> Log:
> Eliminated unintended looping in mutipleThreads test.
> 
> Modified:
>     commons/proper/dbcp/trunk/src/test/org/apache/commons/dbcp/TestConnectionPool.java
>     commons/proper/dbcp/trunk/src/test/org/apache/commons/dbcp/datasources/TestPerUserPoolDataSource.java
>     commons/proper/dbcp/trunk/src/test/org/apache/commons/dbcp/datasources/TestSharedPoolDataSource.java
> 
> Modified: commons/proper/dbcp/trunk/src/test/org/apache/commons/dbcp/TestConnectionPool.java
> URL: http://svn.apache.org/viewvc/commons/proper/dbcp/trunk/src/test/org/apache/commons/dbcp/TestConnectionPool.java?rev=897678&r1=897677&r2=897678&view=diff
> ==============================================================================
> --- commons/proper/dbcp/trunk/src/test/org/apache/commons/dbcp/TestConnectionPool.java (original)
> +++ commons/proper/dbcp/trunk/src/test/org/apache/commons/dbcp/TestConnectionPool.java Sun Jan 10 18:21:03 2010
> @@ -683,7 +683,21 @@
>          }
>      }
>  
> -    protected void multipleThreads(final int holdTime, final boolean expectError, long maxWait)
> +    /**
> +     * Launches a group of 2 * getMaxActive() threads, each of which will attempt to obtain a connection
> +     * from the pool, hold it for <holdTime> ms, and then return it to the pool.  If <loopOnce> is false,
> +     * threads will continue this process indefinitely.  If <expectingError> is true, exactly 1/2 of the
> +     * threads are expected to either throw exceptions or fail to complete. If <expectingError> is false,
> +     * all threads are expected to complete successfully.
> +     * 
> +     * @param holdTime time in ms that a thread holds a connection before returning it to the pool
> +     * @param expectError whether or not an error is expected
> +     * @param loopOnce whether threads should complete the borrow - hold - return cycle only once, or loop indefinitely
> +     * @param maxWait passed in by client - has no impact on the test itself, but does get reported
> +     * 
> +     * @throws Exception
> +     */
> +    protected void multipleThreads(final int holdTime, final boolean expectError, final boolean loopOnce, final long maxWait)
>              throws Exception {
>                  long startTime = timeStamp();
>                  final PoolTest[] pts = new PoolTest[2 * getMaxActive()];
> @@ -696,8 +710,7 @@
>                      }
>                  };
>                  for (int i = 0; i < pts.length; i++) {
> -                    // If we are expecting an error, don't allow successful threads to loop
> -                    (pts[i] = new PoolTest(threadGroup, holdTime, expectError)).start();
> +                    (pts[i] = new PoolTest(threadGroup, holdTime, expectError, loopOnce)).start();    
>                  }
>  
>                  Thread.sleep(100L); // Wait for long enough to allow threads to start
> 
> Modified: commons/proper/dbcp/trunk/src/test/org/apache/commons/dbcp/datasources/TestPerUserPoolDataSource.java
> URL: http://svn.apache.org/viewvc/commons/proper/dbcp/trunk/src/test/org/apache/commons/dbcp/datasources/TestPerUserPoolDataSource.java?rev=897678&r1=897677&r2=897678&view=diff
> ==============================================================================
> --- commons/proper/dbcp/trunk/src/test/org/apache/commons/dbcp/datasources/TestPerUserPoolDataSource.java (original)
> +++ commons/proper/dbcp/trunk/src/test/org/apache/commons/dbcp/datasources/TestPerUserPoolDataSource.java Sun Jan 10 18:21:03 2010
> @@ -378,11 +378,11 @@
>          final int defaultMaxWait = 430;
>          ((PerUserPoolDataSource) ds).setDefaultMaxWait(defaultMaxWait);
>          ((PerUserPoolDataSource) ds).setPerUserMaxWait("foo",new Integer(defaultMaxWait));
> -        multipleThreads(1, false, defaultMaxWait);
> +        multipleThreads(1, false, false, defaultMaxWait);
>      }
>  
>      public void testMultipleThreads2() throws Exception {
> -        multipleThreads(2 * (int)(getMaxWait()), true, getMaxWait());
> +        multipleThreads(2 * (int)(getMaxWait()), true, false, getMaxWait());
>      }
>  
>      public void testTransactionIsolationBehavior() throws Exception {
> 
> Modified: commons/proper/dbcp/trunk/src/test/org/apache/commons/dbcp/datasources/TestSharedPoolDataSource.java
> URL: http://svn.apache.org/viewvc/commons/proper/dbcp/trunk/src/test/org/apache/commons/dbcp/datasources/TestSharedPoolDataSource.java?rev=897678&r1=897677&r2=897678&view=diff
> ==============================================================================
> --- commons/proper/dbcp/trunk/src/test/org/apache/commons/dbcp/datasources/TestSharedPoolDataSource.java (original)
> +++ commons/proper/dbcp/trunk/src/test/org/apache/commons/dbcp/datasources/TestSharedPoolDataSource.java Sun Jan 10 18:21:03 2010
> @@ -368,11 +368,11 @@
>          // some JVMs, e.g. Windows.
>          final int defaultMaxWait = 430;
>          ((SharedPoolDataSource) ds).setMaxWait(defaultMaxWait);
> -        multipleThreads(1, false, defaultMaxWait);
> +        multipleThreads(1, false, false, defaultMaxWait);
>      }
>  
>      public void testMultipleThreads2() throws Exception {
> -        multipleThreads(2 * (int)(getMaxWait()), true, getMaxWait());
> +        multipleThreads(2 * (int)(getMaxWait()), true, false, getMaxWait());
>      }
>  
>      public void testTransactionIsolationBehavior() throws Exception {
> 
> 


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@commons.apache.org
For additional commands, e-mail: dev-help@commons.apache.org


Re: svn commit: r897678 - in /commons/proper/dbcp/trunk/src/test/org/apache/commons/dbcp: TestConnectionPool.java datasources/TestPerUserPoolDataSource.java datasources/TestSharedPoolDataSource.java

Posted by sebb <se...@gmail.com>.
On 10/01/2010, Phil Steitz <ph...@gmail.com> wrote:
> sebb wrote:
>  > Thanks.
>  >
>  > Looks like I did not complete the fixes properly when I added the
>  > loopOnce parameter to PoolTest.
>  >
>  > It was quite tricky following the Continuum build output, as the date
>  > was 2 days behind, and the mail for the failed runs is not always
>  > accurate - if the "Exit code" is 127, then most of the email contents
>  > is inaccurate.
>  >
>  > I have raised http://jira.codehaus.org/browse/CONTINUUM-2428 for the
>  > misleading info.
>
>
> This could be complicated by my attempts at implementing the Ant
>  Java 5 build snd also the combination of forced and scheduled builds.
>

That part I found easy enough to follow, but Continuum clearly didn't  ... !

>  Phil
>
>
>  >
>  > On 10/01/2010, Phil Steitz <ph...@gmail.com> wrote:
>  >> From the debugging added to some previously failed builds, I saw
>  >>  loop = 2 for some threads.  Threads should not be looping.  Second
>  >>  loop by a thread that succeeded the first time that throws will not
>  >>  change success state - so it looks like a success -> not enough
>  >>  failures.
>  >>
>  >>  Phil
>  >>
>  >>
>  >>  psteitz@apache.org wrote:
>  >>  > Author: psteitz
>  >>  > Date: Sun Jan 10 18:21:03 2010
>  >>  > New Revision: 897678
>  >>  >
>  >>  > URL: http://svn.apache.org/viewvc?rev=897678&view=rev
>  >>  > Log:
>  >>  > Eliminated unintended looping in mutipleThreads test.
>  >>  >
>  >>  > Modified:
>  >>  >     commons/proper/dbcp/trunk/src/test/org/apache/commons/dbcp/TestConnectionPool.java
>  >>  >     commons/proper/dbcp/trunk/src/test/org/apache/commons/dbcp/datasources/TestPerUserPoolDataSource.java
>  >>  >     commons/proper/dbcp/trunk/src/test/org/apache/commons/dbcp/datasources/TestSharedPoolDataSource.java
>  >>  >
>  >>  > Modified: commons/proper/dbcp/trunk/src/test/org/apache/commons/dbcp/TestConnectionPool.java
>  >>  > URL: http://svn.apache.org/viewvc/commons/proper/dbcp/trunk/src/test/org/apache/commons/dbcp/TestConnectionPool.java?rev=897678&r1=897677&r2=897678&view=diff
>  >>  > ==============================================================================
>  >>  > --- commons/proper/dbcp/trunk/src/test/org/apache/commons/dbcp/TestConnectionPool.java (original)
>  >>  > +++ commons/proper/dbcp/trunk/src/test/org/apache/commons/dbcp/TestConnectionPool.java Sun Jan 10 18:21:03 2010
>  >>  > @@ -683,7 +683,21 @@
>  >>  >          }
>  >>  >      }
>  >>  >
>  >>  > -    protected void multipleThreads(final int holdTime, final boolean expectError, long maxWait)
>  >>  > +    /**
>  >>  > +     * Launches a group of 2 * getMaxActive() threads, each of which will attempt to obtain a connection
>  >>  > +     * from the pool, hold it for <holdTime> ms, and then return it to the pool.  If <loopOnce> is false,
>  >>  > +     * threads will continue this process indefinitely.  If <expectingError> is true, exactly 1/2 of the
>  >>  > +     * threads are expected to either throw exceptions or fail to complete. If <expectingError> is false,
>  >>  > +     * all threads are expected to complete successfully.
>  >>  > +     *
>  >>  > +     * @param holdTime time in ms that a thread holds a connection before returning it to the pool
>  >>  > +     * @param expectError whether or not an error is expected
>  >>  > +     * @param loopOnce whether threads should complete the borrow - hold - return cycle only once, or loop indefinitely
>  >>  > +     * @param maxWait passed in by client - has no impact on the test itself, but does get reported
>  >>  > +     *
>  >>  > +     * @throws Exception
>  >>  > +     */
>  >>  > +    protected void multipleThreads(final int holdTime, final boolean expectError, final boolean loopOnce, final long maxWait)
>  >>  >              throws Exception {
>  >>  >                  long startTime = timeStamp();
>  >>  >                  final PoolTest[] pts = new PoolTest[2 * getMaxActive()];
>  >>  > @@ -696,8 +710,7 @@
>  >>  >                      }
>  >>  >                  };
>  >>  >                  for (int i = 0; i < pts.length; i++) {
>  >>  > -                    // If we are expecting an error, don't allow successful threads to loop
>  >>  > -                    (pts[i] = new PoolTest(threadGroup, holdTime, expectError)).start();
>  >>  > +                    (pts[i] = new PoolTest(threadGroup, holdTime, expectError, loopOnce)).start();
>  >>  >                  }
>  >>  >
>  >>  >                  Thread.sleep(100L); // Wait for long enough to allow threads to start
>  >>  >
>  >>  > Modified: commons/proper/dbcp/trunk/src/test/org/apache/commons/dbcp/datasources/TestPerUserPoolDataSource.java
>  >>  > URL: http://svn.apache.org/viewvc/commons/proper/dbcp/trunk/src/test/org/apache/commons/dbcp/datasources/TestPerUserPoolDataSource.java?rev=897678&r1=897677&r2=897678&view=diff
>  >>  > ==============================================================================
>  >>  > --- commons/proper/dbcp/trunk/src/test/org/apache/commons/dbcp/datasources/TestPerUserPoolDataSource.java (original)
>  >>  > +++ commons/proper/dbcp/trunk/src/test/org/apache/commons/dbcp/datasources/TestPerUserPoolDataSource.java Sun Jan 10 18:21:03 2010
>  >>  > @@ -378,11 +378,11 @@
>  >>  >          final int defaultMaxWait = 430;
>  >>  >          ((PerUserPoolDataSource) ds).setDefaultMaxWait(defaultMaxWait);
>  >>  >          ((PerUserPoolDataSource) ds).setPerUserMaxWait("foo",new Integer(defaultMaxWait));
>  >>  > -        multipleThreads(1, false, defaultMaxWait);
>  >>  > +        multipleThreads(1, false, false, defaultMaxWait);
>  >>  >      }
>  >>  >
>  >>  >      public void testMultipleThreads2() throws Exception {
>  >>  > -        multipleThreads(2 * (int)(getMaxWait()), true, getMaxWait());
>  >>  > +        multipleThreads(2 * (int)(getMaxWait()), true, false, getMaxWait());
>  >>  >      }
>  >>  >
>  >>  >      public void testTransactionIsolationBehavior() throws Exception {
>  >>  >
>  >>  > Modified: commons/proper/dbcp/trunk/src/test/org/apache/commons/dbcp/datasources/TestSharedPoolDataSource.java
>  >>  > URL: http://svn.apache.org/viewvc/commons/proper/dbcp/trunk/src/test/org/apache/commons/dbcp/datasources/TestSharedPoolDataSource.java?rev=897678&r1=897677&r2=897678&view=diff
>  >>  > ==============================================================================
>  >>  > --- commons/proper/dbcp/trunk/src/test/org/apache/commons/dbcp/datasources/TestSharedPoolDataSource.java (original)
>  >>  > +++ commons/proper/dbcp/trunk/src/test/org/apache/commons/dbcp/datasources/TestSharedPoolDataSource.java Sun Jan 10 18:21:03 2010
>  >>  > @@ -368,11 +368,11 @@
>  >>  >          // some JVMs, e.g. Windows.
>  >>  >          final int defaultMaxWait = 430;
>  >>  >          ((SharedPoolDataSource) ds).setMaxWait(defaultMaxWait);
>  >>  > -        multipleThreads(1, false, defaultMaxWait);
>  >>  > +        multipleThreads(1, false, false, defaultMaxWait);
>  >>  >      }
>  >>  >
>  >>  >      public void testMultipleThreads2() throws Exception {
>  >>  > -        multipleThreads(2 * (int)(getMaxWait()), true, getMaxWait());
>  >>  > +        multipleThreads(2 * (int)(getMaxWait()), true, false, getMaxWait());
>  >>  >      }
>  >>  >
>  >>  >      public void testTransactionIsolationBehavior() throws Exception {
>  >>  >
>  >>  >
>  >>
>  >>
>  >>
>  >> ---------------------------------------------------------------------
>  >>  To unsubscribe, e-mail: dev-unsubscribe@commons.apache.org
>  >>  For additional commands, e-mail: dev-help@commons.apache.org
>  >>
>  >>
>  >
>  > ---------------------------------------------------------------------
>  > To unsubscribe, e-mail: dev-unsubscribe@commons.apache.org
>  > For additional commands, e-mail: dev-help@commons.apache.org
>  >
>
>
>  ---------------------------------------------------------------------
>  To unsubscribe, e-mail: dev-unsubscribe@commons.apache.org
>  For additional commands, e-mail: dev-help@commons.apache.org
>
>

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@commons.apache.org
For additional commands, e-mail: dev-help@commons.apache.org


Re: svn commit: r897678 - in /commons/proper/dbcp/trunk/src/test/org/apache/commons/dbcp: TestConnectionPool.java datasources/TestPerUserPoolDataSource.java datasources/TestSharedPoolDataSource.java

Posted by Phil Steitz <ph...@gmail.com>.
sebb wrote:
> Thanks.
> 
> Looks like I did not complete the fixes properly when I added the
> loopOnce parameter to PoolTest.
> 
> It was quite tricky following the Continuum build output, as the date
> was 2 days behind, and the mail for the failed runs is not always
> accurate - if the "Exit code" is 127, then most of the email contents
> is inaccurate.
> 
> I have raised http://jira.codehaus.org/browse/CONTINUUM-2428 for the
> misleading info.

This could be complicated by my attempts at implementing the Ant
Java 5 build snd also the combination of forced and scheduled builds.

Phil

> 
> On 10/01/2010, Phil Steitz <ph...@gmail.com> wrote:
>> From the debugging added to some previously failed builds, I saw
>>  loop = 2 for some threads.  Threads should not be looping.  Second
>>  loop by a thread that succeeded the first time that throws will not
>>  change success state - so it looks like a success -> not enough
>>  failures.
>>
>>  Phil
>>
>>
>>  psteitz@apache.org wrote:
>>  > Author: psteitz
>>  > Date: Sun Jan 10 18:21:03 2010
>>  > New Revision: 897678
>>  >
>>  > URL: http://svn.apache.org/viewvc?rev=897678&view=rev
>>  > Log:
>>  > Eliminated unintended looping in mutipleThreads test.
>>  >
>>  > Modified:
>>  >     commons/proper/dbcp/trunk/src/test/org/apache/commons/dbcp/TestConnectionPool.java
>>  >     commons/proper/dbcp/trunk/src/test/org/apache/commons/dbcp/datasources/TestPerUserPoolDataSource.java
>>  >     commons/proper/dbcp/trunk/src/test/org/apache/commons/dbcp/datasources/TestSharedPoolDataSource.java
>>  >
>>  > Modified: commons/proper/dbcp/trunk/src/test/org/apache/commons/dbcp/TestConnectionPool.java
>>  > URL: http://svn.apache.org/viewvc/commons/proper/dbcp/trunk/src/test/org/apache/commons/dbcp/TestConnectionPool.java?rev=897678&r1=897677&r2=897678&view=diff
>>  > ==============================================================================
>>  > --- commons/proper/dbcp/trunk/src/test/org/apache/commons/dbcp/TestConnectionPool.java (original)
>>  > +++ commons/proper/dbcp/trunk/src/test/org/apache/commons/dbcp/TestConnectionPool.java Sun Jan 10 18:21:03 2010
>>  > @@ -683,7 +683,21 @@
>>  >          }
>>  >      }
>>  >
>>  > -    protected void multipleThreads(final int holdTime, final boolean expectError, long maxWait)
>>  > +    /**
>>  > +     * Launches a group of 2 * getMaxActive() threads, each of which will attempt to obtain a connection
>>  > +     * from the pool, hold it for <holdTime> ms, and then return it to the pool.  If <loopOnce> is false,
>>  > +     * threads will continue this process indefinitely.  If <expectingError> is true, exactly 1/2 of the
>>  > +     * threads are expected to either throw exceptions or fail to complete. If <expectingError> is false,
>>  > +     * all threads are expected to complete successfully.
>>  > +     *
>>  > +     * @param holdTime time in ms that a thread holds a connection before returning it to the pool
>>  > +     * @param expectError whether or not an error is expected
>>  > +     * @param loopOnce whether threads should complete the borrow - hold - return cycle only once, or loop indefinitely
>>  > +     * @param maxWait passed in by client - has no impact on the test itself, but does get reported
>>  > +     *
>>  > +     * @throws Exception
>>  > +     */
>>  > +    protected void multipleThreads(final int holdTime, final boolean expectError, final boolean loopOnce, final long maxWait)
>>  >              throws Exception {
>>  >                  long startTime = timeStamp();
>>  >                  final PoolTest[] pts = new PoolTest[2 * getMaxActive()];
>>  > @@ -696,8 +710,7 @@
>>  >                      }
>>  >                  };
>>  >                  for (int i = 0; i < pts.length; i++) {
>>  > -                    // If we are expecting an error, don't allow successful threads to loop
>>  > -                    (pts[i] = new PoolTest(threadGroup, holdTime, expectError)).start();
>>  > +                    (pts[i] = new PoolTest(threadGroup, holdTime, expectError, loopOnce)).start();
>>  >                  }
>>  >
>>  >                  Thread.sleep(100L); // Wait for long enough to allow threads to start
>>  >
>>  > Modified: commons/proper/dbcp/trunk/src/test/org/apache/commons/dbcp/datasources/TestPerUserPoolDataSource.java
>>  > URL: http://svn.apache.org/viewvc/commons/proper/dbcp/trunk/src/test/org/apache/commons/dbcp/datasources/TestPerUserPoolDataSource.java?rev=897678&r1=897677&r2=897678&view=diff
>>  > ==============================================================================
>>  > --- commons/proper/dbcp/trunk/src/test/org/apache/commons/dbcp/datasources/TestPerUserPoolDataSource.java (original)
>>  > +++ commons/proper/dbcp/trunk/src/test/org/apache/commons/dbcp/datasources/TestPerUserPoolDataSource.java Sun Jan 10 18:21:03 2010
>>  > @@ -378,11 +378,11 @@
>>  >          final int defaultMaxWait = 430;
>>  >          ((PerUserPoolDataSource) ds).setDefaultMaxWait(defaultMaxWait);
>>  >          ((PerUserPoolDataSource) ds).setPerUserMaxWait("foo",new Integer(defaultMaxWait));
>>  > -        multipleThreads(1, false, defaultMaxWait);
>>  > +        multipleThreads(1, false, false, defaultMaxWait);
>>  >      }
>>  >
>>  >      public void testMultipleThreads2() throws Exception {
>>  > -        multipleThreads(2 * (int)(getMaxWait()), true, getMaxWait());
>>  > +        multipleThreads(2 * (int)(getMaxWait()), true, false, getMaxWait());
>>  >      }
>>  >
>>  >      public void testTransactionIsolationBehavior() throws Exception {
>>  >
>>  > Modified: commons/proper/dbcp/trunk/src/test/org/apache/commons/dbcp/datasources/TestSharedPoolDataSource.java
>>  > URL: http://svn.apache.org/viewvc/commons/proper/dbcp/trunk/src/test/org/apache/commons/dbcp/datasources/TestSharedPoolDataSource.java?rev=897678&r1=897677&r2=897678&view=diff
>>  > ==============================================================================
>>  > --- commons/proper/dbcp/trunk/src/test/org/apache/commons/dbcp/datasources/TestSharedPoolDataSource.java (original)
>>  > +++ commons/proper/dbcp/trunk/src/test/org/apache/commons/dbcp/datasources/TestSharedPoolDataSource.java Sun Jan 10 18:21:03 2010
>>  > @@ -368,11 +368,11 @@
>>  >          // some JVMs, e.g. Windows.
>>  >          final int defaultMaxWait = 430;
>>  >          ((SharedPoolDataSource) ds).setMaxWait(defaultMaxWait);
>>  > -        multipleThreads(1, false, defaultMaxWait);
>>  > +        multipleThreads(1, false, false, defaultMaxWait);
>>  >      }
>>  >
>>  >      public void testMultipleThreads2() throws Exception {
>>  > -        multipleThreads(2 * (int)(getMaxWait()), true, getMaxWait());
>>  > +        multipleThreads(2 * (int)(getMaxWait()), true, false, getMaxWait());
>>  >      }
>>  >
>>  >      public void testTransactionIsolationBehavior() throws Exception {
>>  >
>>  >
>>
>>
>>
>> ---------------------------------------------------------------------
>>  To unsubscribe, e-mail: dev-unsubscribe@commons.apache.org
>>  For additional commands, e-mail: dev-help@commons.apache.org
>>
>>
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: dev-unsubscribe@commons.apache.org
> For additional commands, e-mail: dev-help@commons.apache.org
> 


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@commons.apache.org
For additional commands, e-mail: dev-help@commons.apache.org


Re: [dbcp] multipleThreads test

Posted by sebb <se...@gmail.com>.
On 12/01/2010, Phil Steitz <ph...@gmail.com> wrote:
> sebb wrote:
>  > On 12/01/2010, Phil Steitz <ph...@gmail.com> wrote:
>  >> sebb wrote:
>  >>  > On 11/01/2010, Phil Steitz <ph...@gmail.com> wrote:
>  >>  >> Phil Steitz wrote:
>  >>  >>  > Posting the last failed build output while it is, um....still available:
>  >>  >
>  >>  > I assume this is from:
>  >>  >
>  >>  > http://vmbuild.apache.org/continuum/buildResult.action?buildId=267625&projectId=22
>  >>  >
>  >>  >>  >
>  >>  >>  > Multithread test time = 489 ms. Threads: 20. Loops: 20. Hold time:
>  >>  >>  > 200. Maxwait: 100. Done: 11. Did not run: 0. Failed: 9. expectError:
>  >>  >>  > true
>  >>  >>  > StartupDelay: 0. ConnectTime: 3. Runtime: 203. Loops: 1. State:
>  >>  >>  > Done. thrown: null. (using nanoTime)
>  >>  >>  > StartupDelay: 0. ConnectTime: 132. Runtime: 333. Loops: 1. State:
>  >>  >>  > Done. thrown: null. (using nanoTime)
>  >>  >>  > StartupDelay: 42. ConnectTime: 90. Runtime: 290. Loops: 1. State:
>  >>  >>  > Done. thrown: null. (using nanoTime)
>  >>  >>  > StartupDelay: 0. ConnectTime: 90. Runtime: 291. Loops: 1. State:
>  >>  >>  > Done. thrown: null. (using nanoTime)
>  >>  >>  > StartupDelay: 76. ConnectTime: 14. Runtime: 215. Loops: 1. State:
>  >>  >>  > Done. thrown: null. (using nanoTime)
>  >>  >>  > StartupDelay: 13. ConnectTime: 1. Runtime: 202. Loops: 1. State:
>  >>  >>  > Done. thrown: null. (using nanoTime)
>  >>  >>  > StartupDelay: 16. ConnectTime: 0. Runtime: 200. Loops: 1. State:
>  >>  >>  > Done. thrown: null. (using nanoTime)
>  >>  >>  > StartupDelay: 1. ConnectTime: 0. Runtime: 200. Loops: 1. State:
>  >>  >>  > Done. thrown: null. (using nanoTime)
>  >>  >>  > StartupDelay: 11. ConnectTime: 0. Runtime: 200. Loops: 1. State:
>  >>  >>  > Done. thrown: null. (using nanoTime)
>  >>  >>  > StartupDelay: 18. ConnectTime: 0. Runtime: 201. Loops: 1. State:
>  >>  >>  > Done. thrown: null. (using nanoTime)
>  >>  >>  > StartupDelay: 7. ConnectTime: 17. Runtime: 218. Loops: 1. State:
>  >>  >>  > Done. thrown: null. (using nanoTime)
>  >>  >>  > StartupDelay: 0. ConnectTime: -. Runtime: 100. Loops: 1. State:
>  >>  >>  > Getting Connection. thrown:
>  >>  >>  > org.apache.commons.dbcp.SQLNestedException: Could not retrieve
>  >>  >>  > connection info from pool. (using nanoTime)
>  >>  >>  > StartupDelay: 0. ConnectTime: -. Runtime: 101. Loops: 1. State:
>  >>  >>  > Getting Connection. thrown:
>  >>  >>  > org.apache.commons.dbcp.SQLNestedException: Could not retrieve
>  >>  >>  > connection info from pool. (using nanoTime)
>  >>  >>  > StartupDelay: 1. ConnectTime: -. Runtime: 100. Loops: 1. State:
>  >>  >>  > Getting Connection. thrown:
>  >>  >>  > org.apache.commons.dbcp.SQLNestedException: Could not retrieve
>  >>  >>  > connection info from pool. (using nanoTime)
>  >>  >>  > StartupDelay: 0. ConnectTime: -. Runtime: 100. Loops: 1. State:
>  >>  >>  > Getting Connection. thrown:
>  >>  >>  > org.apache.commons.dbcp.SQLNestedException: Could not retrieve
>  >>  >>  > connection info from pool. (using nanoTime)
>  >>  >>  > StartupDelay: 0. ConnectTime: -. Runtime: 100. Loops: 1. State:
>  >>  >>  > Getting Connection. thrown:
>  >>  >>  > org.apache.commons.dbcp.SQLNestedException: Could not retrieve
>  >>  >>  > connection info from pool. (using nanoTime)
>  >>  >>  > StartupDelay: 0. ConnectTime: -. Runtime: 100. Loops: 1. State:
>  >>  >>  > Getting Connection. thrown:
>  >>  >>  > org.apache.commons.dbcp.SQLNestedException: Could not retrieve
>  >>  >>  > connection info from pool. (using nanoTime)
>  >>  >>  > StartupDelay: 0. ConnectTime: -. Runtime: 101. Loops: 1. State:
>  >>  >>  > Getting Connection. thrown:
>  >>  >>  > org.apache.commons.dbcp.SQLNestedException: Could not retrieve
>  >>  >>  > connection info from pool. (using nanoTime)
>  >>  >>  > StartupDelay: 1. ConnectTime: -. Runtime: 100. Loops: 1. State:
>  >>  >>  > Getting Connection. thrown:
>  >>  >>  > org.apache.commons.dbcp.SQLNestedException: Could not retrieve
>  >>  >>  > connection info from pool. (using nanoTime)
>  >>  >>  > StartupDelay: 0. ConnectTime: -. Runtime: 100. Loops: 1. State:
>  >>  >>  > Getting Connection. thrown:
>  >>  >>  > org.apache.commons.dbcp.SQLNestedException: Could not retrieve
>  >>  >>  > connection info from pool. (using nanoTime)
>  >>  >>  >
>  >>  >>  > There are three things that look odd here.  First is that the second
>  >>  >>  > successful thread should have failed with a timeout.  That may be
>  >>  >>  > explainable by "wakeup delay."  The second is that unless
>  >>  >>  > startupDelay is not reliable, the allocation looks unfair and pool
>  >>  >>  > 1.5 is supposed to implement fairness - i.e., it should be the
>  >>  >>  > threads with lower startupDelays that are served first.
>  >>  >>
>  >>  >>
>  >>  >> Scratch that.  pooledConnectionAndInfo has a synch block before the
>  >>  >>  call to borrowObject to create or acquire the pool.  All threads are
>  >>  >>  going after the same pool.  The first one in has to create the pool.
>  >>  >>
>  >>  >
>  >>  > It's rather odd.
>  >>  >
>  >>  > The successful threads all took 200+ms to complete, during which time
>  >>  > there should be no spare connections available.
>  >>  >
>  >>  > Yet the second thread only appears to have waited 132ms to get the connection.
>  >>  > [Which should have caused a timeout error, but perhaps that's excusable.]
>  >>  > However, it should not be possible to aquire the 11th connection in
>  >>  > less than 200ms.
>  >>  > What happened to that thread?
>  >>  > Did it somehow stall before waiting for the connection?
>  >>  > If so, why is the overall runtime for the thread only 333ms?
>  >>  >
>  >>  > I will add some more info to the debug output.
>  >>
>  >>
>  >> Still no failures.  This weekend, NTP was re-enabled on vmbuild. It
>  >>  had been disabled for some time.
>  >
>  > I think at least one build failed after the time was corrected:
>  >
>  > http://vmbuild.apache.org/continuum/buildResult.action?projectId=22&projectGroupId=22&projectName=&buildId=267564
>  >
>  > Anyway, the test depends on relative time, rather than absolute time,
>  > so the true time is surely irrelevant?
>
>
> The true time, yes; but if any of this affects measures of elapsed
>  time differentially across threads, that would cause problems.

Indeed, but I don't think this is very likely.

> >
>  > Perhaps if the clock was running extremely slowly or very fast it
>  > might cause JVM scheduling issues, but otherwise I don't see how it
>  > could affect the test.
>  >
>  >>  As I said above, loaded guests running under Vmware are known to
>  >>  lose clock accuracy.  See [1], [2].
>  >
>  > BTW, both URLs are the same.
>  >
>  >>  [1]
>  >>  http://kb.vmware.com/selfservice/microsites/search.do?language=en_US&cmd=displayKC&externalId=1006072
>  >>  [2]
>  >>  http://kb.vmware.com/selfservice/microsites/search.do?language=en_US&cmd=displayKC&externalId=1006072
>
>
> I meant
>  http://www.vmware.com/pdf/vmware_timekeeping.pdf

Thanks, that's very interesting and exhaustive (not finished reading it yet!)

> >>
>  >>
>  >>  Phil
>  >>
>  >>
>  >>
>  >>  >
>  >>  >>  Phil
>  >>  >>
>  >>  >>
>  >>  >>
>  >>  >>   This could
>  >>  >>  > point to a pool bug. Finally, the connectTimes for some of the
>  >>  >>  > successful threads are way too long.
>  >>  >>  >
>  >>  >>  > Phil
>  >>  >>
>  >>  >>
>  >>  >>  ---------------------------------------------------------------------
>  >>  >>  To unsubscribe, e-mail: dev-unsubscribe@commons.apache.org
>  >>  >>  For additional commands, e-mail: dev-help@commons.apache.org
>  >>  >>
>  >>  >>
>  >>  >
>  >>  > ---------------------------------------------------------------------
>  >>  > To unsubscribe, e-mail: dev-unsubscribe@commons.apache.org
>  >>  > For additional commands, e-mail: dev-help@commons.apache.org
>  >>  >
>  >>
>  >>
>  >>  ---------------------------------------------------------------------
>  >>  To unsubscribe, e-mail: dev-unsubscribe@commons.apache.org
>  >>  For additional commands, e-mail: dev-help@commons.apache.org
>  >>
>  >>
>  >
>  > ---------------------------------------------------------------------
>  > To unsubscribe, e-mail: dev-unsubscribe@commons.apache.org
>  > For additional commands, e-mail: dev-help@commons.apache.org
>  >
>
>
>  ---------------------------------------------------------------------
>  To unsubscribe, e-mail: dev-unsubscribe@commons.apache.org
>  For additional commands, e-mail: dev-help@commons.apache.org
>
>

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@commons.apache.org
For additional commands, e-mail: dev-help@commons.apache.org


Re: [dbcp] multipleThreads test

Posted by Phil Steitz <ph...@gmail.com>.
sebb wrote:
> On 12/01/2010, Phil Steitz <ph...@gmail.com> wrote:
>> sebb wrote:
>>  > On 11/01/2010, Phil Steitz <ph...@gmail.com> wrote:
>>  >> Phil Steitz wrote:
>>  >>  > Posting the last failed build output while it is, um....still available:
>>  >
>>  > I assume this is from:
>>  >
>>  > http://vmbuild.apache.org/continuum/buildResult.action?buildId=267625&projectId=22
>>  >
>>  >>  >
>>  >>  > Multithread test time = 489 ms. Threads: 20. Loops: 20. Hold time:
>>  >>  > 200. Maxwait: 100. Done: 11. Did not run: 0. Failed: 9. expectError:
>>  >>  > true
>>  >>  > StartupDelay: 0. ConnectTime: 3. Runtime: 203. Loops: 1. State:
>>  >>  > Done. thrown: null. (using nanoTime)
>>  >>  > StartupDelay: 0. ConnectTime: 132. Runtime: 333. Loops: 1. State:
>>  >>  > Done. thrown: null. (using nanoTime)
>>  >>  > StartupDelay: 42. ConnectTime: 90. Runtime: 290. Loops: 1. State:
>>  >>  > Done. thrown: null. (using nanoTime)
>>  >>  > StartupDelay: 0. ConnectTime: 90. Runtime: 291. Loops: 1. State:
>>  >>  > Done. thrown: null. (using nanoTime)
>>  >>  > StartupDelay: 76. ConnectTime: 14. Runtime: 215. Loops: 1. State:
>>  >>  > Done. thrown: null. (using nanoTime)
>>  >>  > StartupDelay: 13. ConnectTime: 1. Runtime: 202. Loops: 1. State:
>>  >>  > Done. thrown: null. (using nanoTime)
>>  >>  > StartupDelay: 16. ConnectTime: 0. Runtime: 200. Loops: 1. State:
>>  >>  > Done. thrown: null. (using nanoTime)
>>  >>  > StartupDelay: 1. ConnectTime: 0. Runtime: 200. Loops: 1. State:
>>  >>  > Done. thrown: null. (using nanoTime)
>>  >>  > StartupDelay: 11. ConnectTime: 0. Runtime: 200. Loops: 1. State:
>>  >>  > Done. thrown: null. (using nanoTime)
>>  >>  > StartupDelay: 18. ConnectTime: 0. Runtime: 201. Loops: 1. State:
>>  >>  > Done. thrown: null. (using nanoTime)
>>  >>  > StartupDelay: 7. ConnectTime: 17. Runtime: 218. Loops: 1. State:
>>  >>  > Done. thrown: null. (using nanoTime)
>>  >>  > StartupDelay: 0. ConnectTime: -. Runtime: 100. Loops: 1. State:
>>  >>  > Getting Connection. thrown:
>>  >>  > org.apache.commons.dbcp.SQLNestedException: Could not retrieve
>>  >>  > connection info from pool. (using nanoTime)
>>  >>  > StartupDelay: 0. ConnectTime: -. Runtime: 101. Loops: 1. State:
>>  >>  > Getting Connection. thrown:
>>  >>  > org.apache.commons.dbcp.SQLNestedException: Could not retrieve
>>  >>  > connection info from pool. (using nanoTime)
>>  >>  > StartupDelay: 1. ConnectTime: -. Runtime: 100. Loops: 1. State:
>>  >>  > Getting Connection. thrown:
>>  >>  > org.apache.commons.dbcp.SQLNestedException: Could not retrieve
>>  >>  > connection info from pool. (using nanoTime)
>>  >>  > StartupDelay: 0. ConnectTime: -. Runtime: 100. Loops: 1. State:
>>  >>  > Getting Connection. thrown:
>>  >>  > org.apache.commons.dbcp.SQLNestedException: Could not retrieve
>>  >>  > connection info from pool. (using nanoTime)
>>  >>  > StartupDelay: 0. ConnectTime: -. Runtime: 100. Loops: 1. State:
>>  >>  > Getting Connection. thrown:
>>  >>  > org.apache.commons.dbcp.SQLNestedException: Could not retrieve
>>  >>  > connection info from pool. (using nanoTime)
>>  >>  > StartupDelay: 0. ConnectTime: -. Runtime: 100. Loops: 1. State:
>>  >>  > Getting Connection. thrown:
>>  >>  > org.apache.commons.dbcp.SQLNestedException: Could not retrieve
>>  >>  > connection info from pool. (using nanoTime)
>>  >>  > StartupDelay: 0. ConnectTime: -. Runtime: 101. Loops: 1. State:
>>  >>  > Getting Connection. thrown:
>>  >>  > org.apache.commons.dbcp.SQLNestedException: Could not retrieve
>>  >>  > connection info from pool. (using nanoTime)
>>  >>  > StartupDelay: 1. ConnectTime: -. Runtime: 100. Loops: 1. State:
>>  >>  > Getting Connection. thrown:
>>  >>  > org.apache.commons.dbcp.SQLNestedException: Could not retrieve
>>  >>  > connection info from pool. (using nanoTime)
>>  >>  > StartupDelay: 0. ConnectTime: -. Runtime: 100. Loops: 1. State:
>>  >>  > Getting Connection. thrown:
>>  >>  > org.apache.commons.dbcp.SQLNestedException: Could not retrieve
>>  >>  > connection info from pool. (using nanoTime)
>>  >>  >
>>  >>  > There are three things that look odd here.  First is that the second
>>  >>  > successful thread should have failed with a timeout.  That may be
>>  >>  > explainable by "wakeup delay."  The second is that unless
>>  >>  > startupDelay is not reliable, the allocation looks unfair and pool
>>  >>  > 1.5 is supposed to implement fairness - i.e., it should be the
>>  >>  > threads with lower startupDelays that are served first.
>>  >>
>>  >>
>>  >> Scratch that.  pooledConnectionAndInfo has a synch block before the
>>  >>  call to borrowObject to create or acquire the pool.  All threads are
>>  >>  going after the same pool.  The first one in has to create the pool.
>>  >>
>>  >
>>  > It's rather odd.
>>  >
>>  > The successful threads all took 200+ms to complete, during which time
>>  > there should be no spare connections available.
>>  >
>>  > Yet the second thread only appears to have waited 132ms to get the connection.
>>  > [Which should have caused a timeout error, but perhaps that's excusable.]
>>  > However, it should not be possible to aquire the 11th connection in
>>  > less than 200ms.
>>  > What happened to that thread?
>>  > Did it somehow stall before waiting for the connection?
>>  > If so, why is the overall runtime for the thread only 333ms?
>>  >
>>  > I will add some more info to the debug output.
>>
>>
>> Still no failures.  This weekend, NTP was re-enabled on vmbuild. It
>>  had been disabled for some time.
> 
> I think at least one build failed after the time was corrected:
> 
> http://vmbuild.apache.org/continuum/buildResult.action?projectId=22&projectGroupId=22&projectName=&buildId=267564
> 
> Anyway, the test depends on relative time, rather than absolute time,
> so the true time is surely irrelevant?

The true time, yes; but if any of this affects measures of elapsed
time differentially across threads, that would cause problems.
> 
> Perhaps if the clock was running extremely slowly or very fast it
> might cause JVM scheduling issues, but otherwise I don't see how it
> could affect the test.
> 
>>  As I said above, loaded guests running under Vmware are known to
>>  lose clock accuracy.  See [1], [2].
> 
> BTW, both URLs are the same.
> 
>>  [1]
>>  http://kb.vmware.com/selfservice/microsites/search.do?language=en_US&cmd=displayKC&externalId=1006072
>>  [2]
>>  http://kb.vmware.com/selfservice/microsites/search.do?language=en_US&cmd=displayKC&externalId=1006072

I meant
http://www.vmware.com/pdf/vmware_timekeeping.pdf
>>
>>
>>  Phil
>>
>>
>>
>>  >
>>  >>  Phil
>>  >>
>>  >>
>>  >>
>>  >>   This could
>>  >>  > point to a pool bug. Finally, the connectTimes for some of the
>>  >>  > successful threads are way too long.
>>  >>  >
>>  >>  > Phil
>>  >>
>>  >>
>>  >>  ---------------------------------------------------------------------
>>  >>  To unsubscribe, e-mail: dev-unsubscribe@commons.apache.org
>>  >>  For additional commands, e-mail: dev-help@commons.apache.org
>>  >>
>>  >>
>>  >
>>  > ---------------------------------------------------------------------
>>  > To unsubscribe, e-mail: dev-unsubscribe@commons.apache.org
>>  > For additional commands, e-mail: dev-help@commons.apache.org
>>  >
>>
>>
>>  ---------------------------------------------------------------------
>>  To unsubscribe, e-mail: dev-unsubscribe@commons.apache.org
>>  For additional commands, e-mail: dev-help@commons.apache.org
>>
>>
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: dev-unsubscribe@commons.apache.org
> For additional commands, e-mail: dev-help@commons.apache.org
> 


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@commons.apache.org
For additional commands, e-mail: dev-help@commons.apache.org


Re: [dbcp] multipleThreads test

Posted by sebb <se...@gmail.com>.
On 12/01/2010, Phil Steitz <ph...@gmail.com> wrote:
> sebb wrote:
>  > On 11/01/2010, Phil Steitz <ph...@gmail.com> wrote:
>  >> Phil Steitz wrote:
>  >>  > Posting the last failed build output while it is, um....still available:
>  >
>  > I assume this is from:
>  >
>  > http://vmbuild.apache.org/continuum/buildResult.action?buildId=267625&projectId=22
>  >
>  >>  >
>  >>  > Multithread test time = 489 ms. Threads: 20. Loops: 20. Hold time:
>  >>  > 200. Maxwait: 100. Done: 11. Did not run: 0. Failed: 9. expectError:
>  >>  > true
>  >>  > StartupDelay: 0. ConnectTime: 3. Runtime: 203. Loops: 1. State:
>  >>  > Done. thrown: null. (using nanoTime)
>  >>  > StartupDelay: 0. ConnectTime: 132. Runtime: 333. Loops: 1. State:
>  >>  > Done. thrown: null. (using nanoTime)
>  >>  > StartupDelay: 42. ConnectTime: 90. Runtime: 290. Loops: 1. State:
>  >>  > Done. thrown: null. (using nanoTime)
>  >>  > StartupDelay: 0. ConnectTime: 90. Runtime: 291. Loops: 1. State:
>  >>  > Done. thrown: null. (using nanoTime)
>  >>  > StartupDelay: 76. ConnectTime: 14. Runtime: 215. Loops: 1. State:
>  >>  > Done. thrown: null. (using nanoTime)
>  >>  > StartupDelay: 13. ConnectTime: 1. Runtime: 202. Loops: 1. State:
>  >>  > Done. thrown: null. (using nanoTime)
>  >>  > StartupDelay: 16. ConnectTime: 0. Runtime: 200. Loops: 1. State:
>  >>  > Done. thrown: null. (using nanoTime)
>  >>  > StartupDelay: 1. ConnectTime: 0. Runtime: 200. Loops: 1. State:
>  >>  > Done. thrown: null. (using nanoTime)
>  >>  > StartupDelay: 11. ConnectTime: 0. Runtime: 200. Loops: 1. State:
>  >>  > Done. thrown: null. (using nanoTime)
>  >>  > StartupDelay: 18. ConnectTime: 0. Runtime: 201. Loops: 1. State:
>  >>  > Done. thrown: null. (using nanoTime)
>  >>  > StartupDelay: 7. ConnectTime: 17. Runtime: 218. Loops: 1. State:
>  >>  > Done. thrown: null. (using nanoTime)
>  >>  > StartupDelay: 0. ConnectTime: -. Runtime: 100. Loops: 1. State:
>  >>  > Getting Connection. thrown:
>  >>  > org.apache.commons.dbcp.SQLNestedException: Could not retrieve
>  >>  > connection info from pool. (using nanoTime)
>  >>  > StartupDelay: 0. ConnectTime: -. Runtime: 101. Loops: 1. State:
>  >>  > Getting Connection. thrown:
>  >>  > org.apache.commons.dbcp.SQLNestedException: Could not retrieve
>  >>  > connection info from pool. (using nanoTime)
>  >>  > StartupDelay: 1. ConnectTime: -. Runtime: 100. Loops: 1. State:
>  >>  > Getting Connection. thrown:
>  >>  > org.apache.commons.dbcp.SQLNestedException: Could not retrieve
>  >>  > connection info from pool. (using nanoTime)
>  >>  > StartupDelay: 0. ConnectTime: -. Runtime: 100. Loops: 1. State:
>  >>  > Getting Connection. thrown:
>  >>  > org.apache.commons.dbcp.SQLNestedException: Could not retrieve
>  >>  > connection info from pool. (using nanoTime)
>  >>  > StartupDelay: 0. ConnectTime: -. Runtime: 100. Loops: 1. State:
>  >>  > Getting Connection. thrown:
>  >>  > org.apache.commons.dbcp.SQLNestedException: Could not retrieve
>  >>  > connection info from pool. (using nanoTime)
>  >>  > StartupDelay: 0. ConnectTime: -. Runtime: 100. Loops: 1. State:
>  >>  > Getting Connection. thrown:
>  >>  > org.apache.commons.dbcp.SQLNestedException: Could not retrieve
>  >>  > connection info from pool. (using nanoTime)
>  >>  > StartupDelay: 0. ConnectTime: -. Runtime: 101. Loops: 1. State:
>  >>  > Getting Connection. thrown:
>  >>  > org.apache.commons.dbcp.SQLNestedException: Could not retrieve
>  >>  > connection info from pool. (using nanoTime)
>  >>  > StartupDelay: 1. ConnectTime: -. Runtime: 100. Loops: 1. State:
>  >>  > Getting Connection. thrown:
>  >>  > org.apache.commons.dbcp.SQLNestedException: Could not retrieve
>  >>  > connection info from pool. (using nanoTime)
>  >>  > StartupDelay: 0. ConnectTime: -. Runtime: 100. Loops: 1. State:
>  >>  > Getting Connection. thrown:
>  >>  > org.apache.commons.dbcp.SQLNestedException: Could not retrieve
>  >>  > connection info from pool. (using nanoTime)
>  >>  >
>  >>  > There are three things that look odd here.  First is that the second
>  >>  > successful thread should have failed with a timeout.  That may be
>  >>  > explainable by "wakeup delay."  The second is that unless
>  >>  > startupDelay is not reliable, the allocation looks unfair and pool
>  >>  > 1.5 is supposed to implement fairness - i.e., it should be the
>  >>  > threads with lower startupDelays that are served first.
>  >>
>  >>
>  >> Scratch that.  pooledConnectionAndInfo has a synch block before the
>  >>  call to borrowObject to create or acquire the pool.  All threads are
>  >>  going after the same pool.  The first one in has to create the pool.
>  >>
>  >
>  > It's rather odd.
>  >
>  > The successful threads all took 200+ms to complete, during which time
>  > there should be no spare connections available.
>  >
>  > Yet the second thread only appears to have waited 132ms to get the connection.
>  > [Which should have caused a timeout error, but perhaps that's excusable.]
>  > However, it should not be possible to aquire the 11th connection in
>  > less than 200ms.
>  > What happened to that thread?
>  > Did it somehow stall before waiting for the connection?
>  > If so, why is the overall runtime for the thread only 333ms?
>  >
>  > I will add some more info to the debug output.
>
>
> Still no failures.  This weekend, NTP was re-enabled on vmbuild. It
>  had been disabled for some time.

I think at least one build failed after the time was corrected:

http://vmbuild.apache.org/continuum/buildResult.action?projectId=22&projectGroupId=22&projectName=&buildId=267564

Anyway, the test depends on relative time, rather than absolute time,
so the true time is surely irrelevant?

Perhaps if the clock was running extremely slowly or very fast it
might cause JVM scheduling issues, but otherwise I don't see how it
could affect the test.

>  As I said above, loaded guests running under Vmware are known to
>  lose clock accuracy.  See [1], [2].

BTW, both URLs are the same.

>  [1]
>  http://kb.vmware.com/selfservice/microsites/search.do?language=en_US&cmd=displayKC&externalId=1006072
>  [2]
>  http://kb.vmware.com/selfservice/microsites/search.do?language=en_US&cmd=displayKC&externalId=1006072
>
>
>  Phil
>
>
>
>  >
>  >>  Phil
>  >>
>  >>
>  >>
>  >>   This could
>  >>  > point to a pool bug. Finally, the connectTimes for some of the
>  >>  > successful threads are way too long.
>  >>  >
>  >>  > Phil
>  >>
>  >>
>  >>  ---------------------------------------------------------------------
>  >>  To unsubscribe, e-mail: dev-unsubscribe@commons.apache.org
>  >>  For additional commands, e-mail: dev-help@commons.apache.org
>  >>
>  >>
>  >
>  > ---------------------------------------------------------------------
>  > To unsubscribe, e-mail: dev-unsubscribe@commons.apache.org
>  > For additional commands, e-mail: dev-help@commons.apache.org
>  >
>
>
>  ---------------------------------------------------------------------
>  To unsubscribe, e-mail: dev-unsubscribe@commons.apache.org
>  For additional commands, e-mail: dev-help@commons.apache.org
>
>

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@commons.apache.org
For additional commands, e-mail: dev-help@commons.apache.org


Re: [dbcp] multipleThreads test

Posted by Phil Steitz <ph...@gmail.com>.
sebb wrote:
> On 11/01/2010, Phil Steitz <ph...@gmail.com> wrote:
>> Phil Steitz wrote:
>>  > Posting the last failed build output while it is, um....still available:
> 
> I assume this is from:
> 
> http://vmbuild.apache.org/continuum/buildResult.action?buildId=267625&projectId=22
> 
>>  >
>>  > Multithread test time = 489 ms. Threads: 20. Loops: 20. Hold time:
>>  > 200. Maxwait: 100. Done: 11. Did not run: 0. Failed: 9. expectError:
>>  > true
>>  > StartupDelay: 0. ConnectTime: 3. Runtime: 203. Loops: 1. State:
>>  > Done. thrown: null. (using nanoTime)
>>  > StartupDelay: 0. ConnectTime: 132. Runtime: 333. Loops: 1. State:
>>  > Done. thrown: null. (using nanoTime)
>>  > StartupDelay: 42. ConnectTime: 90. Runtime: 290. Loops: 1. State:
>>  > Done. thrown: null. (using nanoTime)
>>  > StartupDelay: 0. ConnectTime: 90. Runtime: 291. Loops: 1. State:
>>  > Done. thrown: null. (using nanoTime)
>>  > StartupDelay: 76. ConnectTime: 14. Runtime: 215. Loops: 1. State:
>>  > Done. thrown: null. (using nanoTime)
>>  > StartupDelay: 13. ConnectTime: 1. Runtime: 202. Loops: 1. State:
>>  > Done. thrown: null. (using nanoTime)
>>  > StartupDelay: 16. ConnectTime: 0. Runtime: 200. Loops: 1. State:
>>  > Done. thrown: null. (using nanoTime)
>>  > StartupDelay: 1. ConnectTime: 0. Runtime: 200. Loops: 1. State:
>>  > Done. thrown: null. (using nanoTime)
>>  > StartupDelay: 11. ConnectTime: 0. Runtime: 200. Loops: 1. State:
>>  > Done. thrown: null. (using nanoTime)
>>  > StartupDelay: 18. ConnectTime: 0. Runtime: 201. Loops: 1. State:
>>  > Done. thrown: null. (using nanoTime)
>>  > StartupDelay: 7. ConnectTime: 17. Runtime: 218. Loops: 1. State:
>>  > Done. thrown: null. (using nanoTime)
>>  > StartupDelay: 0. ConnectTime: -. Runtime: 100. Loops: 1. State:
>>  > Getting Connection. thrown:
>>  > org.apache.commons.dbcp.SQLNestedException: Could not retrieve
>>  > connection info from pool. (using nanoTime)
>>  > StartupDelay: 0. ConnectTime: -. Runtime: 101. Loops: 1. State:
>>  > Getting Connection. thrown:
>>  > org.apache.commons.dbcp.SQLNestedException: Could not retrieve
>>  > connection info from pool. (using nanoTime)
>>  > StartupDelay: 1. ConnectTime: -. Runtime: 100. Loops: 1. State:
>>  > Getting Connection. thrown:
>>  > org.apache.commons.dbcp.SQLNestedException: Could not retrieve
>>  > connection info from pool. (using nanoTime)
>>  > StartupDelay: 0. ConnectTime: -. Runtime: 100. Loops: 1. State:
>>  > Getting Connection. thrown:
>>  > org.apache.commons.dbcp.SQLNestedException: Could not retrieve
>>  > connection info from pool. (using nanoTime)
>>  > StartupDelay: 0. ConnectTime: -. Runtime: 100. Loops: 1. State:
>>  > Getting Connection. thrown:
>>  > org.apache.commons.dbcp.SQLNestedException: Could not retrieve
>>  > connection info from pool. (using nanoTime)
>>  > StartupDelay: 0. ConnectTime: -. Runtime: 100. Loops: 1. State:
>>  > Getting Connection. thrown:
>>  > org.apache.commons.dbcp.SQLNestedException: Could not retrieve
>>  > connection info from pool. (using nanoTime)
>>  > StartupDelay: 0. ConnectTime: -. Runtime: 101. Loops: 1. State:
>>  > Getting Connection. thrown:
>>  > org.apache.commons.dbcp.SQLNestedException: Could not retrieve
>>  > connection info from pool. (using nanoTime)
>>  > StartupDelay: 1. ConnectTime: -. Runtime: 100. Loops: 1. State:
>>  > Getting Connection. thrown:
>>  > org.apache.commons.dbcp.SQLNestedException: Could not retrieve
>>  > connection info from pool. (using nanoTime)
>>  > StartupDelay: 0. ConnectTime: -. Runtime: 100. Loops: 1. State:
>>  > Getting Connection. thrown:
>>  > org.apache.commons.dbcp.SQLNestedException: Could not retrieve
>>  > connection info from pool. (using nanoTime)
>>  >
>>  > There are three things that look odd here.  First is that the second
>>  > successful thread should have failed with a timeout.  That may be
>>  > explainable by "wakeup delay."  The second is that unless
>>  > startupDelay is not reliable, the allocation looks unfair and pool
>>  > 1.5 is supposed to implement fairness - i.e., it should be the
>>  > threads with lower startupDelays that are served first.
>>
>>
>> Scratch that.  pooledConnectionAndInfo has a synch block before the
>>  call to borrowObject to create or acquire the pool.  All threads are
>>  going after the same pool.  The first one in has to create the pool.
>>
> 
> It's rather odd.
> 
> The successful threads all took 200+ms to complete, during which time
> there should be no spare connections available.
> 
> Yet the second thread only appears to have waited 132ms to get the connection.
> [Which should have caused a timeout error, but perhaps that's excusable.]
> However, it should not be possible to aquire the 11th connection in
> less than 200ms.
> What happened to that thread?
> Did it somehow stall before waiting for the connection?
> If so, why is the overall runtime for the thread only 333ms?
> 
> I will add some more info to the debug output.

Still no failures.  This weekend, NTP was re-enabled on vmbuild. It
had been disabled for some time.

As I said above, loaded guests running under Vmware are known to
lose clock accuracy.  See [1], [2].

[1]
http://kb.vmware.com/selfservice/microsites/search.do?language=en_US&cmd=displayKC&externalId=1006072
[2]
http://kb.vmware.com/selfservice/microsites/search.do?language=en_US&cmd=displayKC&externalId=1006072

Phil


> 
>>  Phil
>>
>>
>>
>>   This could
>>  > point to a pool bug. Finally, the connectTimes for some of the
>>  > successful threads are way too long.
>>  >
>>  > Phil
>>
>>
>>  ---------------------------------------------------------------------
>>  To unsubscribe, e-mail: dev-unsubscribe@commons.apache.org
>>  For additional commands, e-mail: dev-help@commons.apache.org
>>
>>
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: dev-unsubscribe@commons.apache.org
> For additional commands, e-mail: dev-help@commons.apache.org
> 


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@commons.apache.org
For additional commands, e-mail: dev-help@commons.apache.org


Re: [dbcp] multipleThreads test

Posted by sebb <se...@gmail.com>.
On 11/01/2010, Phil Steitz <ph...@gmail.com> wrote:
> Phil Steitz wrote:
>  > Posting the last failed build output while it is, um....still available:

I assume this is from:

http://vmbuild.apache.org/continuum/buildResult.action?buildId=267625&projectId=22

>  >
>  > Multithread test time = 489 ms. Threads: 20. Loops: 20. Hold time:
>  > 200. Maxwait: 100. Done: 11. Did not run: 0. Failed: 9. expectError:
>  > true
>  > StartupDelay: 0. ConnectTime: 3. Runtime: 203. Loops: 1. State:
>  > Done. thrown: null. (using nanoTime)
>  > StartupDelay: 0. ConnectTime: 132. Runtime: 333. Loops: 1. State:
>  > Done. thrown: null. (using nanoTime)
>  > StartupDelay: 42. ConnectTime: 90. Runtime: 290. Loops: 1. State:
>  > Done. thrown: null. (using nanoTime)
>  > StartupDelay: 0. ConnectTime: 90. Runtime: 291. Loops: 1. State:
>  > Done. thrown: null. (using nanoTime)
>  > StartupDelay: 76. ConnectTime: 14. Runtime: 215. Loops: 1. State:
>  > Done. thrown: null. (using nanoTime)
>  > StartupDelay: 13. ConnectTime: 1. Runtime: 202. Loops: 1. State:
>  > Done. thrown: null. (using nanoTime)
>  > StartupDelay: 16. ConnectTime: 0. Runtime: 200. Loops: 1. State:
>  > Done. thrown: null. (using nanoTime)
>  > StartupDelay: 1. ConnectTime: 0. Runtime: 200. Loops: 1. State:
>  > Done. thrown: null. (using nanoTime)
>  > StartupDelay: 11. ConnectTime: 0. Runtime: 200. Loops: 1. State:
>  > Done. thrown: null. (using nanoTime)
>  > StartupDelay: 18. ConnectTime: 0. Runtime: 201. Loops: 1. State:
>  > Done. thrown: null. (using nanoTime)
>  > StartupDelay: 7. ConnectTime: 17. Runtime: 218. Loops: 1. State:
>  > Done. thrown: null. (using nanoTime)
>  > StartupDelay: 0. ConnectTime: -. Runtime: 100. Loops: 1. State:
>  > Getting Connection. thrown:
>  > org.apache.commons.dbcp.SQLNestedException: Could not retrieve
>  > connection info from pool. (using nanoTime)
>  > StartupDelay: 0. ConnectTime: -. Runtime: 101. Loops: 1. State:
>  > Getting Connection. thrown:
>  > org.apache.commons.dbcp.SQLNestedException: Could not retrieve
>  > connection info from pool. (using nanoTime)
>  > StartupDelay: 1. ConnectTime: -. Runtime: 100. Loops: 1. State:
>  > Getting Connection. thrown:
>  > org.apache.commons.dbcp.SQLNestedException: Could not retrieve
>  > connection info from pool. (using nanoTime)
>  > StartupDelay: 0. ConnectTime: -. Runtime: 100. Loops: 1. State:
>  > Getting Connection. thrown:
>  > org.apache.commons.dbcp.SQLNestedException: Could not retrieve
>  > connection info from pool. (using nanoTime)
>  > StartupDelay: 0. ConnectTime: -. Runtime: 100. Loops: 1. State:
>  > Getting Connection. thrown:
>  > org.apache.commons.dbcp.SQLNestedException: Could not retrieve
>  > connection info from pool. (using nanoTime)
>  > StartupDelay: 0. ConnectTime: -. Runtime: 100. Loops: 1. State:
>  > Getting Connection. thrown:
>  > org.apache.commons.dbcp.SQLNestedException: Could not retrieve
>  > connection info from pool. (using nanoTime)
>  > StartupDelay: 0. ConnectTime: -. Runtime: 101. Loops: 1. State:
>  > Getting Connection. thrown:
>  > org.apache.commons.dbcp.SQLNestedException: Could not retrieve
>  > connection info from pool. (using nanoTime)
>  > StartupDelay: 1. ConnectTime: -. Runtime: 100. Loops: 1. State:
>  > Getting Connection. thrown:
>  > org.apache.commons.dbcp.SQLNestedException: Could not retrieve
>  > connection info from pool. (using nanoTime)
>  > StartupDelay: 0. ConnectTime: -. Runtime: 100. Loops: 1. State:
>  > Getting Connection. thrown:
>  > org.apache.commons.dbcp.SQLNestedException: Could not retrieve
>  > connection info from pool. (using nanoTime)
>  >
>  > There are three things that look odd here.  First is that the second
>  > successful thread should have failed with a timeout.  That may be
>  > explainable by "wakeup delay."  The second is that unless
>  > startupDelay is not reliable, the allocation looks unfair and pool
>  > 1.5 is supposed to implement fairness - i.e., it should be the
>  > threads with lower startupDelays that are served first.
>
>
> Scratch that.  pooledConnectionAndInfo has a synch block before the
>  call to borrowObject to create or acquire the pool.  All threads are
>  going after the same pool.  The first one in has to create the pool.
>

It's rather odd.

The successful threads all took 200+ms to complete, during which time
there should be no spare connections available.

Yet the second thread only appears to have waited 132ms to get the connection.
[Which should have caused a timeout error, but perhaps that's excusable.]
However, it should not be possible to aquire the 11th connection in
less than 200ms.
What happened to that thread?
Did it somehow stall before waiting for the connection?
If so, why is the overall runtime for the thread only 333ms?

I will add some more info to the debug output.

>  Phil
>
>
>
>   This could
>  > point to a pool bug. Finally, the connectTimes for some of the
>  > successful threads are way too long.
>  >
>  > Phil
>
>
>  ---------------------------------------------------------------------
>  To unsubscribe, e-mail: dev-unsubscribe@commons.apache.org
>  For additional commands, e-mail: dev-help@commons.apache.org
>
>

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@commons.apache.org
For additional commands, e-mail: dev-help@commons.apache.org


Re: [dbcp] multipleThreads test

Posted by Phil Steitz <ph...@gmail.com>.
Phil Steitz wrote:
> Posting the last failed build output while it is, um....still available:
> 
> Multithread test time = 489 ms. Threads: 20. Loops: 20. Hold time:
> 200. Maxwait: 100. Done: 11. Did not run: 0. Failed: 9. expectError:
> true
> StartupDelay: 0. ConnectTime: 3. Runtime: 203. Loops: 1. State:
> Done. thrown: null. (using nanoTime)
> StartupDelay: 0. ConnectTime: 132. Runtime: 333. Loops: 1. State:
> Done. thrown: null. (using nanoTime)
> StartupDelay: 42. ConnectTime: 90. Runtime: 290. Loops: 1. State:
> Done. thrown: null. (using nanoTime)
> StartupDelay: 0. ConnectTime: 90. Runtime: 291. Loops: 1. State:
> Done. thrown: null. (using nanoTime)
> StartupDelay: 76. ConnectTime: 14. Runtime: 215. Loops: 1. State:
> Done. thrown: null. (using nanoTime)
> StartupDelay: 13. ConnectTime: 1. Runtime: 202. Loops: 1. State:
> Done. thrown: null. (using nanoTime)
> StartupDelay: 16. ConnectTime: 0. Runtime: 200. Loops: 1. State:
> Done. thrown: null. (using nanoTime)
> StartupDelay: 1. ConnectTime: 0. Runtime: 200. Loops: 1. State:
> Done. thrown: null. (using nanoTime)
> StartupDelay: 11. ConnectTime: 0. Runtime: 200. Loops: 1. State:
> Done. thrown: null. (using nanoTime)
> StartupDelay: 18. ConnectTime: 0. Runtime: 201. Loops: 1. State:
> Done. thrown: null. (using nanoTime)
> StartupDelay: 7. ConnectTime: 17. Runtime: 218. Loops: 1. State:
> Done. thrown: null. (using nanoTime)
> StartupDelay: 0. ConnectTime: -. Runtime: 100. Loops: 1. State:
> Getting Connection. thrown:
> org.apache.commons.dbcp.SQLNestedException: Could not retrieve
> connection info from pool. (using nanoTime)
> StartupDelay: 0. ConnectTime: -. Runtime: 101. Loops: 1. State:
> Getting Connection. thrown:
> org.apache.commons.dbcp.SQLNestedException: Could not retrieve
> connection info from pool. (using nanoTime)
> StartupDelay: 1. ConnectTime: -. Runtime: 100. Loops: 1. State:
> Getting Connection. thrown:
> org.apache.commons.dbcp.SQLNestedException: Could not retrieve
> connection info from pool. (using nanoTime)
> StartupDelay: 0. ConnectTime: -. Runtime: 100. Loops: 1. State:
> Getting Connection. thrown:
> org.apache.commons.dbcp.SQLNestedException: Could not retrieve
> connection info from pool. (using nanoTime)
> StartupDelay: 0. ConnectTime: -. Runtime: 100. Loops: 1. State:
> Getting Connection. thrown:
> org.apache.commons.dbcp.SQLNestedException: Could not retrieve
> connection info from pool. (using nanoTime)
> StartupDelay: 0. ConnectTime: -. Runtime: 100. Loops: 1. State:
> Getting Connection. thrown:
> org.apache.commons.dbcp.SQLNestedException: Could not retrieve
> connection info from pool. (using nanoTime)
> StartupDelay: 0. ConnectTime: -. Runtime: 101. Loops: 1. State:
> Getting Connection. thrown:
> org.apache.commons.dbcp.SQLNestedException: Could not retrieve
> connection info from pool. (using nanoTime)
> StartupDelay: 1. ConnectTime: -. Runtime: 100. Loops: 1. State:
> Getting Connection. thrown:
> org.apache.commons.dbcp.SQLNestedException: Could not retrieve
> connection info from pool. (using nanoTime)
> StartupDelay: 0. ConnectTime: -. Runtime: 100. Loops: 1. State:
> Getting Connection. thrown:
> org.apache.commons.dbcp.SQLNestedException: Could not retrieve
> connection info from pool. (using nanoTime)
> 
> There are three things that look odd here.  First is that the second
> successful thread should have failed with a timeout.  That may be
> explainable by "wakeup delay."  The second is that unless
> startupDelay is not reliable, the allocation looks unfair and pool
> 1.5 is supposed to implement fairness - i.e., it should be the
> threads with lower startupDelays that are served first.

Scratch that.  pooledConnectionAndInfo has a synch block before the
call to borrowObject to create or acquire the pool.  All threads are
going after the same pool.  The first one in has to create the pool.

Phil


 This could
> point to a pool bug. Finally, the connectTimes for some of the
> successful threads are way too long.
> 
> Phil


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@commons.apache.org
For additional commands, e-mail: dev-help@commons.apache.org


Re: [dbcp] multipleThreads test

Posted by Phil Steitz <ph...@gmail.com>.
Posting the last failed build output while it is, um....still available:

Multithread test time = 489 ms. Threads: 20. Loops: 20. Hold time:
200. Maxwait: 100. Done: 11. Did not run: 0. Failed: 9. expectError:
true
StartupDelay: 0. ConnectTime: 3. Runtime: 203. Loops: 1. State:
Done. thrown: null. (using nanoTime)
StartupDelay: 0. ConnectTime: 132. Runtime: 333. Loops: 1. State:
Done. thrown: null. (using nanoTime)
StartupDelay: 42. ConnectTime: 90. Runtime: 290. Loops: 1. State:
Done. thrown: null. (using nanoTime)
StartupDelay: 0. ConnectTime: 90. Runtime: 291. Loops: 1. State:
Done. thrown: null. (using nanoTime)
StartupDelay: 76. ConnectTime: 14. Runtime: 215. Loops: 1. State:
Done. thrown: null. (using nanoTime)
StartupDelay: 13. ConnectTime: 1. Runtime: 202. Loops: 1. State:
Done. thrown: null. (using nanoTime)
StartupDelay: 16. ConnectTime: 0. Runtime: 200. Loops: 1. State:
Done. thrown: null. (using nanoTime)
StartupDelay: 1. ConnectTime: 0. Runtime: 200. Loops: 1. State:
Done. thrown: null. (using nanoTime)
StartupDelay: 11. ConnectTime: 0. Runtime: 200. Loops: 1. State:
Done. thrown: null. (using nanoTime)
StartupDelay: 18. ConnectTime: 0. Runtime: 201. Loops: 1. State:
Done. thrown: null. (using nanoTime)
StartupDelay: 7. ConnectTime: 17. Runtime: 218. Loops: 1. State:
Done. thrown: null. (using nanoTime)
StartupDelay: 0. ConnectTime: -. Runtime: 100. Loops: 1. State:
Getting Connection. thrown:
org.apache.commons.dbcp.SQLNestedException: Could not retrieve
connection info from pool. (using nanoTime)
StartupDelay: 0. ConnectTime: -. Runtime: 101. Loops: 1. State:
Getting Connection. thrown:
org.apache.commons.dbcp.SQLNestedException: Could not retrieve
connection info from pool. (using nanoTime)
StartupDelay: 1. ConnectTime: -. Runtime: 100. Loops: 1. State:
Getting Connection. thrown:
org.apache.commons.dbcp.SQLNestedException: Could not retrieve
connection info from pool. (using nanoTime)
StartupDelay: 0. ConnectTime: -. Runtime: 100. Loops: 1. State:
Getting Connection. thrown:
org.apache.commons.dbcp.SQLNestedException: Could not retrieve
connection info from pool. (using nanoTime)
StartupDelay: 0. ConnectTime: -. Runtime: 100. Loops: 1. State:
Getting Connection. thrown:
org.apache.commons.dbcp.SQLNestedException: Could not retrieve
connection info from pool. (using nanoTime)
StartupDelay: 0. ConnectTime: -. Runtime: 100. Loops: 1. State:
Getting Connection. thrown:
org.apache.commons.dbcp.SQLNestedException: Could not retrieve
connection info from pool. (using nanoTime)
StartupDelay: 0. ConnectTime: -. Runtime: 101. Loops: 1. State:
Getting Connection. thrown:
org.apache.commons.dbcp.SQLNestedException: Could not retrieve
connection info from pool. (using nanoTime)
StartupDelay: 1. ConnectTime: -. Runtime: 100. Loops: 1. State:
Getting Connection. thrown:
org.apache.commons.dbcp.SQLNestedException: Could not retrieve
connection info from pool. (using nanoTime)
StartupDelay: 0. ConnectTime: -. Runtime: 100. Loops: 1. State:
Getting Connection. thrown:
org.apache.commons.dbcp.SQLNestedException: Could not retrieve
connection info from pool. (using nanoTime)

There are three things that look odd here.  First is that the second
successful thread should have failed with a timeout.  That may be
explainable by "wakeup delay."  The second is that unless
startupDelay is not reliable, the allocation looks unfair and pool
1.5 is supposed to implement fairness - i.e., it should be the
threads with lower startupDelays that are served first. This could
point to a pool bug. Finally, the connectTimes for some of the
successful threads are way too long.

Phil

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@commons.apache.org
For additional commands, e-mail: dev-help@commons.apache.org


Re: [dbcp] multipleThreads test

Posted by Phil Steitz <ph...@gmail.com>.
sebb wrote:
> On 10/01/2010, Phil Steitz <ph...@gmail.com> wrote:
>> sebb wrote:
>>  > On 10/01/2010, Phil Steitz <ph...@gmail.com> wrote:
>>  >> sebb wrote:
>>  >>  > On 10/01/2010, Phil Steitz <ph...@gmail.com> wrote:
>>  >>  >> sebb wrote:
>>  >>  >>  > Thanks.
>>  >>  >>  >
>>  >>  >>  > Looks like I did not complete the fixes properly when I added the
>>  >>  >>  > loopOnce parameter to PoolTest.
>>  >>  >>
>>  >>  >>  I think I found (and fixed) another problem.  See r897720.
>>  >>  >
>>  >>  > The wait in question is purely to allow the threads to start, so I
>>  >>  > think it should not depend on the value of maxWait (or indeed
>>  >>  > holdTime). Originally it was set to 10L * holdTime, which meant that
>>  >>  > it did always not work well for holdTime = 1.
>>  >>
>>  >>
>>  >> OK, then I must be missing something.  Since stop can interrupt run,
>>  >>  it would seem to me that entering the stop loop immediately after
>>  >>  this wait is going to stop all of the threads, giving them all just
>>  >>  whatever the wait is to complete.
>>  >
>>  > In the case where the loop only operates once, so long as the wait
>>  > time is long enough to allow all the threads to start then it won't
>>  > affect further processing of the PoolTest threads. However if it is
>>  > much longer than maxWait or holdTime, the test will take longer than
>>  > necessary.
>>  >
>>  > For the multi-loop case, the wait time must again be enough to allow
>>  > the threads to start. This guarantees that the threads will run at
>>  > least once. The overall run-time of the test (and the number of loops)
>>  > is controlled by the wait time, because the holdTime is very short in
>>  > comparison.
>>
>>
>> You are right.  Sorry.
> 
> No problem.
> 
> It looks like only the testMaxWait() test now loops more that once.
> I think testMultipleThreads1() should also loop, as this will show
> that 20 threads can share 10 connections without problems. I'll fix
> that shortly.

Yes.
> 
> I'm not sure whether testMaxWait() needs to allow looping; however it
> should never do so as all threads will timeout.

Yes, I see no need for looping on this.

Phil
> 
> 
>>  Phil
>>
>>  >>  That, I was assuming, is why the
>>  >>  1.2.2 version waited 10 * holdTime, which would not really have been
>>  >>  quite right - better a function of maxWait.
>>  >
>>  > The 1.2.2 version also handled completion differently - it did not
>>  > wait for the threads to complete, and it did not have a loopOnce
>>  > option. Provided that maxWait expired before holdTime, then at least
>>  > one thread would fail, and this would stop all the threads. But this
>>  > was not always happening, so I introduced the loopOnce parameter.
>>  >
>>  >>  Phil
>>  >>
>>  >>
>>  >>  >
>>  >>  >>  >
>>  >>  >>  > It was quite tricky following the Continuum build output, as the date
>>  >>  >>  > was 2 days behind, and the mail for the failed runs is not always
>>  >>  >>  > accurate - if the "Exit code" is 127, then most of the email contents
>>  >>  >>  > is inaccurate.
>>  >>  >>  >
>>  >>  >>  > I have raised http://jira.codehaus.org/browse/CONTINUUM-2428 for the
>>  >>  >>  > misleading info.
>>  >>  >>  >
>>  >>  >>  > On 10/01/2010, Phil Steitz <ph...@gmail.com> wrote:
>>  >>  >>  >> From the debugging added to some previously failed builds, I saw
>>  >>  >>  >>  loop = 2 for some threads.  Threads should not be looping.  Second
>>  >>  >>  >>  loop by a thread that succeeded the first time that throws will not
>>  >>  >>  >>  change success state - so it looks like a success -> not enough
>>  >>  >>  >>  failures.
>>  >>  >>  >>
>>  >>  >>  >>  Phil
>>  >>  >>  >>
>>  >>  >>  >>
>>  >>  >>  >>  psteitz@apache.org wrote:
>>  >>  >>  >>  > Author: psteitz
>>  >>  >>  >>  > Date: Sun Jan 10 18:21:03 2010
>>  >>  >>  >>  > New Revision: 897678
>>  >>  >>  >>  >
>>  >>  >>  >>  > URL: http://svn.apache.org/viewvc?rev=897678&view=rev
>>  >>  >>  >>  > Log:
>>  >>  >>  >>  > Eliminated unintended looping in mutipleThreads test.
>>  >>  >>  >>  >
>>  >>  >>  >>  > Modified:
>>  >>  >>  >>  >     commons/proper/dbcp/trunk/src/test/org/apache/commons/dbcp/TestConnectionPool.java
>>  >>  >>  >>  >     commons/proper/dbcp/trunk/src/test/org/apache/commons/dbcp/datasources/TestPerUserPoolDataSource.java
>>  >>  >>  >>  >     commons/proper/dbcp/trunk/src/test/org/apache/commons/dbcp/datasources/TestSharedPoolDataSource.java
>>  >>  >>  >>  >
>>  >>  >>  >>  > Modified: commons/proper/dbcp/trunk/src/test/org/apache/commons/dbcp/TestConnectionPool.java
>>  >>  >>  >>  > URL: http://svn.apache.org/viewvc/commons/proper/dbcp/trunk/src/test/org/apache/commons/dbcp/TestConnectionPool.java?rev=897678&r1=897677&r2=897678&view=diff
>>  >>  >>  >>  > ==============================================================================
>>  >>  >>  >>  > --- commons/proper/dbcp/trunk/src/test/org/apache/commons/dbcp/TestConnectionPool.java (original)
>>  >>  >>  >>  > +++ commons/proper/dbcp/trunk/src/test/org/apache/commons/dbcp/TestConnectionPool.java Sun Jan 10 18:21:03 2010
>>  >>  >>  >>  > @@ -683,7 +683,21 @@
>>  >>  >>  >>  >          }
>>  >>  >>  >>  >      }
>>  >>  >>  >>  >
>>  >>  >>  >>  > -    protected void multipleThreads(final int holdTime, final boolean expectError, long maxWait)
>>  >>  >>  >>  > +    /**
>>  >>  >>  >>  > +     * Launches a group of 2 * getMaxActive() threads, each of which will attempt to obtain a connection
>>  >>  >>  >>  > +     * from the pool, hold it for <holdTime> ms, and then return it to the pool.  If <loopOnce> is false,
>>  >>  >>  >>  > +     * threads will continue this process indefinitely.  If <expectingError> is true, exactly 1/2 of the
>>  >>  >>  >>  > +     * threads are expected to either throw exceptions or fail to complete. If <expectingError> is false,
>>  >>  >>  >>  > +     * all threads are expected to complete successfully.
>>  >>  >>  >>  > +     *
>>  >>  >>  >>  > +     * @param holdTime time in ms that a thread holds a connection before returning it to the pool
>>  >>  >>  >>  > +     * @param expectError whether or not an error is expected
>>  >>  >>  >>  > +     * @param loopOnce whether threads should complete the borrow - hold - return cycle only once, or loop indefinitely
>>  >>  >>  >>  > +     * @param maxWait passed in by client - has no impact on the test itself, but does get reported
>>  >>  >>  >>  > +     *
>>  >>  >>  >>  > +     * @throws Exception
>>  >>  >>  >>  > +     */
>>  >>  >>  >>  > +    protected void multipleThreads(final int holdTime, final boolean expectError, final boolean loopOnce, final long maxWait)
>>  >>  >>  >>  >              throws Exception {
>>  >>  >>  >>  >                  long startTime = timeStamp();
>>  >>  >>  >>  >                  final PoolTest[] pts = new PoolTest[2 * getMaxActive()];
>>  >>  >>  >>  > @@ -696,8 +710,7 @@
>>  >>  >>  >>  >                      }
>>  >>  >>  >>  >                  };
>>  >>  >>  >>  >                  for (int i = 0; i < pts.length; i++) {
>>  >>  >>  >>  > -                    // If we are expecting an error, don't allow successful threads to loop
>>  >>  >>  >>  > -                    (pts[i] = new PoolTest(threadGroup, holdTime, expectError)).start();
>>  >>  >>  >>  > +                    (pts[i] = new PoolTest(threadGroup, holdTime, expectError, loopOnce)).start();
>>  >>  >>  >>  >                  }
>>  >>  >>  >>  >
>>  >>  >>  >>  >                  Thread.sleep(100L); // Wait for long enough to allow threads to start
>>  >>  >>  >>  >
>>  >>  >>  >>  > Modified: commons/proper/dbcp/trunk/src/test/org/apache/commons/dbcp/datasources/TestPerUserPoolDataSource.java
>>  >>  >>  >>  > URL: http://svn.apache.org/viewvc/commons/proper/dbcp/trunk/src/test/org/apache/commons/dbcp/datasources/TestPerUserPoolDataSource.java?rev=897678&r1=897677&r2=897678&view=diff
>>  >>  >>  >>  > ==============================================================================
>>  >>  >>  >>  > --- commons/proper/dbcp/trunk/src/test/org/apache/commons/dbcp/datasources/TestPerUserPoolDataSource.java (original)
>>  >>  >>  >>  > +++ commons/proper/dbcp/trunk/src/test/org/apache/commons/dbcp/datasources/TestPerUserPoolDataSource.java Sun Jan 10 18:21:03 2010
>>  >>  >>  >>  > @@ -378,11 +378,11 @@
>>  >>  >>  >>  >          final int defaultMaxWait = 430;
>>  >>  >>  >>  >          ((PerUserPoolDataSource) ds).setDefaultMaxWait(defaultMaxWait);
>>  >>  >>  >>  >          ((PerUserPoolDataSource) ds).setPerUserMaxWait("foo",new Integer(defaultMaxWait));
>>  >>  >>  >>  > -        multipleThreads(1, false, defaultMaxWait);
>>  >>  >>  >>  > +        multipleThreads(1, false, false, defaultMaxWait);
>>  >>  >>  >>  >      }
>>  >>  >>  >>  >
>>  >>  >>  >>  >      public void testMultipleThreads2() throws Exception {
>>  >>  >>  >>  > -        multipleThreads(2 * (int)(getMaxWait()), true, getMaxWait());
>>  >>  >>  >>  > +        multipleThreads(2 * (int)(getMaxWait()), true, false, getMaxWait());
>>  >>  >>  >>  >      }
>>  >>  >>  >>  >
>>  >>  >>  >>  >      public void testTransactionIsolationBehavior() throws Exception {
>>  >>  >>  >>  >
>>  >>  >>  >>  > Modified: commons/proper/dbcp/trunk/src/test/org/apache/commons/dbcp/datasources/TestSharedPoolDataSource.java
>>  >>  >>  >>  > URL: http://svn.apache.org/viewvc/commons/proper/dbcp/trunk/src/test/org/apache/commons/dbcp/datasources/TestSharedPoolDataSource.java?rev=897678&r1=897677&r2=897678&view=diff
>>  >>  >>  >>  > ==============================================================================
>>  >>  >>  >>  > --- commons/proper/dbcp/trunk/src/test/org/apache/commons/dbcp/datasources/TestSharedPoolDataSource.java (original)
>>  >>  >>  >>  > +++ commons/proper/dbcp/trunk/src/test/org/apache/commons/dbcp/datasources/TestSharedPoolDataSource.java Sun Jan 10 18:21:03 2010
>>  >>  >>  >>  > @@ -368,11 +368,11 @@
>>  >>  >>  >>  >          // some JVMs, e.g. Windows.
>>  >>  >>  >>  >          final int defaultMaxWait = 430;
>>  >>  >>  >>  >          ((SharedPoolDataSource) ds).setMaxWait(defaultMaxWait);
>>  >>  >>  >>  > -        multipleThreads(1, false, defaultMaxWait);
>>  >>  >>  >>  > +        multipleThreads(1, false, false, defaultMaxWait);
>>  >>  >>  >>  >      }
>>  >>  >>  >>  >
>>  >>  >>  >>  >      public void testMultipleThreads2() throws Exception {
>>  >>  >>  >>  > -        multipleThreads(2 * (int)(getMaxWait()), true, getMaxWait());
>>  >>  >>  >>  > +        multipleThreads(2 * (int)(getMaxWait()), true, false, getMaxWait());
>>  >>  >>  >>  >      }
>>  >>  >>  >>  >
>>  >>  >>  >>  >      public void testTransactionIsolationBehavior() throws Exception {
>>  >>  >>  >>  >
>>  >>  >>  >>  >
>>  >>  >>  >>
>>  >>  >>  >>
>>  >>  >>  >>
>>  >>  >>  >> ---------------------------------------------------------------------
>>  >>  >>  >>  To unsubscribe, e-mail: dev-unsubscribe@commons.apache.org
>>  >>  >>  >>  For additional commands, e-mail: dev-help@commons.apache.org
>>  >>  >>  >>
>>  >>  >>  >>
>>  >>  >>  >
>>  >>  >>  > ---------------------------------------------------------------------
>>  >>  >>  > To unsubscribe, e-mail: dev-unsubscribe@commons.apache.org
>>  >>  >>  > For additional commands, e-mail: dev-help@commons.apache.org
>>  >>  >>  >
>>  >>  >>
>>  >>  >>
>>  >>  >>  ---------------------------------------------------------------------
>>  >>  >>  To unsubscribe, e-mail: dev-unsubscribe@commons.apache.org
>>  >>  >>  For additional commands, e-mail: dev-help@commons.apache.org
>>  >>  >>
>>  >>  >>
>>  >>  >
>>  >>  > ---------------------------------------------------------------------
>>  >>  > To unsubscribe, e-mail: dev-unsubscribe@commons.apache.org
>>  >>  > For additional commands, e-mail: dev-help@commons.apache.org
>>  >>  >
>>  >>
>>  >>
>>  >>  ---------------------------------------------------------------------
>>  >>  To unsubscribe, e-mail: dev-unsubscribe@commons.apache.org
>>  >>  For additional commands, e-mail: dev-help@commons.apache.org
>>  >>
>>  >>
>>  >
>>  > ---------------------------------------------------------------------
>>  > To unsubscribe, e-mail: dev-unsubscribe@commons.apache.org
>>  > For additional commands, e-mail: dev-help@commons.apache.org
>>  >
>>
>>
>>  ---------------------------------------------------------------------
>>  To unsubscribe, e-mail: dev-unsubscribe@commons.apache.org
>>  For additional commands, e-mail: dev-help@commons.apache.org
>>
>>
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: dev-unsubscribe@commons.apache.org
> For additional commands, e-mail: dev-help@commons.apache.org
> 


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@commons.apache.org
For additional commands, e-mail: dev-help@commons.apache.org


Re: [dbcp] multipleThreads test

Posted by sebb <se...@gmail.com>.
On 10/01/2010, Phil Steitz <ph...@gmail.com> wrote:
> sebb wrote:
>  > On 10/01/2010, Phil Steitz <ph...@gmail.com> wrote:
>  >> sebb wrote:
>  >>  > On 10/01/2010, Phil Steitz <ph...@gmail.com> wrote:
>  >>  >> sebb wrote:
>  >>  >>  > Thanks.
>  >>  >>  >
>  >>  >>  > Looks like I did not complete the fixes properly when I added the
>  >>  >>  > loopOnce parameter to PoolTest.
>  >>  >>
>  >>  >>  I think I found (and fixed) another problem.  See r897720.
>  >>  >
>  >>  > The wait in question is purely to allow the threads to start, so I
>  >>  > think it should not depend on the value of maxWait (or indeed
>  >>  > holdTime). Originally it was set to 10L * holdTime, which meant that
>  >>  > it did always not work well for holdTime = 1.
>  >>
>  >>
>  >> OK, then I must be missing something.  Since stop can interrupt run,
>  >>  it would seem to me that entering the stop loop immediately after
>  >>  this wait is going to stop all of the threads, giving them all just
>  >>  whatever the wait is to complete.
>  >
>  > In the case where the loop only operates once, so long as the wait
>  > time is long enough to allow all the threads to start then it won't
>  > affect further processing of the PoolTest threads. However if it is
>  > much longer than maxWait or holdTime, the test will take longer than
>  > necessary.
>  >
>  > For the multi-loop case, the wait time must again be enough to allow
>  > the threads to start. This guarantees that the threads will run at
>  > least once. The overall run-time of the test (and the number of loops)
>  > is controlled by the wait time, because the holdTime is very short in
>  > comparison.
>
>
> You are right.  Sorry.

No problem.

It looks like only the testMaxWait() test now loops more that once.
I think testMultipleThreads1() should also loop, as this will show
that 20 threads can share 10 connections without problems. I'll fix
that shortly.

I'm not sure whether testMaxWait() needs to allow looping; however it
should never do so as all threads will timeout.


>
>  Phil
>
> >
>  >>  That, I was assuming, is why the
>  >>  1.2.2 version waited 10 * holdTime, which would not really have been
>  >>  quite right - better a function of maxWait.
>  >
>  > The 1.2.2 version also handled completion differently - it did not
>  > wait for the threads to complete, and it did not have a loopOnce
>  > option. Provided that maxWait expired before holdTime, then at least
>  > one thread would fail, and this would stop all the threads. But this
>  > was not always happening, so I introduced the loopOnce parameter.
>  >
>  >>  Phil
>  >>
>  >>
>  >>  >
>  >>  >>  >
>  >>  >>  > It was quite tricky following the Continuum build output, as the date
>  >>  >>  > was 2 days behind, and the mail for the failed runs is not always
>  >>  >>  > accurate - if the "Exit code" is 127, then most of the email contents
>  >>  >>  > is inaccurate.
>  >>  >>  >
>  >>  >>  > I have raised http://jira.codehaus.org/browse/CONTINUUM-2428 for the
>  >>  >>  > misleading info.
>  >>  >>  >
>  >>  >>  > On 10/01/2010, Phil Steitz <ph...@gmail.com> wrote:
>  >>  >>  >> From the debugging added to some previously failed builds, I saw
>  >>  >>  >>  loop = 2 for some threads.  Threads should not be looping.  Second
>  >>  >>  >>  loop by a thread that succeeded the first time that throws will not
>  >>  >>  >>  change success state - so it looks like a success -> not enough
>  >>  >>  >>  failures.
>  >>  >>  >>
>  >>  >>  >>  Phil
>  >>  >>  >>
>  >>  >>  >>
>  >>  >>  >>  psteitz@apache.org wrote:
>  >>  >>  >>  > Author: psteitz
>  >>  >>  >>  > Date: Sun Jan 10 18:21:03 2010
>  >>  >>  >>  > New Revision: 897678
>  >>  >>  >>  >
>  >>  >>  >>  > URL: http://svn.apache.org/viewvc?rev=897678&view=rev
>  >>  >>  >>  > Log:
>  >>  >>  >>  > Eliminated unintended looping in mutipleThreads test.
>  >>  >>  >>  >
>  >>  >>  >>  > Modified:
>  >>  >>  >>  >     commons/proper/dbcp/trunk/src/test/org/apache/commons/dbcp/TestConnectionPool.java
>  >>  >>  >>  >     commons/proper/dbcp/trunk/src/test/org/apache/commons/dbcp/datasources/TestPerUserPoolDataSource.java
>  >>  >>  >>  >     commons/proper/dbcp/trunk/src/test/org/apache/commons/dbcp/datasources/TestSharedPoolDataSource.java
>  >>  >>  >>  >
>  >>  >>  >>  > Modified: commons/proper/dbcp/trunk/src/test/org/apache/commons/dbcp/TestConnectionPool.java
>  >>  >>  >>  > URL: http://svn.apache.org/viewvc/commons/proper/dbcp/trunk/src/test/org/apache/commons/dbcp/TestConnectionPool.java?rev=897678&r1=897677&r2=897678&view=diff
>  >>  >>  >>  > ==============================================================================
>  >>  >>  >>  > --- commons/proper/dbcp/trunk/src/test/org/apache/commons/dbcp/TestConnectionPool.java (original)
>  >>  >>  >>  > +++ commons/proper/dbcp/trunk/src/test/org/apache/commons/dbcp/TestConnectionPool.java Sun Jan 10 18:21:03 2010
>  >>  >>  >>  > @@ -683,7 +683,21 @@
>  >>  >>  >>  >          }
>  >>  >>  >>  >      }
>  >>  >>  >>  >
>  >>  >>  >>  > -    protected void multipleThreads(final int holdTime, final boolean expectError, long maxWait)
>  >>  >>  >>  > +    /**
>  >>  >>  >>  > +     * Launches a group of 2 * getMaxActive() threads, each of which will attempt to obtain a connection
>  >>  >>  >>  > +     * from the pool, hold it for <holdTime> ms, and then return it to the pool.  If <loopOnce> is false,
>  >>  >>  >>  > +     * threads will continue this process indefinitely.  If <expectingError> is true, exactly 1/2 of the
>  >>  >>  >>  > +     * threads are expected to either throw exceptions or fail to complete. If <expectingError> is false,
>  >>  >>  >>  > +     * all threads are expected to complete successfully.
>  >>  >>  >>  > +     *
>  >>  >>  >>  > +     * @param holdTime time in ms that a thread holds a connection before returning it to the pool
>  >>  >>  >>  > +     * @param expectError whether or not an error is expected
>  >>  >>  >>  > +     * @param loopOnce whether threads should complete the borrow - hold - return cycle only once, or loop indefinitely
>  >>  >>  >>  > +     * @param maxWait passed in by client - has no impact on the test itself, but does get reported
>  >>  >>  >>  > +     *
>  >>  >>  >>  > +     * @throws Exception
>  >>  >>  >>  > +     */
>  >>  >>  >>  > +    protected void multipleThreads(final int holdTime, final boolean expectError, final boolean loopOnce, final long maxWait)
>  >>  >>  >>  >              throws Exception {
>  >>  >>  >>  >                  long startTime = timeStamp();
>  >>  >>  >>  >                  final PoolTest[] pts = new PoolTest[2 * getMaxActive()];
>  >>  >>  >>  > @@ -696,8 +710,7 @@
>  >>  >>  >>  >                      }
>  >>  >>  >>  >                  };
>  >>  >>  >>  >                  for (int i = 0; i < pts.length; i++) {
>  >>  >>  >>  > -                    // If we are expecting an error, don't allow successful threads to loop
>  >>  >>  >>  > -                    (pts[i] = new PoolTest(threadGroup, holdTime, expectError)).start();
>  >>  >>  >>  > +                    (pts[i] = new PoolTest(threadGroup, holdTime, expectError, loopOnce)).start();
>  >>  >>  >>  >                  }
>  >>  >>  >>  >
>  >>  >>  >>  >                  Thread.sleep(100L); // Wait for long enough to allow threads to start
>  >>  >>  >>  >
>  >>  >>  >>  > Modified: commons/proper/dbcp/trunk/src/test/org/apache/commons/dbcp/datasources/TestPerUserPoolDataSource.java
>  >>  >>  >>  > URL: http://svn.apache.org/viewvc/commons/proper/dbcp/trunk/src/test/org/apache/commons/dbcp/datasources/TestPerUserPoolDataSource.java?rev=897678&r1=897677&r2=897678&view=diff
>  >>  >>  >>  > ==============================================================================
>  >>  >>  >>  > --- commons/proper/dbcp/trunk/src/test/org/apache/commons/dbcp/datasources/TestPerUserPoolDataSource.java (original)
>  >>  >>  >>  > +++ commons/proper/dbcp/trunk/src/test/org/apache/commons/dbcp/datasources/TestPerUserPoolDataSource.java Sun Jan 10 18:21:03 2010
>  >>  >>  >>  > @@ -378,11 +378,11 @@
>  >>  >>  >>  >          final int defaultMaxWait = 430;
>  >>  >>  >>  >          ((PerUserPoolDataSource) ds).setDefaultMaxWait(defaultMaxWait);
>  >>  >>  >>  >          ((PerUserPoolDataSource) ds).setPerUserMaxWait("foo",new Integer(defaultMaxWait));
>  >>  >>  >>  > -        multipleThreads(1, false, defaultMaxWait);
>  >>  >>  >>  > +        multipleThreads(1, false, false, defaultMaxWait);
>  >>  >>  >>  >      }
>  >>  >>  >>  >
>  >>  >>  >>  >      public void testMultipleThreads2() throws Exception {
>  >>  >>  >>  > -        multipleThreads(2 * (int)(getMaxWait()), true, getMaxWait());
>  >>  >>  >>  > +        multipleThreads(2 * (int)(getMaxWait()), true, false, getMaxWait());
>  >>  >>  >>  >      }
>  >>  >>  >>  >
>  >>  >>  >>  >      public void testTransactionIsolationBehavior() throws Exception {
>  >>  >>  >>  >
>  >>  >>  >>  > Modified: commons/proper/dbcp/trunk/src/test/org/apache/commons/dbcp/datasources/TestSharedPoolDataSource.java
>  >>  >>  >>  > URL: http://svn.apache.org/viewvc/commons/proper/dbcp/trunk/src/test/org/apache/commons/dbcp/datasources/TestSharedPoolDataSource.java?rev=897678&r1=897677&r2=897678&view=diff
>  >>  >>  >>  > ==============================================================================
>  >>  >>  >>  > --- commons/proper/dbcp/trunk/src/test/org/apache/commons/dbcp/datasources/TestSharedPoolDataSource.java (original)
>  >>  >>  >>  > +++ commons/proper/dbcp/trunk/src/test/org/apache/commons/dbcp/datasources/TestSharedPoolDataSource.java Sun Jan 10 18:21:03 2010
>  >>  >>  >>  > @@ -368,11 +368,11 @@
>  >>  >>  >>  >          // some JVMs, e.g. Windows.
>  >>  >>  >>  >          final int defaultMaxWait = 430;
>  >>  >>  >>  >          ((SharedPoolDataSource) ds).setMaxWait(defaultMaxWait);
>  >>  >>  >>  > -        multipleThreads(1, false, defaultMaxWait);
>  >>  >>  >>  > +        multipleThreads(1, false, false, defaultMaxWait);
>  >>  >>  >>  >      }
>  >>  >>  >>  >
>  >>  >>  >>  >      public void testMultipleThreads2() throws Exception {
>  >>  >>  >>  > -        multipleThreads(2 * (int)(getMaxWait()), true, getMaxWait());
>  >>  >>  >>  > +        multipleThreads(2 * (int)(getMaxWait()), true, false, getMaxWait());
>  >>  >>  >>  >      }
>  >>  >>  >>  >
>  >>  >>  >>  >      public void testTransactionIsolationBehavior() throws Exception {
>  >>  >>  >>  >
>  >>  >>  >>  >
>  >>  >>  >>
>  >>  >>  >>
>  >>  >>  >>
>  >>  >>  >> ---------------------------------------------------------------------
>  >>  >>  >>  To unsubscribe, e-mail: dev-unsubscribe@commons.apache.org
>  >>  >>  >>  For additional commands, e-mail: dev-help@commons.apache.org
>  >>  >>  >>
>  >>  >>  >>
>  >>  >>  >
>  >>  >>  > ---------------------------------------------------------------------
>  >>  >>  > To unsubscribe, e-mail: dev-unsubscribe@commons.apache.org
>  >>  >>  > For additional commands, e-mail: dev-help@commons.apache.org
>  >>  >>  >
>  >>  >>
>  >>  >>
>  >>  >>  ---------------------------------------------------------------------
>  >>  >>  To unsubscribe, e-mail: dev-unsubscribe@commons.apache.org
>  >>  >>  For additional commands, e-mail: dev-help@commons.apache.org
>  >>  >>
>  >>  >>
>  >>  >
>  >>  > ---------------------------------------------------------------------
>  >>  > To unsubscribe, e-mail: dev-unsubscribe@commons.apache.org
>  >>  > For additional commands, e-mail: dev-help@commons.apache.org
>  >>  >
>  >>
>  >>
>  >>  ---------------------------------------------------------------------
>  >>  To unsubscribe, e-mail: dev-unsubscribe@commons.apache.org
>  >>  For additional commands, e-mail: dev-help@commons.apache.org
>  >>
>  >>
>  >
>  > ---------------------------------------------------------------------
>  > To unsubscribe, e-mail: dev-unsubscribe@commons.apache.org
>  > For additional commands, e-mail: dev-help@commons.apache.org
>  >
>
>
>  ---------------------------------------------------------------------
>  To unsubscribe, e-mail: dev-unsubscribe@commons.apache.org
>  For additional commands, e-mail: dev-help@commons.apache.org
>
>

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@commons.apache.org
For additional commands, e-mail: dev-help@commons.apache.org


Re: [dbcp] multipleThreads test

Posted by Phil Steitz <ph...@gmail.com>.
sebb wrote:
> On 10/01/2010, Phil Steitz <ph...@gmail.com> wrote:
>> sebb wrote:
>>  > On 10/01/2010, Phil Steitz <ph...@gmail.com> wrote:
>>  >> sebb wrote:
>>  >>  > Thanks.
>>  >>  >
>>  >>  > Looks like I did not complete the fixes properly when I added the
>>  >>  > loopOnce parameter to PoolTest.
>>  >>
>>  >>  I think I found (and fixed) another problem.  See r897720.
>>  >
>>  > The wait in question is purely to allow the threads to start, so I
>>  > think it should not depend on the value of maxWait (or indeed
>>  > holdTime). Originally it was set to 10L * holdTime, which meant that
>>  > it did always not work well for holdTime = 1.
>>
>>
>> OK, then I must be missing something.  Since stop can interrupt run,
>>  it would seem to me that entering the stop loop immediately after
>>  this wait is going to stop all of the threads, giving them all just
>>  whatever the wait is to complete.
> 
> In the case where the loop only operates once, so long as the wait
> time is long enough to allow all the threads to start then it won't
> affect further processing of the PoolTest threads. However if it is
> much longer than maxWait or holdTime, the test will take longer than
> necessary.
> 
> For the multi-loop case, the wait time must again be enough to allow
> the threads to start. This guarantees that the threads will run at
> least once. The overall run-time of the test (and the number of loops)
> is controlled by the wait time, because the holdTime is very short in
> comparison.

You are right.  Sorry.

Phil
> 
>>  That, I was assuming, is why the
>>  1.2.2 version waited 10 * holdTime, which would not really have been
>>  quite right - better a function of maxWait.
> 
> The 1.2.2 version also handled completion differently - it did not
> wait for the threads to complete, and it did not have a loopOnce
> option. Provided that maxWait expired before holdTime, then at least
> one thread would fail, and this would stop all the threads. But this
> was not always happening, so I introduced the loopOnce parameter.
> 
>>  Phil
>>
>>
>>  >
>>  >>  >
>>  >>  > It was quite tricky following the Continuum build output, as the date
>>  >>  > was 2 days behind, and the mail for the failed runs is not always
>>  >>  > accurate - if the "Exit code" is 127, then most of the email contents
>>  >>  > is inaccurate.
>>  >>  >
>>  >>  > I have raised http://jira.codehaus.org/browse/CONTINUUM-2428 for the
>>  >>  > misleading info.
>>  >>  >
>>  >>  > On 10/01/2010, Phil Steitz <ph...@gmail.com> wrote:
>>  >>  >> From the debugging added to some previously failed builds, I saw
>>  >>  >>  loop = 2 for some threads.  Threads should not be looping.  Second
>>  >>  >>  loop by a thread that succeeded the first time that throws will not
>>  >>  >>  change success state - so it looks like a success -> not enough
>>  >>  >>  failures.
>>  >>  >>
>>  >>  >>  Phil
>>  >>  >>
>>  >>  >>
>>  >>  >>  psteitz@apache.org wrote:
>>  >>  >>  > Author: psteitz
>>  >>  >>  > Date: Sun Jan 10 18:21:03 2010
>>  >>  >>  > New Revision: 897678
>>  >>  >>  >
>>  >>  >>  > URL: http://svn.apache.org/viewvc?rev=897678&view=rev
>>  >>  >>  > Log:
>>  >>  >>  > Eliminated unintended looping in mutipleThreads test.
>>  >>  >>  >
>>  >>  >>  > Modified:
>>  >>  >>  >     commons/proper/dbcp/trunk/src/test/org/apache/commons/dbcp/TestConnectionPool.java
>>  >>  >>  >     commons/proper/dbcp/trunk/src/test/org/apache/commons/dbcp/datasources/TestPerUserPoolDataSource.java
>>  >>  >>  >     commons/proper/dbcp/trunk/src/test/org/apache/commons/dbcp/datasources/TestSharedPoolDataSource.java
>>  >>  >>  >
>>  >>  >>  > Modified: commons/proper/dbcp/trunk/src/test/org/apache/commons/dbcp/TestConnectionPool.java
>>  >>  >>  > URL: http://svn.apache.org/viewvc/commons/proper/dbcp/trunk/src/test/org/apache/commons/dbcp/TestConnectionPool.java?rev=897678&r1=897677&r2=897678&view=diff
>>  >>  >>  > ==============================================================================
>>  >>  >>  > --- commons/proper/dbcp/trunk/src/test/org/apache/commons/dbcp/TestConnectionPool.java (original)
>>  >>  >>  > +++ commons/proper/dbcp/trunk/src/test/org/apache/commons/dbcp/TestConnectionPool.java Sun Jan 10 18:21:03 2010
>>  >>  >>  > @@ -683,7 +683,21 @@
>>  >>  >>  >          }
>>  >>  >>  >      }
>>  >>  >>  >
>>  >>  >>  > -    protected void multipleThreads(final int holdTime, final boolean expectError, long maxWait)
>>  >>  >>  > +    /**
>>  >>  >>  > +     * Launches a group of 2 * getMaxActive() threads, each of which will attempt to obtain a connection
>>  >>  >>  > +     * from the pool, hold it for <holdTime> ms, and then return it to the pool.  If <loopOnce> is false,
>>  >>  >>  > +     * threads will continue this process indefinitely.  If <expectingError> is true, exactly 1/2 of the
>>  >>  >>  > +     * threads are expected to either throw exceptions or fail to complete. If <expectingError> is false,
>>  >>  >>  > +     * all threads are expected to complete successfully.
>>  >>  >>  > +     *
>>  >>  >>  > +     * @param holdTime time in ms that a thread holds a connection before returning it to the pool
>>  >>  >>  > +     * @param expectError whether or not an error is expected
>>  >>  >>  > +     * @param loopOnce whether threads should complete the borrow - hold - return cycle only once, or loop indefinitely
>>  >>  >>  > +     * @param maxWait passed in by client - has no impact on the test itself, but does get reported
>>  >>  >>  > +     *
>>  >>  >>  > +     * @throws Exception
>>  >>  >>  > +     */
>>  >>  >>  > +    protected void multipleThreads(final int holdTime, final boolean expectError, final boolean loopOnce, final long maxWait)
>>  >>  >>  >              throws Exception {
>>  >>  >>  >                  long startTime = timeStamp();
>>  >>  >>  >                  final PoolTest[] pts = new PoolTest[2 * getMaxActive()];
>>  >>  >>  > @@ -696,8 +710,7 @@
>>  >>  >>  >                      }
>>  >>  >>  >                  };
>>  >>  >>  >                  for (int i = 0; i < pts.length; i++) {
>>  >>  >>  > -                    // If we are expecting an error, don't allow successful threads to loop
>>  >>  >>  > -                    (pts[i] = new PoolTest(threadGroup, holdTime, expectError)).start();
>>  >>  >>  > +                    (pts[i] = new PoolTest(threadGroup, holdTime, expectError, loopOnce)).start();
>>  >>  >>  >                  }
>>  >>  >>  >
>>  >>  >>  >                  Thread.sleep(100L); // Wait for long enough to allow threads to start
>>  >>  >>  >
>>  >>  >>  > Modified: commons/proper/dbcp/trunk/src/test/org/apache/commons/dbcp/datasources/TestPerUserPoolDataSource.java
>>  >>  >>  > URL: http://svn.apache.org/viewvc/commons/proper/dbcp/trunk/src/test/org/apache/commons/dbcp/datasources/TestPerUserPoolDataSource.java?rev=897678&r1=897677&r2=897678&view=diff
>>  >>  >>  > ==============================================================================
>>  >>  >>  > --- commons/proper/dbcp/trunk/src/test/org/apache/commons/dbcp/datasources/TestPerUserPoolDataSource.java (original)
>>  >>  >>  > +++ commons/proper/dbcp/trunk/src/test/org/apache/commons/dbcp/datasources/TestPerUserPoolDataSource.java Sun Jan 10 18:21:03 2010
>>  >>  >>  > @@ -378,11 +378,11 @@
>>  >>  >>  >          final int defaultMaxWait = 430;
>>  >>  >>  >          ((PerUserPoolDataSource) ds).setDefaultMaxWait(defaultMaxWait);
>>  >>  >>  >          ((PerUserPoolDataSource) ds).setPerUserMaxWait("foo",new Integer(defaultMaxWait));
>>  >>  >>  > -        multipleThreads(1, false, defaultMaxWait);
>>  >>  >>  > +        multipleThreads(1, false, false, defaultMaxWait);
>>  >>  >>  >      }
>>  >>  >>  >
>>  >>  >>  >      public void testMultipleThreads2() throws Exception {
>>  >>  >>  > -        multipleThreads(2 * (int)(getMaxWait()), true, getMaxWait());
>>  >>  >>  > +        multipleThreads(2 * (int)(getMaxWait()), true, false, getMaxWait());
>>  >>  >>  >      }
>>  >>  >>  >
>>  >>  >>  >      public void testTransactionIsolationBehavior() throws Exception {
>>  >>  >>  >
>>  >>  >>  > Modified: commons/proper/dbcp/trunk/src/test/org/apache/commons/dbcp/datasources/TestSharedPoolDataSource.java
>>  >>  >>  > URL: http://svn.apache.org/viewvc/commons/proper/dbcp/trunk/src/test/org/apache/commons/dbcp/datasources/TestSharedPoolDataSource.java?rev=897678&r1=897677&r2=897678&view=diff
>>  >>  >>  > ==============================================================================
>>  >>  >>  > --- commons/proper/dbcp/trunk/src/test/org/apache/commons/dbcp/datasources/TestSharedPoolDataSource.java (original)
>>  >>  >>  > +++ commons/proper/dbcp/trunk/src/test/org/apache/commons/dbcp/datasources/TestSharedPoolDataSource.java Sun Jan 10 18:21:03 2010
>>  >>  >>  > @@ -368,11 +368,11 @@
>>  >>  >>  >          // some JVMs, e.g. Windows.
>>  >>  >>  >          final int defaultMaxWait = 430;
>>  >>  >>  >          ((SharedPoolDataSource) ds).setMaxWait(defaultMaxWait);
>>  >>  >>  > -        multipleThreads(1, false, defaultMaxWait);
>>  >>  >>  > +        multipleThreads(1, false, false, defaultMaxWait);
>>  >>  >>  >      }
>>  >>  >>  >
>>  >>  >>  >      public void testMultipleThreads2() throws Exception {
>>  >>  >>  > -        multipleThreads(2 * (int)(getMaxWait()), true, getMaxWait());
>>  >>  >>  > +        multipleThreads(2 * (int)(getMaxWait()), true, false, getMaxWait());
>>  >>  >>  >      }
>>  >>  >>  >
>>  >>  >>  >      public void testTransactionIsolationBehavior() throws Exception {
>>  >>  >>  >
>>  >>  >>  >
>>  >>  >>
>>  >>  >>
>>  >>  >>
>>  >>  >> ---------------------------------------------------------------------
>>  >>  >>  To unsubscribe, e-mail: dev-unsubscribe@commons.apache.org
>>  >>  >>  For additional commands, e-mail: dev-help@commons.apache.org
>>  >>  >>
>>  >>  >>
>>  >>  >
>>  >>  > ---------------------------------------------------------------------
>>  >>  > To unsubscribe, e-mail: dev-unsubscribe@commons.apache.org
>>  >>  > For additional commands, e-mail: dev-help@commons.apache.org
>>  >>  >
>>  >>
>>  >>
>>  >>  ---------------------------------------------------------------------
>>  >>  To unsubscribe, e-mail: dev-unsubscribe@commons.apache.org
>>  >>  For additional commands, e-mail: dev-help@commons.apache.org
>>  >>
>>  >>
>>  >
>>  > ---------------------------------------------------------------------
>>  > To unsubscribe, e-mail: dev-unsubscribe@commons.apache.org
>>  > For additional commands, e-mail: dev-help@commons.apache.org
>>  >
>>
>>
>>  ---------------------------------------------------------------------
>>  To unsubscribe, e-mail: dev-unsubscribe@commons.apache.org
>>  For additional commands, e-mail: dev-help@commons.apache.org
>>
>>
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: dev-unsubscribe@commons.apache.org
> For additional commands, e-mail: dev-help@commons.apache.org
> 


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@commons.apache.org
For additional commands, e-mail: dev-help@commons.apache.org


Re: [dbcp] multipleThreads test

Posted by sebb <se...@gmail.com>.
On 10/01/2010, Phil Steitz <ph...@gmail.com> wrote:
> sebb wrote:
>  > On 10/01/2010, Phil Steitz <ph...@gmail.com> wrote:
>  >> sebb wrote:
>  >>  > Thanks.
>  >>  >
>  >>  > Looks like I did not complete the fixes properly when I added the
>  >>  > loopOnce parameter to PoolTest.
>  >>
>  >>  I think I found (and fixed) another problem.  See r897720.
>  >
>  > The wait in question is purely to allow the threads to start, so I
>  > think it should not depend on the value of maxWait (or indeed
>  > holdTime). Originally it was set to 10L * holdTime, which meant that
>  > it did always not work well for holdTime = 1.
>
>
> OK, then I must be missing something.  Since stop can interrupt run,
>  it would seem to me that entering the stop loop immediately after
>  this wait is going to stop all of the threads, giving them all just
>  whatever the wait is to complete.

In the case where the loop only operates once, so long as the wait
time is long enough to allow all the threads to start then it won't
affect further processing of the PoolTest threads. However if it is
much longer than maxWait or holdTime, the test will take longer than
necessary.

For the multi-loop case, the wait time must again be enough to allow
the threads to start. This guarantees that the threads will run at
least once. The overall run-time of the test (and the number of loops)
is controlled by the wait time, because the holdTime is very short in
comparison.

>  That, I was assuming, is why the
>  1.2.2 version waited 10 * holdTime, which would not really have been
>  quite right - better a function of maxWait.

The 1.2.2 version also handled completion differently - it did not
wait for the threads to complete, and it did not have a loopOnce
option. Provided that maxWait expired before holdTime, then at least
one thread would fail, and this would stop all the threads. But this
was not always happening, so I introduced the loopOnce parameter.

>
>  Phil
>
>
>  >
>  >>  >
>  >>  > It was quite tricky following the Continuum build output, as the date
>  >>  > was 2 days behind, and the mail for the failed runs is not always
>  >>  > accurate - if the "Exit code" is 127, then most of the email contents
>  >>  > is inaccurate.
>  >>  >
>  >>  > I have raised http://jira.codehaus.org/browse/CONTINUUM-2428 for the
>  >>  > misleading info.
>  >>  >
>  >>  > On 10/01/2010, Phil Steitz <ph...@gmail.com> wrote:
>  >>  >> From the debugging added to some previously failed builds, I saw
>  >>  >>  loop = 2 for some threads.  Threads should not be looping.  Second
>  >>  >>  loop by a thread that succeeded the first time that throws will not
>  >>  >>  change success state - so it looks like a success -> not enough
>  >>  >>  failures.
>  >>  >>
>  >>  >>  Phil
>  >>  >>
>  >>  >>
>  >>  >>  psteitz@apache.org wrote:
>  >>  >>  > Author: psteitz
>  >>  >>  > Date: Sun Jan 10 18:21:03 2010
>  >>  >>  > New Revision: 897678
>  >>  >>  >
>  >>  >>  > URL: http://svn.apache.org/viewvc?rev=897678&view=rev
>  >>  >>  > Log:
>  >>  >>  > Eliminated unintended looping in mutipleThreads test.
>  >>  >>  >
>  >>  >>  > Modified:
>  >>  >>  >     commons/proper/dbcp/trunk/src/test/org/apache/commons/dbcp/TestConnectionPool.java
>  >>  >>  >     commons/proper/dbcp/trunk/src/test/org/apache/commons/dbcp/datasources/TestPerUserPoolDataSource.java
>  >>  >>  >     commons/proper/dbcp/trunk/src/test/org/apache/commons/dbcp/datasources/TestSharedPoolDataSource.java
>  >>  >>  >
>  >>  >>  > Modified: commons/proper/dbcp/trunk/src/test/org/apache/commons/dbcp/TestConnectionPool.java
>  >>  >>  > URL: http://svn.apache.org/viewvc/commons/proper/dbcp/trunk/src/test/org/apache/commons/dbcp/TestConnectionPool.java?rev=897678&r1=897677&r2=897678&view=diff
>  >>  >>  > ==============================================================================
>  >>  >>  > --- commons/proper/dbcp/trunk/src/test/org/apache/commons/dbcp/TestConnectionPool.java (original)
>  >>  >>  > +++ commons/proper/dbcp/trunk/src/test/org/apache/commons/dbcp/TestConnectionPool.java Sun Jan 10 18:21:03 2010
>  >>  >>  > @@ -683,7 +683,21 @@
>  >>  >>  >          }
>  >>  >>  >      }
>  >>  >>  >
>  >>  >>  > -    protected void multipleThreads(final int holdTime, final boolean expectError, long maxWait)
>  >>  >>  > +    /**
>  >>  >>  > +     * Launches a group of 2 * getMaxActive() threads, each of which will attempt to obtain a connection
>  >>  >>  > +     * from the pool, hold it for <holdTime> ms, and then return it to the pool.  If <loopOnce> is false,
>  >>  >>  > +     * threads will continue this process indefinitely.  If <expectingError> is true, exactly 1/2 of the
>  >>  >>  > +     * threads are expected to either throw exceptions or fail to complete. If <expectingError> is false,
>  >>  >>  > +     * all threads are expected to complete successfully.
>  >>  >>  > +     *
>  >>  >>  > +     * @param holdTime time in ms that a thread holds a connection before returning it to the pool
>  >>  >>  > +     * @param expectError whether or not an error is expected
>  >>  >>  > +     * @param loopOnce whether threads should complete the borrow - hold - return cycle only once, or loop indefinitely
>  >>  >>  > +     * @param maxWait passed in by client - has no impact on the test itself, but does get reported
>  >>  >>  > +     *
>  >>  >>  > +     * @throws Exception
>  >>  >>  > +     */
>  >>  >>  > +    protected void multipleThreads(final int holdTime, final boolean expectError, final boolean loopOnce, final long maxWait)
>  >>  >>  >              throws Exception {
>  >>  >>  >                  long startTime = timeStamp();
>  >>  >>  >                  final PoolTest[] pts = new PoolTest[2 * getMaxActive()];
>  >>  >>  > @@ -696,8 +710,7 @@
>  >>  >>  >                      }
>  >>  >>  >                  };
>  >>  >>  >                  for (int i = 0; i < pts.length; i++) {
>  >>  >>  > -                    // If we are expecting an error, don't allow successful threads to loop
>  >>  >>  > -                    (pts[i] = new PoolTest(threadGroup, holdTime, expectError)).start();
>  >>  >>  > +                    (pts[i] = new PoolTest(threadGroup, holdTime, expectError, loopOnce)).start();
>  >>  >>  >                  }
>  >>  >>  >
>  >>  >>  >                  Thread.sleep(100L); // Wait for long enough to allow threads to start
>  >>  >>  >
>  >>  >>  > Modified: commons/proper/dbcp/trunk/src/test/org/apache/commons/dbcp/datasources/TestPerUserPoolDataSource.java
>  >>  >>  > URL: http://svn.apache.org/viewvc/commons/proper/dbcp/trunk/src/test/org/apache/commons/dbcp/datasources/TestPerUserPoolDataSource.java?rev=897678&r1=897677&r2=897678&view=diff
>  >>  >>  > ==============================================================================
>  >>  >>  > --- commons/proper/dbcp/trunk/src/test/org/apache/commons/dbcp/datasources/TestPerUserPoolDataSource.java (original)
>  >>  >>  > +++ commons/proper/dbcp/trunk/src/test/org/apache/commons/dbcp/datasources/TestPerUserPoolDataSource.java Sun Jan 10 18:21:03 2010
>  >>  >>  > @@ -378,11 +378,11 @@
>  >>  >>  >          final int defaultMaxWait = 430;
>  >>  >>  >          ((PerUserPoolDataSource) ds).setDefaultMaxWait(defaultMaxWait);
>  >>  >>  >          ((PerUserPoolDataSource) ds).setPerUserMaxWait("foo",new Integer(defaultMaxWait));
>  >>  >>  > -        multipleThreads(1, false, defaultMaxWait);
>  >>  >>  > +        multipleThreads(1, false, false, defaultMaxWait);
>  >>  >>  >      }
>  >>  >>  >
>  >>  >>  >      public void testMultipleThreads2() throws Exception {
>  >>  >>  > -        multipleThreads(2 * (int)(getMaxWait()), true, getMaxWait());
>  >>  >>  > +        multipleThreads(2 * (int)(getMaxWait()), true, false, getMaxWait());
>  >>  >>  >      }
>  >>  >>  >
>  >>  >>  >      public void testTransactionIsolationBehavior() throws Exception {
>  >>  >>  >
>  >>  >>  > Modified: commons/proper/dbcp/trunk/src/test/org/apache/commons/dbcp/datasources/TestSharedPoolDataSource.java
>  >>  >>  > URL: http://svn.apache.org/viewvc/commons/proper/dbcp/trunk/src/test/org/apache/commons/dbcp/datasources/TestSharedPoolDataSource.java?rev=897678&r1=897677&r2=897678&view=diff
>  >>  >>  > ==============================================================================
>  >>  >>  > --- commons/proper/dbcp/trunk/src/test/org/apache/commons/dbcp/datasources/TestSharedPoolDataSource.java (original)
>  >>  >>  > +++ commons/proper/dbcp/trunk/src/test/org/apache/commons/dbcp/datasources/TestSharedPoolDataSource.java Sun Jan 10 18:21:03 2010
>  >>  >>  > @@ -368,11 +368,11 @@
>  >>  >>  >          // some JVMs, e.g. Windows.
>  >>  >>  >          final int defaultMaxWait = 430;
>  >>  >>  >          ((SharedPoolDataSource) ds).setMaxWait(defaultMaxWait);
>  >>  >>  > -        multipleThreads(1, false, defaultMaxWait);
>  >>  >>  > +        multipleThreads(1, false, false, defaultMaxWait);
>  >>  >>  >      }
>  >>  >>  >
>  >>  >>  >      public void testMultipleThreads2() throws Exception {
>  >>  >>  > -        multipleThreads(2 * (int)(getMaxWait()), true, getMaxWait());
>  >>  >>  > +        multipleThreads(2 * (int)(getMaxWait()), true, false, getMaxWait());
>  >>  >>  >      }
>  >>  >>  >
>  >>  >>  >      public void testTransactionIsolationBehavior() throws Exception {
>  >>  >>  >
>  >>  >>  >
>  >>  >>
>  >>  >>
>  >>  >>
>  >>  >> ---------------------------------------------------------------------
>  >>  >>  To unsubscribe, e-mail: dev-unsubscribe@commons.apache.org
>  >>  >>  For additional commands, e-mail: dev-help@commons.apache.org
>  >>  >>
>  >>  >>
>  >>  >
>  >>  > ---------------------------------------------------------------------
>  >>  > To unsubscribe, e-mail: dev-unsubscribe@commons.apache.org
>  >>  > For additional commands, e-mail: dev-help@commons.apache.org
>  >>  >
>  >>
>  >>
>  >>  ---------------------------------------------------------------------
>  >>  To unsubscribe, e-mail: dev-unsubscribe@commons.apache.org
>  >>  For additional commands, e-mail: dev-help@commons.apache.org
>  >>
>  >>
>  >
>  > ---------------------------------------------------------------------
>  > To unsubscribe, e-mail: dev-unsubscribe@commons.apache.org
>  > For additional commands, e-mail: dev-help@commons.apache.org
>  >
>
>
>  ---------------------------------------------------------------------
>  To unsubscribe, e-mail: dev-unsubscribe@commons.apache.org
>  For additional commands, e-mail: dev-help@commons.apache.org
>
>

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@commons.apache.org
For additional commands, e-mail: dev-help@commons.apache.org


Re: [dbcp] multipleThreads test

Posted by Phil Steitz <ph...@gmail.com>.
sebb wrote:
> On 10/01/2010, Phil Steitz <ph...@gmail.com> wrote:
>> sebb wrote:
>>  > Thanks.
>>  >
>>  > Looks like I did not complete the fixes properly when I added the
>>  > loopOnce parameter to PoolTest.
>>
>>  I think I found (and fixed) another problem.  See r897720.
> 
> The wait in question is purely to allow the threads to start, so I
> think it should not depend on the value of maxWait (or indeed
> holdTime). Originally it was set to 10L * holdTime, which meant that
> it did always not work well for holdTime = 1.

OK, then I must be missing something.  Since stop can interrupt run,
it would seem to me that entering the stop loop immediately after
this wait is going to stop all of the threads, giving them all just
whatever the wait is to complete.  That, I was assuming, is why the
1.2.2 version waited 10 * holdTime, which would not really have been
quite right - better a function of maxWait.

Phil

> 
>>  >
>>  > It was quite tricky following the Continuum build output, as the date
>>  > was 2 days behind, and the mail for the failed runs is not always
>>  > accurate - if the "Exit code" is 127, then most of the email contents
>>  > is inaccurate.
>>  >
>>  > I have raised http://jira.codehaus.org/browse/CONTINUUM-2428 for the
>>  > misleading info.
>>  >
>>  > On 10/01/2010, Phil Steitz <ph...@gmail.com> wrote:
>>  >> From the debugging added to some previously failed builds, I saw
>>  >>  loop = 2 for some threads.  Threads should not be looping.  Second
>>  >>  loop by a thread that succeeded the first time that throws will not
>>  >>  change success state - so it looks like a success -> not enough
>>  >>  failures.
>>  >>
>>  >>  Phil
>>  >>
>>  >>
>>  >>  psteitz@apache.org wrote:
>>  >>  > Author: psteitz
>>  >>  > Date: Sun Jan 10 18:21:03 2010
>>  >>  > New Revision: 897678
>>  >>  >
>>  >>  > URL: http://svn.apache.org/viewvc?rev=897678&view=rev
>>  >>  > Log:
>>  >>  > Eliminated unintended looping in mutipleThreads test.
>>  >>  >
>>  >>  > Modified:
>>  >>  >     commons/proper/dbcp/trunk/src/test/org/apache/commons/dbcp/TestConnectionPool.java
>>  >>  >     commons/proper/dbcp/trunk/src/test/org/apache/commons/dbcp/datasources/TestPerUserPoolDataSource.java
>>  >>  >     commons/proper/dbcp/trunk/src/test/org/apache/commons/dbcp/datasources/TestSharedPoolDataSource.java
>>  >>  >
>>  >>  > Modified: commons/proper/dbcp/trunk/src/test/org/apache/commons/dbcp/TestConnectionPool.java
>>  >>  > URL: http://svn.apache.org/viewvc/commons/proper/dbcp/trunk/src/test/org/apache/commons/dbcp/TestConnectionPool.java?rev=897678&r1=897677&r2=897678&view=diff
>>  >>  > ==============================================================================
>>  >>  > --- commons/proper/dbcp/trunk/src/test/org/apache/commons/dbcp/TestConnectionPool.java (original)
>>  >>  > +++ commons/proper/dbcp/trunk/src/test/org/apache/commons/dbcp/TestConnectionPool.java Sun Jan 10 18:21:03 2010
>>  >>  > @@ -683,7 +683,21 @@
>>  >>  >          }
>>  >>  >      }
>>  >>  >
>>  >>  > -    protected void multipleThreads(final int holdTime, final boolean expectError, long maxWait)
>>  >>  > +    /**
>>  >>  > +     * Launches a group of 2 * getMaxActive() threads, each of which will attempt to obtain a connection
>>  >>  > +     * from the pool, hold it for <holdTime> ms, and then return it to the pool.  If <loopOnce> is false,
>>  >>  > +     * threads will continue this process indefinitely.  If <expectingError> is true, exactly 1/2 of the
>>  >>  > +     * threads are expected to either throw exceptions or fail to complete. If <expectingError> is false,
>>  >>  > +     * all threads are expected to complete successfully.
>>  >>  > +     *
>>  >>  > +     * @param holdTime time in ms that a thread holds a connection before returning it to the pool
>>  >>  > +     * @param expectError whether or not an error is expected
>>  >>  > +     * @param loopOnce whether threads should complete the borrow - hold - return cycle only once, or loop indefinitely
>>  >>  > +     * @param maxWait passed in by client - has no impact on the test itself, but does get reported
>>  >>  > +     *
>>  >>  > +     * @throws Exception
>>  >>  > +     */
>>  >>  > +    protected void multipleThreads(final int holdTime, final boolean expectError, final boolean loopOnce, final long maxWait)
>>  >>  >              throws Exception {
>>  >>  >                  long startTime = timeStamp();
>>  >>  >                  final PoolTest[] pts = new PoolTest[2 * getMaxActive()];
>>  >>  > @@ -696,8 +710,7 @@
>>  >>  >                      }
>>  >>  >                  };
>>  >>  >                  for (int i = 0; i < pts.length; i++) {
>>  >>  > -                    // If we are expecting an error, don't allow successful threads to loop
>>  >>  > -                    (pts[i] = new PoolTest(threadGroup, holdTime, expectError)).start();
>>  >>  > +                    (pts[i] = new PoolTest(threadGroup, holdTime, expectError, loopOnce)).start();
>>  >>  >                  }
>>  >>  >
>>  >>  >                  Thread.sleep(100L); // Wait for long enough to allow threads to start
>>  >>  >
>>  >>  > Modified: commons/proper/dbcp/trunk/src/test/org/apache/commons/dbcp/datasources/TestPerUserPoolDataSource.java
>>  >>  > URL: http://svn.apache.org/viewvc/commons/proper/dbcp/trunk/src/test/org/apache/commons/dbcp/datasources/TestPerUserPoolDataSource.java?rev=897678&r1=897677&r2=897678&view=diff
>>  >>  > ==============================================================================
>>  >>  > --- commons/proper/dbcp/trunk/src/test/org/apache/commons/dbcp/datasources/TestPerUserPoolDataSource.java (original)
>>  >>  > +++ commons/proper/dbcp/trunk/src/test/org/apache/commons/dbcp/datasources/TestPerUserPoolDataSource.java Sun Jan 10 18:21:03 2010
>>  >>  > @@ -378,11 +378,11 @@
>>  >>  >          final int defaultMaxWait = 430;
>>  >>  >          ((PerUserPoolDataSource) ds).setDefaultMaxWait(defaultMaxWait);
>>  >>  >          ((PerUserPoolDataSource) ds).setPerUserMaxWait("foo",new Integer(defaultMaxWait));
>>  >>  > -        multipleThreads(1, false, defaultMaxWait);
>>  >>  > +        multipleThreads(1, false, false, defaultMaxWait);
>>  >>  >      }
>>  >>  >
>>  >>  >      public void testMultipleThreads2() throws Exception {
>>  >>  > -        multipleThreads(2 * (int)(getMaxWait()), true, getMaxWait());
>>  >>  > +        multipleThreads(2 * (int)(getMaxWait()), true, false, getMaxWait());
>>  >>  >      }
>>  >>  >
>>  >>  >      public void testTransactionIsolationBehavior() throws Exception {
>>  >>  >
>>  >>  > Modified: commons/proper/dbcp/trunk/src/test/org/apache/commons/dbcp/datasources/TestSharedPoolDataSource.java
>>  >>  > URL: http://svn.apache.org/viewvc/commons/proper/dbcp/trunk/src/test/org/apache/commons/dbcp/datasources/TestSharedPoolDataSource.java?rev=897678&r1=897677&r2=897678&view=diff
>>  >>  > ==============================================================================
>>  >>  > --- commons/proper/dbcp/trunk/src/test/org/apache/commons/dbcp/datasources/TestSharedPoolDataSource.java (original)
>>  >>  > +++ commons/proper/dbcp/trunk/src/test/org/apache/commons/dbcp/datasources/TestSharedPoolDataSource.java Sun Jan 10 18:21:03 2010
>>  >>  > @@ -368,11 +368,11 @@
>>  >>  >          // some JVMs, e.g. Windows.
>>  >>  >          final int defaultMaxWait = 430;
>>  >>  >          ((SharedPoolDataSource) ds).setMaxWait(defaultMaxWait);
>>  >>  > -        multipleThreads(1, false, defaultMaxWait);
>>  >>  > +        multipleThreads(1, false, false, defaultMaxWait);
>>  >>  >      }
>>  >>  >
>>  >>  >      public void testMultipleThreads2() throws Exception {
>>  >>  > -        multipleThreads(2 * (int)(getMaxWait()), true, getMaxWait());
>>  >>  > +        multipleThreads(2 * (int)(getMaxWait()), true, false, getMaxWait());
>>  >>  >      }
>>  >>  >
>>  >>  >      public void testTransactionIsolationBehavior() throws Exception {
>>  >>  >
>>  >>  >
>>  >>
>>  >>
>>  >>
>>  >> ---------------------------------------------------------------------
>>  >>  To unsubscribe, e-mail: dev-unsubscribe@commons.apache.org
>>  >>  For additional commands, e-mail: dev-help@commons.apache.org
>>  >>
>>  >>
>>  >
>>  > ---------------------------------------------------------------------
>>  > To unsubscribe, e-mail: dev-unsubscribe@commons.apache.org
>>  > For additional commands, e-mail: dev-help@commons.apache.org
>>  >
>>
>>
>>  ---------------------------------------------------------------------
>>  To unsubscribe, e-mail: dev-unsubscribe@commons.apache.org
>>  For additional commands, e-mail: dev-help@commons.apache.org
>>
>>
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: dev-unsubscribe@commons.apache.org
> For additional commands, e-mail: dev-help@commons.apache.org
> 


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@commons.apache.org
For additional commands, e-mail: dev-help@commons.apache.org


Re: [dbcp] multipleThreads test

Posted by sebb <se...@gmail.com>.
On 10/01/2010, Phil Steitz <ph...@gmail.com> wrote:
> sebb wrote:
>  > Thanks.
>  >
>  > Looks like I did not complete the fixes properly when I added the
>  > loopOnce parameter to PoolTest.
>
>  I think I found (and fixed) another problem.  See r897720.

The wait in question is purely to allow the threads to start, so I
think it should not depend on the value of maxWait (or indeed
holdTime). Originally it was set to 10L * holdTime, which meant that
it did always not work well for holdTime = 1.

>  >
>  > It was quite tricky following the Continuum build output, as the date
>  > was 2 days behind, and the mail for the failed runs is not always
>  > accurate - if the "Exit code" is 127, then most of the email contents
>  > is inaccurate.
>  >
>  > I have raised http://jira.codehaus.org/browse/CONTINUUM-2428 for the
>  > misleading info.
>  >
>  > On 10/01/2010, Phil Steitz <ph...@gmail.com> wrote:
>  >> From the debugging added to some previously failed builds, I saw
>  >>  loop = 2 for some threads.  Threads should not be looping.  Second
>  >>  loop by a thread that succeeded the first time that throws will not
>  >>  change success state - so it looks like a success -> not enough
>  >>  failures.
>  >>
>  >>  Phil
>  >>
>  >>
>  >>  psteitz@apache.org wrote:
>  >>  > Author: psteitz
>  >>  > Date: Sun Jan 10 18:21:03 2010
>  >>  > New Revision: 897678
>  >>  >
>  >>  > URL: http://svn.apache.org/viewvc?rev=897678&view=rev
>  >>  > Log:
>  >>  > Eliminated unintended looping in mutipleThreads test.
>  >>  >
>  >>  > Modified:
>  >>  >     commons/proper/dbcp/trunk/src/test/org/apache/commons/dbcp/TestConnectionPool.java
>  >>  >     commons/proper/dbcp/trunk/src/test/org/apache/commons/dbcp/datasources/TestPerUserPoolDataSource.java
>  >>  >     commons/proper/dbcp/trunk/src/test/org/apache/commons/dbcp/datasources/TestSharedPoolDataSource.java
>  >>  >
>  >>  > Modified: commons/proper/dbcp/trunk/src/test/org/apache/commons/dbcp/TestConnectionPool.java
>  >>  > URL: http://svn.apache.org/viewvc/commons/proper/dbcp/trunk/src/test/org/apache/commons/dbcp/TestConnectionPool.java?rev=897678&r1=897677&r2=897678&view=diff
>  >>  > ==============================================================================
>  >>  > --- commons/proper/dbcp/trunk/src/test/org/apache/commons/dbcp/TestConnectionPool.java (original)
>  >>  > +++ commons/proper/dbcp/trunk/src/test/org/apache/commons/dbcp/TestConnectionPool.java Sun Jan 10 18:21:03 2010
>  >>  > @@ -683,7 +683,21 @@
>  >>  >          }
>  >>  >      }
>  >>  >
>  >>  > -    protected void multipleThreads(final int holdTime, final boolean expectError, long maxWait)
>  >>  > +    /**
>  >>  > +     * Launches a group of 2 * getMaxActive() threads, each of which will attempt to obtain a connection
>  >>  > +     * from the pool, hold it for <holdTime> ms, and then return it to the pool.  If <loopOnce> is false,
>  >>  > +     * threads will continue this process indefinitely.  If <expectingError> is true, exactly 1/2 of the
>  >>  > +     * threads are expected to either throw exceptions or fail to complete. If <expectingError> is false,
>  >>  > +     * all threads are expected to complete successfully.
>  >>  > +     *
>  >>  > +     * @param holdTime time in ms that a thread holds a connection before returning it to the pool
>  >>  > +     * @param expectError whether or not an error is expected
>  >>  > +     * @param loopOnce whether threads should complete the borrow - hold - return cycle only once, or loop indefinitely
>  >>  > +     * @param maxWait passed in by client - has no impact on the test itself, but does get reported
>  >>  > +     *
>  >>  > +     * @throws Exception
>  >>  > +     */
>  >>  > +    protected void multipleThreads(final int holdTime, final boolean expectError, final boolean loopOnce, final long maxWait)
>  >>  >              throws Exception {
>  >>  >                  long startTime = timeStamp();
>  >>  >                  final PoolTest[] pts = new PoolTest[2 * getMaxActive()];
>  >>  > @@ -696,8 +710,7 @@
>  >>  >                      }
>  >>  >                  };
>  >>  >                  for (int i = 0; i < pts.length; i++) {
>  >>  > -                    // If we are expecting an error, don't allow successful threads to loop
>  >>  > -                    (pts[i] = new PoolTest(threadGroup, holdTime, expectError)).start();
>  >>  > +                    (pts[i] = new PoolTest(threadGroup, holdTime, expectError, loopOnce)).start();
>  >>  >                  }
>  >>  >
>  >>  >                  Thread.sleep(100L); // Wait for long enough to allow threads to start
>  >>  >
>  >>  > Modified: commons/proper/dbcp/trunk/src/test/org/apache/commons/dbcp/datasources/TestPerUserPoolDataSource.java
>  >>  > URL: http://svn.apache.org/viewvc/commons/proper/dbcp/trunk/src/test/org/apache/commons/dbcp/datasources/TestPerUserPoolDataSource.java?rev=897678&r1=897677&r2=897678&view=diff
>  >>  > ==============================================================================
>  >>  > --- commons/proper/dbcp/trunk/src/test/org/apache/commons/dbcp/datasources/TestPerUserPoolDataSource.java (original)
>  >>  > +++ commons/proper/dbcp/trunk/src/test/org/apache/commons/dbcp/datasources/TestPerUserPoolDataSource.java Sun Jan 10 18:21:03 2010
>  >>  > @@ -378,11 +378,11 @@
>  >>  >          final int defaultMaxWait = 430;
>  >>  >          ((PerUserPoolDataSource) ds).setDefaultMaxWait(defaultMaxWait);
>  >>  >          ((PerUserPoolDataSource) ds).setPerUserMaxWait("foo",new Integer(defaultMaxWait));
>  >>  > -        multipleThreads(1, false, defaultMaxWait);
>  >>  > +        multipleThreads(1, false, false, defaultMaxWait);
>  >>  >      }
>  >>  >
>  >>  >      public void testMultipleThreads2() throws Exception {
>  >>  > -        multipleThreads(2 * (int)(getMaxWait()), true, getMaxWait());
>  >>  > +        multipleThreads(2 * (int)(getMaxWait()), true, false, getMaxWait());
>  >>  >      }
>  >>  >
>  >>  >      public void testTransactionIsolationBehavior() throws Exception {
>  >>  >
>  >>  > Modified: commons/proper/dbcp/trunk/src/test/org/apache/commons/dbcp/datasources/TestSharedPoolDataSource.java
>  >>  > URL: http://svn.apache.org/viewvc/commons/proper/dbcp/trunk/src/test/org/apache/commons/dbcp/datasources/TestSharedPoolDataSource.java?rev=897678&r1=897677&r2=897678&view=diff
>  >>  > ==============================================================================
>  >>  > --- commons/proper/dbcp/trunk/src/test/org/apache/commons/dbcp/datasources/TestSharedPoolDataSource.java (original)
>  >>  > +++ commons/proper/dbcp/trunk/src/test/org/apache/commons/dbcp/datasources/TestSharedPoolDataSource.java Sun Jan 10 18:21:03 2010
>  >>  > @@ -368,11 +368,11 @@
>  >>  >          // some JVMs, e.g. Windows.
>  >>  >          final int defaultMaxWait = 430;
>  >>  >          ((SharedPoolDataSource) ds).setMaxWait(defaultMaxWait);
>  >>  > -        multipleThreads(1, false, defaultMaxWait);
>  >>  > +        multipleThreads(1, false, false, defaultMaxWait);
>  >>  >      }
>  >>  >
>  >>  >      public void testMultipleThreads2() throws Exception {
>  >>  > -        multipleThreads(2 * (int)(getMaxWait()), true, getMaxWait());
>  >>  > +        multipleThreads(2 * (int)(getMaxWait()), true, false, getMaxWait());
>  >>  >      }
>  >>  >
>  >>  >      public void testTransactionIsolationBehavior() throws Exception {
>  >>  >
>  >>  >
>  >>
>  >>
>  >>
>  >> ---------------------------------------------------------------------
>  >>  To unsubscribe, e-mail: dev-unsubscribe@commons.apache.org
>  >>  For additional commands, e-mail: dev-help@commons.apache.org
>  >>
>  >>
>  >
>  > ---------------------------------------------------------------------
>  > To unsubscribe, e-mail: dev-unsubscribe@commons.apache.org
>  > For additional commands, e-mail: dev-help@commons.apache.org
>  >
>
>
>  ---------------------------------------------------------------------
>  To unsubscribe, e-mail: dev-unsubscribe@commons.apache.org
>  For additional commands, e-mail: dev-help@commons.apache.org
>
>

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@commons.apache.org
For additional commands, e-mail: dev-help@commons.apache.org


[dbcp] multipleThreads test

Posted by Phil Steitz <ph...@gmail.com>.
sebb wrote:
> Thanks.
> 
> Looks like I did not complete the fixes properly when I added the
> loopOnce parameter to PoolTest.

I think I found (and fixed) another problem.  See r897720.

> 
> It was quite tricky following the Continuum build output, as the date
> was 2 days behind, and the mail for the failed runs is not always
> accurate - if the "Exit code" is 127, then most of the email contents
> is inaccurate.
> 
> I have raised http://jira.codehaus.org/browse/CONTINUUM-2428 for the
> misleading info.
> 
> On 10/01/2010, Phil Steitz <ph...@gmail.com> wrote:
>> From the debugging added to some previously failed builds, I saw
>>  loop = 2 for some threads.  Threads should not be looping.  Second
>>  loop by a thread that succeeded the first time that throws will not
>>  change success state - so it looks like a success -> not enough
>>  failures.
>>
>>  Phil
>>
>>
>>  psteitz@apache.org wrote:
>>  > Author: psteitz
>>  > Date: Sun Jan 10 18:21:03 2010
>>  > New Revision: 897678
>>  >
>>  > URL: http://svn.apache.org/viewvc?rev=897678&view=rev
>>  > Log:
>>  > Eliminated unintended looping in mutipleThreads test.
>>  >
>>  > Modified:
>>  >     commons/proper/dbcp/trunk/src/test/org/apache/commons/dbcp/TestConnectionPool.java
>>  >     commons/proper/dbcp/trunk/src/test/org/apache/commons/dbcp/datasources/TestPerUserPoolDataSource.java
>>  >     commons/proper/dbcp/trunk/src/test/org/apache/commons/dbcp/datasources/TestSharedPoolDataSource.java
>>  >
>>  > Modified: commons/proper/dbcp/trunk/src/test/org/apache/commons/dbcp/TestConnectionPool.java
>>  > URL: http://svn.apache.org/viewvc/commons/proper/dbcp/trunk/src/test/org/apache/commons/dbcp/TestConnectionPool.java?rev=897678&r1=897677&r2=897678&view=diff
>>  > ==============================================================================
>>  > --- commons/proper/dbcp/trunk/src/test/org/apache/commons/dbcp/TestConnectionPool.java (original)
>>  > +++ commons/proper/dbcp/trunk/src/test/org/apache/commons/dbcp/TestConnectionPool.java Sun Jan 10 18:21:03 2010
>>  > @@ -683,7 +683,21 @@
>>  >          }
>>  >      }
>>  >
>>  > -    protected void multipleThreads(final int holdTime, final boolean expectError, long maxWait)
>>  > +    /**
>>  > +     * Launches a group of 2 * getMaxActive() threads, each of which will attempt to obtain a connection
>>  > +     * from the pool, hold it for <holdTime> ms, and then return it to the pool.  If <loopOnce> is false,
>>  > +     * threads will continue this process indefinitely.  If <expectingError> is true, exactly 1/2 of the
>>  > +     * threads are expected to either throw exceptions or fail to complete. If <expectingError> is false,
>>  > +     * all threads are expected to complete successfully.
>>  > +     *
>>  > +     * @param holdTime time in ms that a thread holds a connection before returning it to the pool
>>  > +     * @param expectError whether or not an error is expected
>>  > +     * @param loopOnce whether threads should complete the borrow - hold - return cycle only once, or loop indefinitely
>>  > +     * @param maxWait passed in by client - has no impact on the test itself, but does get reported
>>  > +     *
>>  > +     * @throws Exception
>>  > +     */
>>  > +    protected void multipleThreads(final int holdTime, final boolean expectError, final boolean loopOnce, final long maxWait)
>>  >              throws Exception {
>>  >                  long startTime = timeStamp();
>>  >                  final PoolTest[] pts = new PoolTest[2 * getMaxActive()];
>>  > @@ -696,8 +710,7 @@
>>  >                      }
>>  >                  };
>>  >                  for (int i = 0; i < pts.length; i++) {
>>  > -                    // If we are expecting an error, don't allow successful threads to loop
>>  > -                    (pts[i] = new PoolTest(threadGroup, holdTime, expectError)).start();
>>  > +                    (pts[i] = new PoolTest(threadGroup, holdTime, expectError, loopOnce)).start();
>>  >                  }
>>  >
>>  >                  Thread.sleep(100L); // Wait for long enough to allow threads to start
>>  >
>>  > Modified: commons/proper/dbcp/trunk/src/test/org/apache/commons/dbcp/datasources/TestPerUserPoolDataSource.java
>>  > URL: http://svn.apache.org/viewvc/commons/proper/dbcp/trunk/src/test/org/apache/commons/dbcp/datasources/TestPerUserPoolDataSource.java?rev=897678&r1=897677&r2=897678&view=diff
>>  > ==============================================================================
>>  > --- commons/proper/dbcp/trunk/src/test/org/apache/commons/dbcp/datasources/TestPerUserPoolDataSource.java (original)
>>  > +++ commons/proper/dbcp/trunk/src/test/org/apache/commons/dbcp/datasources/TestPerUserPoolDataSource.java Sun Jan 10 18:21:03 2010
>>  > @@ -378,11 +378,11 @@
>>  >          final int defaultMaxWait = 430;
>>  >          ((PerUserPoolDataSource) ds).setDefaultMaxWait(defaultMaxWait);
>>  >          ((PerUserPoolDataSource) ds).setPerUserMaxWait("foo",new Integer(defaultMaxWait));
>>  > -        multipleThreads(1, false, defaultMaxWait);
>>  > +        multipleThreads(1, false, false, defaultMaxWait);
>>  >      }
>>  >
>>  >      public void testMultipleThreads2() throws Exception {
>>  > -        multipleThreads(2 * (int)(getMaxWait()), true, getMaxWait());
>>  > +        multipleThreads(2 * (int)(getMaxWait()), true, false, getMaxWait());
>>  >      }
>>  >
>>  >      public void testTransactionIsolationBehavior() throws Exception {
>>  >
>>  > Modified: commons/proper/dbcp/trunk/src/test/org/apache/commons/dbcp/datasources/TestSharedPoolDataSource.java
>>  > URL: http://svn.apache.org/viewvc/commons/proper/dbcp/trunk/src/test/org/apache/commons/dbcp/datasources/TestSharedPoolDataSource.java?rev=897678&r1=897677&r2=897678&view=diff
>>  > ==============================================================================
>>  > --- commons/proper/dbcp/trunk/src/test/org/apache/commons/dbcp/datasources/TestSharedPoolDataSource.java (original)
>>  > +++ commons/proper/dbcp/trunk/src/test/org/apache/commons/dbcp/datasources/TestSharedPoolDataSource.java Sun Jan 10 18:21:03 2010
>>  > @@ -368,11 +368,11 @@
>>  >          // some JVMs, e.g. Windows.
>>  >          final int defaultMaxWait = 430;
>>  >          ((SharedPoolDataSource) ds).setMaxWait(defaultMaxWait);
>>  > -        multipleThreads(1, false, defaultMaxWait);
>>  > +        multipleThreads(1, false, false, defaultMaxWait);
>>  >      }
>>  >
>>  >      public void testMultipleThreads2() throws Exception {
>>  > -        multipleThreads(2 * (int)(getMaxWait()), true, getMaxWait());
>>  > +        multipleThreads(2 * (int)(getMaxWait()), true, false, getMaxWait());
>>  >      }
>>  >
>>  >      public void testTransactionIsolationBehavior() throws Exception {
>>  >
>>  >
>>
>>
>>
>> ---------------------------------------------------------------------
>>  To unsubscribe, e-mail: dev-unsubscribe@commons.apache.org
>>  For additional commands, e-mail: dev-help@commons.apache.org
>>
>>
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: dev-unsubscribe@commons.apache.org
> For additional commands, e-mail: dev-help@commons.apache.org
> 


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@commons.apache.org
For additional commands, e-mail: dev-help@commons.apache.org


Re: svn commit: r897678 - in /commons/proper/dbcp/trunk/src/test/org/apache/commons/dbcp: TestConnectionPool.java datasources/TestPerUserPoolDataSource.java datasources/TestSharedPoolDataSource.java

Posted by sebb <se...@gmail.com>.
Thanks.

Looks like I did not complete the fixes properly when I added the
loopOnce parameter to PoolTest.

It was quite tricky following the Continuum build output, as the date
was 2 days behind, and the mail for the failed runs is not always
accurate - if the "Exit code" is 127, then most of the email contents
is inaccurate.

I have raised http://jira.codehaus.org/browse/CONTINUUM-2428 for the
misleading info.

On 10/01/2010, Phil Steitz <ph...@gmail.com> wrote:
> From the debugging added to some previously failed builds, I saw
>  loop = 2 for some threads.  Threads should not be looping.  Second
>  loop by a thread that succeeded the first time that throws will not
>  change success state - so it looks like a success -> not enough
>  failures.
>
>  Phil
>
>
>  psteitz@apache.org wrote:
>  > Author: psteitz
>  > Date: Sun Jan 10 18:21:03 2010
>  > New Revision: 897678
>  >
>  > URL: http://svn.apache.org/viewvc?rev=897678&view=rev
>  > Log:
>  > Eliminated unintended looping in mutipleThreads test.
>  >
>  > Modified:
>  >     commons/proper/dbcp/trunk/src/test/org/apache/commons/dbcp/TestConnectionPool.java
>  >     commons/proper/dbcp/trunk/src/test/org/apache/commons/dbcp/datasources/TestPerUserPoolDataSource.java
>  >     commons/proper/dbcp/trunk/src/test/org/apache/commons/dbcp/datasources/TestSharedPoolDataSource.java
>  >
>  > Modified: commons/proper/dbcp/trunk/src/test/org/apache/commons/dbcp/TestConnectionPool.java
>  > URL: http://svn.apache.org/viewvc/commons/proper/dbcp/trunk/src/test/org/apache/commons/dbcp/TestConnectionPool.java?rev=897678&r1=897677&r2=897678&view=diff
>  > ==============================================================================
>  > --- commons/proper/dbcp/trunk/src/test/org/apache/commons/dbcp/TestConnectionPool.java (original)
>  > +++ commons/proper/dbcp/trunk/src/test/org/apache/commons/dbcp/TestConnectionPool.java Sun Jan 10 18:21:03 2010
>  > @@ -683,7 +683,21 @@
>  >          }
>  >      }
>  >
>  > -    protected void multipleThreads(final int holdTime, final boolean expectError, long maxWait)
>  > +    /**
>  > +     * Launches a group of 2 * getMaxActive() threads, each of which will attempt to obtain a connection
>  > +     * from the pool, hold it for <holdTime> ms, and then return it to the pool.  If <loopOnce> is false,
>  > +     * threads will continue this process indefinitely.  If <expectingError> is true, exactly 1/2 of the
>  > +     * threads are expected to either throw exceptions or fail to complete. If <expectingError> is false,
>  > +     * all threads are expected to complete successfully.
>  > +     *
>  > +     * @param holdTime time in ms that a thread holds a connection before returning it to the pool
>  > +     * @param expectError whether or not an error is expected
>  > +     * @param loopOnce whether threads should complete the borrow - hold - return cycle only once, or loop indefinitely
>  > +     * @param maxWait passed in by client - has no impact on the test itself, but does get reported
>  > +     *
>  > +     * @throws Exception
>  > +     */
>  > +    protected void multipleThreads(final int holdTime, final boolean expectError, final boolean loopOnce, final long maxWait)
>  >              throws Exception {
>  >                  long startTime = timeStamp();
>  >                  final PoolTest[] pts = new PoolTest[2 * getMaxActive()];
>  > @@ -696,8 +710,7 @@
>  >                      }
>  >                  };
>  >                  for (int i = 0; i < pts.length; i++) {
>  > -                    // If we are expecting an error, don't allow successful threads to loop
>  > -                    (pts[i] = new PoolTest(threadGroup, holdTime, expectError)).start();
>  > +                    (pts[i] = new PoolTest(threadGroup, holdTime, expectError, loopOnce)).start();
>  >                  }
>  >
>  >                  Thread.sleep(100L); // Wait for long enough to allow threads to start
>  >
>  > Modified: commons/proper/dbcp/trunk/src/test/org/apache/commons/dbcp/datasources/TestPerUserPoolDataSource.java
>  > URL: http://svn.apache.org/viewvc/commons/proper/dbcp/trunk/src/test/org/apache/commons/dbcp/datasources/TestPerUserPoolDataSource.java?rev=897678&r1=897677&r2=897678&view=diff
>  > ==============================================================================
>  > --- commons/proper/dbcp/trunk/src/test/org/apache/commons/dbcp/datasources/TestPerUserPoolDataSource.java (original)
>  > +++ commons/proper/dbcp/trunk/src/test/org/apache/commons/dbcp/datasources/TestPerUserPoolDataSource.java Sun Jan 10 18:21:03 2010
>  > @@ -378,11 +378,11 @@
>  >          final int defaultMaxWait = 430;
>  >          ((PerUserPoolDataSource) ds).setDefaultMaxWait(defaultMaxWait);
>  >          ((PerUserPoolDataSource) ds).setPerUserMaxWait("foo",new Integer(defaultMaxWait));
>  > -        multipleThreads(1, false, defaultMaxWait);
>  > +        multipleThreads(1, false, false, defaultMaxWait);
>  >      }
>  >
>  >      public void testMultipleThreads2() throws Exception {
>  > -        multipleThreads(2 * (int)(getMaxWait()), true, getMaxWait());
>  > +        multipleThreads(2 * (int)(getMaxWait()), true, false, getMaxWait());
>  >      }
>  >
>  >      public void testTransactionIsolationBehavior() throws Exception {
>  >
>  > Modified: commons/proper/dbcp/trunk/src/test/org/apache/commons/dbcp/datasources/TestSharedPoolDataSource.java
>  > URL: http://svn.apache.org/viewvc/commons/proper/dbcp/trunk/src/test/org/apache/commons/dbcp/datasources/TestSharedPoolDataSource.java?rev=897678&r1=897677&r2=897678&view=diff
>  > ==============================================================================
>  > --- commons/proper/dbcp/trunk/src/test/org/apache/commons/dbcp/datasources/TestSharedPoolDataSource.java (original)
>  > +++ commons/proper/dbcp/trunk/src/test/org/apache/commons/dbcp/datasources/TestSharedPoolDataSource.java Sun Jan 10 18:21:03 2010
>  > @@ -368,11 +368,11 @@
>  >          // some JVMs, e.g. Windows.
>  >          final int defaultMaxWait = 430;
>  >          ((SharedPoolDataSource) ds).setMaxWait(defaultMaxWait);
>  > -        multipleThreads(1, false, defaultMaxWait);
>  > +        multipleThreads(1, false, false, defaultMaxWait);
>  >      }
>  >
>  >      public void testMultipleThreads2() throws Exception {
>  > -        multipleThreads(2 * (int)(getMaxWait()), true, getMaxWait());
>  > +        multipleThreads(2 * (int)(getMaxWait()), true, false, getMaxWait());
>  >      }
>  >
>  >      public void testTransactionIsolationBehavior() throws Exception {
>  >
>  >
>
>
>
> ---------------------------------------------------------------------
>  To unsubscribe, e-mail: dev-unsubscribe@commons.apache.org
>  For additional commands, e-mail: dev-help@commons.apache.org
>
>

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@commons.apache.org
For additional commands, e-mail: dev-help@commons.apache.org