You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@commons.apache.org by "Liviu Tudor (JIRA)" <ji...@apache.org> on 2012/07/31 02:25:35 UTC

[jira] [Created] (POOL-228) Unit test failure in TestGenericObjectPoolClassLoaders

Liviu Tudor created POOL-228:
--------------------------------

             Summary: Unit test failure in TestGenericObjectPoolClassLoaders
                 Key: POOL-228
                 URL: https://issues.apache.org/jira/browse/POOL-228
             Project: Commons Pool
          Issue Type: Bug
    Affects Versions: 1.6
            Reporter: Liviu Tudor
            Priority: Minor
             Fix For: 1.6.1


Following error encountered when running unit tests:

{noformat}
Results :

Failed tests:   testContextClassLoader(org.apache.commons.pool.impl.TestGenericObjectPoolClassLoaders): Wrong number of idle objects in pool1 expected:<1> but was:<0>

Tests run: 263, Failures: 1, Errors: 0, Skipped: 0
{noformat}


--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] [Commented] (POOL-228) Unit test failure in TestGenericObjectPoolClassLoaders

Posted by "Liviu Tudor (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/POOL-228?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13426087#comment-13426087 ] 

Liviu Tudor commented on POOL-228:
----------------------------------

hmmmm ok this is weird then. I constantly keep getting this test to fail both from command line as well as from Eclipse so I don't think it's an environment setup.
Does the test pass in the CI environment?
                
> Unit test failure in TestGenericObjectPoolClassLoaders
> ------------------------------------------------------
>
>                 Key: POOL-228
>                 URL: https://issues.apache.org/jira/browse/POOL-228
>             Project: Commons Pool
>          Issue Type: Bug
>    Affects Versions: 1.6
>            Reporter: Liviu Tudor
>            Priority: Minor
>              Labels: junit
>             Fix For: 1.6.1
>
>
> Following error encountered when running unit tests:
> {noformat}
> Results :
> Failed tests:   testContextClassLoader(org.apache.commons.pool.impl.TestGenericObjectPoolClassLoaders): Wrong number of idle objects in pool1 expected:<1> but was:<0>
> Tests run: 263, Failures: 1, Errors: 0, Skipped: 0
> {noformat}

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] [Commented] (POOL-228) Unit test failure in TestGenericObjectPoolClassLoaders

Posted by "Mark Thomas (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/POOL-228?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13426374#comment-13426374 ] 

Mark Thomas commented on POOL-228:
----------------------------------

No confusion here. I was looking at the 1.6.x code.

Look at the code for the Evictor.run(). It calls ensureMinIdle(). You need to do some debugging to find out why that method isn't called / doesn't work on your system.

There might be a timing problem with the test. Try increasing the length of the sleep.
                
> Unit test failure in TestGenericObjectPoolClassLoaders
> ------------------------------------------------------
>
>                 Key: POOL-228
>                 URL: https://issues.apache.org/jira/browse/POOL-228
>             Project: Commons Pool
>          Issue Type: Bug
>    Affects Versions: 1.6
>            Reporter: Liviu Tudor
>            Priority: Minor
>              Labels: junit
>             Fix For: 1.6.1
>
>
> Following error encountered when running unit tests:
> {noformat}
> Results :
> Failed tests:   testContextClassLoader(org.apache.commons.pool.impl.TestGenericObjectPoolClassLoaders): Wrong number of idle objects in pool1 expected:<1> but was:<0>
> Tests run: 263, Failures: 1, Errors: 0, Skipped: 0
> {noformat}

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] [Commented] (POOL-228) Unit test failure in TestGenericObjectPoolClassLoaders

Posted by "Liviu Tudor (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/POOL-228?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13426141#comment-13426141 ] 

Liviu Tudor commented on POOL-228:
----------------------------------

Mark, I just realised there might be a bit of confusion here -- I'm talking about pool-1.6 here -- haven't checked yet the pool2 (trunk) branch.
on this branch, {{setMinIdle}} calls {{allocate()}} which bails out if {{_pool}} is empty so doesn't do in fact anything. There is no call to {{evict()}} (in fact that is only called from the eviction timer task).
Did you check this on the 1.6 branch too or were you referring to pool2?
                
> Unit test failure in TestGenericObjectPoolClassLoaders
> ------------------------------------------------------
>
>                 Key: POOL-228
>                 URL: https://issues.apache.org/jira/browse/POOL-228
>             Project: Commons Pool
>          Issue Type: Bug
>    Affects Versions: 1.6
>            Reporter: Liviu Tudor
>            Priority: Minor
>              Labels: junit
>             Fix For: 1.6.1
>
>
> Following error encountered when running unit tests:
> {noformat}
> Results :
> Failed tests:   testContextClassLoader(org.apache.commons.pool.impl.TestGenericObjectPoolClassLoaders): Wrong number of idle objects in pool1 expected:<1> but was:<0>
> Tests run: 263, Failures: 1, Errors: 0, Skipped: 0
> {noformat}

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] [Commented] (POOL-228) Unit test failure in TestGenericObjectPoolClassLoaders

Posted by "Liviu Tudor (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/POOL-228?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13425430#comment-13425430 ] 

Liviu Tudor commented on POOL-228:
----------------------------------

Problem is caused by the {{assertEquals}} in the following block (line 42):

{code:java}
GenericObjectPool<URL> pool1 = new GenericObjectPool<URL>(factory1);
pool1.setMinIdle(1);
pool1.setTimeBetweenEvictionRunsMillis(100);
Thread.sleep(200);
assertEquals("Wrong number of idle objects in pool1", 1, pool1.getNumIdle());
{code}

The trouble seems to rise from the fact that the constructor sets the {{minIdle}} by default to 0 (zero); the call to {{setMinIdle}} sets it to 1 (one) and then the call to {{setTimeBetweenEvictionRunMillis(100)}} schedules an eviction run in 100msecs. Therefore, bearing in mind the 200msecs sleep right afterwards would mean that by the time we reach the {{assertEquals}} the pool would be pre-populated with {{minIdle}} items.
However, the eviction procedures exits right away if the pool is empty (which makes sense, there is nothing to evict!). 
So the question here is:
* do we change the unit test to assert the number of *existing* idle objects in the pool to be zero (please note that the unit test checks for the existing idle objects not minimum idle objects, which is set in previous step!) OR
* do we change the eviction to prepopulate to {{minIdle}} instances?


                
> Unit test failure in TestGenericObjectPoolClassLoaders
> ------------------------------------------------------
>
>                 Key: POOL-228
>                 URL: https://issues.apache.org/jira/browse/POOL-228
>             Project: Commons Pool
>          Issue Type: Bug
>    Affects Versions: 1.6
>            Reporter: Liviu Tudor
>            Priority: Minor
>              Labels: junit
>             Fix For: 1.6.1
>
>
> Following error encountered when running unit tests:
> {noformat}
> Results :
> Failed tests:   testContextClassLoader(org.apache.commons.pool.impl.TestGenericObjectPoolClassLoaders): Wrong number of idle objects in pool1 expected:<1> but was:<0>
> Tests run: 263, Failures: 1, Errors: 0, Skipped: 0
> {noformat}

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] [Commented] (POOL-228) Unit test failure in TestGenericObjectPoolClassLoaders

Posted by "Mark Thomas (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/POOL-228?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13426077#comment-13426077 ] 

Mark Thomas commented on POOL-228:
----------------------------------

That test passes for me.

Your analysis is wrong. ensureMinIdle() is a separate call to evict().

You need to do some more research to find out what is going wrong before proceeding.
                
> Unit test failure in TestGenericObjectPoolClassLoaders
> ------------------------------------------------------
>
>                 Key: POOL-228
>                 URL: https://issues.apache.org/jira/browse/POOL-228
>             Project: Commons Pool
>          Issue Type: Bug
>    Affects Versions: 1.6
>            Reporter: Liviu Tudor
>            Priority: Minor
>              Labels: junit
>             Fix For: 1.6.1
>
>
> Following error encountered when running unit tests:
> {noformat}
> Results :
> Failed tests:   testContextClassLoader(org.apache.commons.pool.impl.TestGenericObjectPoolClassLoaders): Wrong number of idle objects in pool1 expected:<1> but was:<0>
> Tests run: 263, Failures: 1, Errors: 0, Skipped: 0
> {noformat}

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira