You are viewing a plain text version of this content. The canonical link for it is here.
Posted to derby-dev@db.apache.org by "Jeff Clary (JIRA)" <ji...@apache.org> on 2007/03/22 22:07:32 UTC

[jira] Created: (DERBY-2480) DriverManager.getConnection leaks memory using EmbeddedDriver on non-existent database

DriverManager.getConnection leaks memory using EmbeddedDriver on non-existent database
--------------------------------------------------------------------------------------

                 Key: DERBY-2480
                 URL: https://issues.apache.org/jira/browse/DERBY-2480
             Project: Derby
          Issue Type: Bug
    Affects Versions: 10.2.2.0
         Environment: Windows Vista, JDK 1.4.2_13
            Reporter: Jeff Clary


Repeated calls to java.sql.DriverManager.getConnection("jdbc:derby:C:\\DOES_NOT_EXIST") leak memory and eventually lead to an OutOfMemoryError.

This bug is similar to DERBY-1947 in that ContextManager objects are not getting removed from the HashSet.  The attached test program demonstrates the issue.  When run with VM options -Xms8m -Xmx8m, it throws an OutOfMemoryError after 19022 calls to DriverManager.getConnection.





-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


Re: [jira] Commented: (DERBY-2480) DriverManager.getConnection leaks memory using EmbeddedDriver on non-existent database

Posted by "John H. Embretsen" <Jo...@Sun.COM>.
Jeffrey Clary wrote:
> Unfortunately, as a new Derby contributor, I am still working the kinks out of my building and testing.  I haven't been able to get a clean baseline test for derbyall, and I haven't tried suites.All.  I'll get to that eventually, but maybe in the meantime a submitter will see in JIRA that you ran the tests successfully.

Yes. For the record, I only ran the repro test for the issue, no other 
regular regression tests. It is up to the committers to decide if that 
is good enough.

> Thanks for the tips.  I'm working toward lining my ducks all up in a row.

Thanks for contributing, I think most of us can agree that setting up a 
functioning Derby build and test environment is not the simplest thing 
in the world ;)


-- 
John


RE: [jira] Commented: (DERBY-2480) DriverManager.getConnection leaks memory using EmbeddedDriver on non-existent database

Posted by Jeffrey Clary <jc...@actuate.com>.
Unfortunately, as a new Derby contributor, I am still working the kinks out of my building and testing.  I haven't been able to get a clean baseline test for derbyall, and I haven't tried suites.All.  I'll get to that eventually, but maybe in the meantime a submitter will see in JIRA that you ran the tests successfully.

Thanks for the tips.  I'm working toward lining my ducks all up in a row.


-----Original Message-----
From: John.Embretsen@Sun.COM [mailto:John.Embretsen@Sun.COM] 
Sent: Wednesday, March 28, 2007 10:10 AM
To: derby-dev@db.apache.org
Subject: Re: [jira] Commented: (DERBY-2480) DriverManager.getConnection leaks memory using EmbeddedDriver on non-existent database

Jeffrey Clary wrote:
> Thanks for the review.  This is the first time I have contributed any code (one line ;-) to Derby.  At this point will the fix be picked up by a submitter or is there something else I need to do to make sure it gets into the next release?

I see that you have set the "Patch available" flag, so in theory everything 
should be ready for a committer to review and (hopefully) commit the patch. You 
should state the results of your test runs (derbyall, suites.All), though.

Further advice is described here:

http://wiki.apache.org/db-derby/PatchAdvice

-- 
John



Re: [jira] Commented: (DERBY-2480) DriverManager.getConnection leaks memory using EmbeddedDriver on non-existent database

Posted by John Embretsen <Jo...@Sun.COM>.
Jeffrey Clary wrote:
> Thanks for the review.  This is the first time I have contributed any code (one line ;-) to Derby.  At this point will the fix be picked up by a submitter or is there something else I need to do to make sure it gets into the next release?

I see that you have set the "Patch available" flag, so in theory everything 
should be ready for a committer to review and (hopefully) commit the patch. You 
should state the results of your test runs (derbyall, suites.All), though.

Further advice is described here:

http://wiki.apache.org/db-derby/PatchAdvice

-- 
John



RE: [jira] Commented: (DERBY-2480) DriverManager.getConnection leaks memory using EmbeddedDriver on non-existent database

Posted by Jeffrey Clary <jc...@actuate.com>.
Thanks for the review.  This is the first time I have contributed any code (one line ;-) to Derby.  At this point will the fix be picked up by a submitter or is there something else I need to do to make sure it gets into the next release?


-----Original Message-----
From: John H. Embretsen (JIRA) [mailto:jira@apache.org] 
Sent: Wednesday, March 28, 2007 3:27 AM
To: derby-dev@db.apache.org
Subject: [jira] Commented: (DERBY-2480) DriverManager.getConnection leaks memory using EmbeddedDriver on non-existent database


    [ https://issues.apache.org/jira/browse/DERBY-2480?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_12484757 ] 

John H. Embretsen commented on DERBY-2480:
------------------------------------------

I tried the patch, DERBY-2480-1.diff, and it seems to fix this issue. Ran the repro (with modified database path on Solaris) against sane jars, 1M iterations with the embedded driver (8 MB max heap; fails after less than 20k iterations without the patch) and 160k iterations with the client driver (16 MB max heap in the server VM). I saw no signs of a memory leak. I used JDK 6 for testing and its JConsole tool for monitoring.

> DriverManager.getConnection leaks memory using EmbeddedDriver on non-existent database
> --------------------------------------------------------------------------------------
>
>                 Key: DERBY-2480
>                 URL: https://issues.apache.org/jira/browse/DERBY-2480
>             Project: Derby
>          Issue Type: Bug
>    Affects Versions: 10.0.2.0, 10.0.2.1, 10.1.1.0, 10.1.2.1, 10.1.3.1, 10.2.1.6, 10.2.2.0, 10.3.0.0
>         Environment: Windows Vista, JDK 1.4.2_13
> Solaris 10, Sun JDK 1.4.2 & 1.5.0
>            Reporter: Jeff Clary
>            Priority: Minor
>         Attachments: DERBY-2480-1.diff, heap-server-Xmx32m.png, Patch_DERBY-1947_and_DERBY-2480.diff, testOpenOfMissingDatabase.java
>
>
> Repeated calls to java.sql.DriverManager.getConnection("jdbc:derby:C:\\DOES_NOT_EXIST") leak memory and eventually lead to an OutOfMemoryError.
> This bug is similar to DERBY-1947 in that ContextManager objects are not getting removed from the HashSet.  The attached test program demonstrates the issue.  When run with VM options -Xms8m -Xmx8m, it throws an OutOfMemoryError after 19022 calls to DriverManager.getConnection.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Updated: (DERBY-2480) DriverManager.getConnection leaks memory when connecting to a non-existent database

Posted by "John H. Embretsen (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/DERBY-2480?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

John H. Embretsen updated DERBY-2480:
-------------------------------------

    Environment: 
Windows Vista, JDK 1.4.2_13
Solaris 10, Sun JDK 1.4.2, 1.5.0 & 1.6.0
Red Hat Enterprise Linux 4 (2.6.9-34.ELsmp_64), Sun JDK 1.5.0 & 1.6.0

  was:
Windows Vista, JDK 1.4.2_13
Solaris 10, Sun JDK 1.4.2 & 1.5.0

        Summary: DriverManager.getConnection leaks memory when connecting to a non-existent database  (was: DriverManager.getConnection leaks memory using EmbeddedDriver on non-existent database)

Changed the Summary to reflect the fact that this is issue is not limited to the EmbeddedDriver.
Added my test platforms to Environment.


> DriverManager.getConnection leaks memory when connecting to a non-existent database
> -----------------------------------------------------------------------------------
>
>                 Key: DERBY-2480
>                 URL: https://issues.apache.org/jira/browse/DERBY-2480
>             Project: Derby
>          Issue Type: Bug
>    Affects Versions: 10.0.2.0, 10.0.2.1, 10.1.1.0, 10.1.2.1, 10.1.3.1, 10.2.1.6, 10.2.2.0, 10.3.0.0
>         Environment: Windows Vista, JDK 1.4.2_13
> Solaris 10, Sun JDK 1.4.2, 1.5.0 & 1.6.0
> Red Hat Enterprise Linux 4 (2.6.9-34.ELsmp_64), Sun JDK 1.5.0 & 1.6.0
>            Reporter: Jeff Clary
>            Priority: Minor
>         Attachments: DERBY-2480-1.diff, heap-server-Xmx32m.png, Patch_DERBY-1947_and_DERBY-2480.diff, testOpenOfMissingDatabase.java
>
>
> Repeated calls to java.sql.DriverManager.getConnection("jdbc:derby:C:\\DOES_NOT_EXIST") leak memory and eventually lead to an OutOfMemoryError.
> This bug is similar to DERBY-1947 in that ContextManager objects are not getting removed from the HashSet.  The attached test program demonstrates the issue.  When run with VM options -Xms8m -Xmx8m, it throws an OutOfMemoryError after 19022 calls to DriverManager.getConnection.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Updated: (DERBY-2480) DriverManager.getConnection leaks memory using EmbeddedDriver on non-existent database

Posted by "Jeff Clary (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/DERBY-2480?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Jeff Clary updated DERBY-2480:
------------------------------

    Attachment: testOpenOfMissingDatabase.java

Small test program demonstrating bug.

> DriverManager.getConnection leaks memory using EmbeddedDriver on non-existent database
> --------------------------------------------------------------------------------------
>
>                 Key: DERBY-2480
>                 URL: https://issues.apache.org/jira/browse/DERBY-2480
>             Project: Derby
>          Issue Type: Bug
>    Affects Versions: 10.2.2.0
>         Environment: Windows Vista, JDK 1.4.2_13
>            Reporter: Jeff Clary
>         Attachments: testOpenOfMissingDatabase.java
>
>
> Repeated calls to java.sql.DriverManager.getConnection("jdbc:derby:C:\\DOES_NOT_EXIST") leak memory and eventually lead to an OutOfMemoryError.
> This bug is similar to DERBY-1947 in that ContextManager objects are not getting removed from the HashSet.  The attached test program demonstrates the issue.  When run with VM options -Xms8m -Xmx8m, it throws an OutOfMemoryError after 19022 calls to DriverManager.getConnection.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Commented: (DERBY-2480) DriverManager.getConnection leaks memory when connecting to a non-existent database

Posted by "Bryan Pendleton (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/DERBY-2480?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_12489443 ] 

Bryan Pendleton commented on DERBY-2480:
----------------------------------------

Hi John, thanks for the test! It works great for me: without the fix, the test fails for me
on iteration 109455, and with the fix the test passes.

If there are no other comments from other reviewers, I'll commit the fix and the
test to the trunk later this week.


> DriverManager.getConnection leaks memory when connecting to a non-existent database
> -----------------------------------------------------------------------------------
>
>                 Key: DERBY-2480
>                 URL: https://issues.apache.org/jira/browse/DERBY-2480
>             Project: Derby
>          Issue Type: Bug
>    Affects Versions: 10.0.2.0, 10.0.2.1, 10.1.1.0, 10.1.2.1, 10.1.3.1, 10.2.1.6, 10.2.2.0, 10.3.0.0
>         Environment: Windows Vista, JDK 1.4.2_13
> Solaris 10, Sun JDK 1.4.2, 1.5.0 & 1.6.0
> Red Hat Enterprise Linux 4 (2.6.9-34.ELsmp_64), Sun JDK 1.5.0 & 1.6.0
>            Reporter: Jeff Clary
>         Assigned To: John H. Embretsen
>            Priority: Minor
>         Attachments: d2480-junitTest_v1.diff, d2480-junitTest_v1.stat, DERBY-2480-1.diff, derbyall_report.txt, heap-server-Xmx32m.png, Patch_DERBY-1947_and_DERBY-2480.diff, testOpenOfMissingDatabase.java
>
>
> Repeated calls to java.sql.DriverManager.getConnection("jdbc:derby:C:\\DOES_NOT_EXIST") leak memory and eventually lead to an OutOfMemoryError.
> This bug is similar to DERBY-1947 in that ContextManager objects are not getting removed from the HashSet.  The attached test program demonstrates the issue.  When run with VM options -Xms8m -Xmx8m, it throws an OutOfMemoryError after 19022 calls to DriverManager.getConnection.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Commented: (DERBY-2480) DriverManager.getConnection leaks memory when connecting to a non-existent database

Posted by "Bryan Pendleton (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/DERBY-2480?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_12486479 ] 

Bryan Pendleton commented on DERBY-2480:
----------------------------------------

Jeff, I believe you should assign the bug to *yourself*, since you are the one who developed the fix.

I see that your patch includes a code change only. Is there a way to construct a test case which
demonstrates the bug and the fix? John, I see that you worked with the repro code; do you think we
can extract a test case from the repro code?



> DriverManager.getConnection leaks memory when connecting to a non-existent database
> -----------------------------------------------------------------------------------
>
>                 Key: DERBY-2480
>                 URL: https://issues.apache.org/jira/browse/DERBY-2480
>             Project: Derby
>          Issue Type: Bug
>    Affects Versions: 10.0.2.0, 10.0.2.1, 10.1.1.0, 10.1.2.1, 10.1.3.1, 10.2.1.6, 10.2.2.0, 10.3.0.0
>         Environment: Windows Vista, JDK 1.4.2_13
> Solaris 10, Sun JDK 1.4.2, 1.5.0 & 1.6.0
> Red Hat Enterprise Linux 4 (2.6.9-34.ELsmp_64), Sun JDK 1.5.0 & 1.6.0
>            Reporter: Jeff Clary
>            Priority: Minor
>         Attachments: DERBY-2480-1.diff, derbyall_report.txt, heap-server-Xmx32m.png, Patch_DERBY-1947_and_DERBY-2480.diff, testOpenOfMissingDatabase.java
>
>
> Repeated calls to java.sql.DriverManager.getConnection("jdbc:derby:C:\\DOES_NOT_EXIST") leak memory and eventually lead to an OutOfMemoryError.
> This bug is similar to DERBY-1947 in that ContextManager objects are not getting removed from the HashSet.  The attached test program demonstrates the issue.  When run with VM options -Xms8m -Xmx8m, it throws an OutOfMemoryError after 19022 calls to DriverManager.getConnection.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Commented: (DERBY-2480) DriverManager.getConnection leaks memory when connecting to a non-existent database

Posted by "John H. Embretsen (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/DERBY-2480?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_12488090 ] 

John H. Embretsen commented on DERBY-2480:
------------------------------------------

Assigning this issue to myself while I'm trying to figure out the best way to integrate a test for this into Derby's JUnit test framework. It seems that there is currently no support for trying to connect to a database without also creating it if it does not already exist. I won't be working full time on this, so feel free to reassign if desired.

> DriverManager.getConnection leaks memory when connecting to a non-existent database
> -----------------------------------------------------------------------------------
>
>                 Key: DERBY-2480
>                 URL: https://issues.apache.org/jira/browse/DERBY-2480
>             Project: Derby
>          Issue Type: Bug
>    Affects Versions: 10.0.2.0, 10.0.2.1, 10.1.1.0, 10.1.2.1, 10.1.3.1, 10.2.1.6, 10.2.2.0, 10.3.0.0
>         Environment: Windows Vista, JDK 1.4.2_13
> Solaris 10, Sun JDK 1.4.2, 1.5.0 & 1.6.0
> Red Hat Enterprise Linux 4 (2.6.9-34.ELsmp_64), Sun JDK 1.5.0 & 1.6.0
>            Reporter: Jeff Clary
>         Assigned To: John H. Embretsen
>            Priority: Minor
>         Attachments: DERBY-2480-1.diff, derbyall_report.txt, heap-server-Xmx32m.png, Patch_DERBY-1947_and_DERBY-2480.diff, testOpenOfMissingDatabase.java
>
>
> Repeated calls to java.sql.DriverManager.getConnection("jdbc:derby:C:\\DOES_NOT_EXIST") leak memory and eventually lead to an OutOfMemoryError.
> This bug is similar to DERBY-1947 in that ContextManager objects are not getting removed from the HashSet.  The attached test program demonstrates the issue.  When run with VM options -Xms8m -Xmx8m, it throws an OutOfMemoryError after 19022 calls to DriverManager.getConnection.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Assigned: (DERBY-2480) DriverManager.getConnection leaks memory when connecting to a non-existent database

Posted by "John H. Embretsen (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/DERBY-2480?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

John H. Embretsen reassigned DERBY-2480:
----------------------------------------

    Assignee: John H. Embretsen

> DriverManager.getConnection leaks memory when connecting to a non-existent database
> -----------------------------------------------------------------------------------
>
>                 Key: DERBY-2480
>                 URL: https://issues.apache.org/jira/browse/DERBY-2480
>             Project: Derby
>          Issue Type: Bug
>    Affects Versions: 10.0.2.0, 10.0.2.1, 10.1.1.0, 10.1.2.1, 10.1.3.1, 10.2.1.6, 10.2.2.0, 10.3.0.0
>         Environment: Windows Vista, JDK 1.4.2_13
> Solaris 10, Sun JDK 1.4.2, 1.5.0 & 1.6.0
> Red Hat Enterprise Linux 4 (2.6.9-34.ELsmp_64), Sun JDK 1.5.0 & 1.6.0
>            Reporter: Jeff Clary
>         Assigned To: John H. Embretsen
>            Priority: Minor
>         Attachments: DERBY-2480-1.diff, derbyall_report.txt, heap-server-Xmx32m.png, Patch_DERBY-1947_and_DERBY-2480.diff, testOpenOfMissingDatabase.java
>
>
> Repeated calls to java.sql.DriverManager.getConnection("jdbc:derby:C:\\DOES_NOT_EXIST") leak memory and eventually lead to an OutOfMemoryError.
> This bug is similar to DERBY-1947 in that ContextManager objects are not getting removed from the HashSet.  The attached test program demonstrates the issue.  When run with VM options -Xms8m -Xmx8m, it throws an OutOfMemoryError after 19022 calls to DriverManager.getConnection.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


Re: [jira] Commented: (DERBY-2480) DriverManager.getConnection leaks memory when connecting to a non-existent database

Posted by Bryan Pendleton <bp...@amberpoint.com>.
 > John H. Embretsen commented on DERBY-2480:
 > ------------------------------------------
 >
 > ... I'll try to experiment a little with this

Thanks John!

If you are able to build a test case, I would be glad to
commit the patch+test.

I think it would be good for you to assign the bug to
yourself to indicate that you're working on it.

thanks,

bryan


[jira] Commented: (DERBY-2480) DriverManager.getConnection leaks memory when connecting to a non-existent database

Posted by "John H. Embretsen (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/DERBY-2480?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_12487756 ] 

John H. Embretsen commented on DERBY-2480:
------------------------------------------

Bryan: I see no reason why it should not be possible to create a test case based on Jeff's repro. Unless he or someone else beats me to it, I'll try to experiment a little with this, after familiarizing myself with Derby's JUnit test configurations etc.

> DriverManager.getConnection leaks memory when connecting to a non-existent database
> -----------------------------------------------------------------------------------
>
>                 Key: DERBY-2480
>                 URL: https://issues.apache.org/jira/browse/DERBY-2480
>             Project: Derby
>          Issue Type: Bug
>    Affects Versions: 10.0.2.0, 10.0.2.1, 10.1.1.0, 10.1.2.1, 10.1.3.1, 10.2.1.6, 10.2.2.0, 10.3.0.0
>         Environment: Windows Vista, JDK 1.4.2_13
> Solaris 10, Sun JDK 1.4.2, 1.5.0 & 1.6.0
> Red Hat Enterprise Linux 4 (2.6.9-34.ELsmp_64), Sun JDK 1.5.0 & 1.6.0
>            Reporter: Jeff Clary
>            Priority: Minor
>         Attachments: DERBY-2480-1.diff, derbyall_report.txt, heap-server-Xmx32m.png, Patch_DERBY-1947_and_DERBY-2480.diff, testOpenOfMissingDatabase.java
>
>
> Repeated calls to java.sql.DriverManager.getConnection("jdbc:derby:C:\\DOES_NOT_EXIST") leak memory and eventually lead to an OutOfMemoryError.
> This bug is similar to DERBY-1947 in that ContextManager objects are not getting removed from the HashSet.  The attached test program demonstrates the issue.  When run with VM options -Xms8m -Xmx8m, it throws an OutOfMemoryError after 19022 calls to DriverManager.getConnection.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Commented: (DERBY-2480) DriverManager.getConnection leaks memory when connecting to a non-existent database

Posted by "Bryan Pendleton (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/DERBY-2480?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_12489510 ] 

Bryan Pendleton commented on DERBY-2480:
----------------------------------------

In addition to John's new test, all the existing regression tests ran cleanly for
me with the two patches applied. 

> DriverManager.getConnection leaks memory when connecting to a non-existent database
> -----------------------------------------------------------------------------------
>
>                 Key: DERBY-2480
>                 URL: https://issues.apache.org/jira/browse/DERBY-2480
>             Project: Derby
>          Issue Type: Bug
>    Affects Versions: 10.0.2.0, 10.0.2.1, 10.1.1.0, 10.1.2.1, 10.1.3.1, 10.2.1.6, 10.2.2.0, 10.3.0.0
>         Environment: Windows Vista, JDK 1.4.2_13
> Solaris 10, Sun JDK 1.4.2, 1.5.0 & 1.6.0
> Red Hat Enterprise Linux 4 (2.6.9-34.ELsmp_64), Sun JDK 1.5.0 & 1.6.0
>            Reporter: Jeff Clary
>         Assigned To: John H. Embretsen
>            Priority: Minor
>         Attachments: d2480-junitTest_v1.diff, d2480-junitTest_v1.stat, DERBY-2480-1.diff, derbyall_report.txt, heap-server-Xmx32m.png, Patch_DERBY-1947_and_DERBY-2480.diff, testOpenOfMissingDatabase.java
>
>
> Repeated calls to java.sql.DriverManager.getConnection("jdbc:derby:C:\\DOES_NOT_EXIST") leak memory and eventually lead to an OutOfMemoryError.
> This bug is similar to DERBY-1947 in that ContextManager objects are not getting removed from the HashSet.  The attached test program demonstrates the issue.  When run with VM options -Xms8m -Xmx8m, it throws an OutOfMemoryError after 19022 calls to DriverManager.getConnection.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


Re: [jira] Updated: (DERBY-2480) DriverManager.getConnection leaks memory using EmbeddedDriver on non-existent database

Posted by "Dag H. Wanvik" <Da...@Sun.COM>.
"Jeff Clary (JIRA)" <ji...@apache.org> writes:

> This might be a bit premature, but I am attaching a patch we are
> trying locally to fix this problem and DERBY-1947.  From our
> analysis, it looks like we are missing some calls to
> TransactionResourceImpl.cleanupOnError().

This is what I found as well, I am almost ready with a patch to DERBY-1947,
so we can compare our solutions :)

Dag

>
> I have just now gotten set up to check out, build, and test Derby.
> I am running derbyall against svn revision 521727 now, and will
> re-run it this afternoon with this patch in place.  I'll post my
> results here.
>
>
> (By the way, sorry for not granting ASF license for the original test program...that was just a newbie error.  But I don't see any way to grant it now.)
>
>> DriverManager.getConnection leaks memory using EmbeddedDriver on non-existent database
>> --------------------------------------------------------------------------------------
>>
>>                 Key: DERBY-2480
>>                 URL: https://issues.apache.org/jira/browse/DERBY-2480
>>             Project: Derby
>>          Issue Type: Bug
>>    Affects Versions: 10.0.2.0, 10.0.2.1, 10.1.1.0, 10.1.2.1, 10.1.3.1, 10.2.1.6, 10.2.2.0, 10.3.0.0
>>         Environment: Windows Vista, JDK 1.4.2_13
>> Solaris 10, Sun JDK 1.4.2 & 1.5.0
>>            Reporter: Jeff Clary
>>            Priority: Minor
>>         Attachments: heap-server-Xmx32m.png, Patch_DERBY-1947_and_DERBY-2480.diff, testOpenOfMissingDatabase.java
>>
>>
>> Repeated calls to java.sql.DriverManager.getConnection("jdbc:derby:C:\\DOES_NOT_EXIST") leak memory and eventually lead to an OutOfMemoryError.
>> This bug is similar to DERBY-1947 in that ContextManager objects are not getting removed from the HashSet.  The attached test program demonstrates the issue.  When run with VM options -Xms8m -Xmx8m, it throws an OutOfMemoryError after 19022 calls to DriverManager.getConnection.
>
> -- 
> This message is automatically generated by JIRA.
> -
> You can reply to this email to add a comment to the issue online.
>

-- 
Dag H. Wanvik
Sun Microsystems, Database Technology Group (DBTG)
Haakon VII gt. 7b, N-7485 Trondheim, Norway
Tel: x43496/+47 73842196, Fax:  +47 73842101

[jira] Updated: (DERBY-2480) DriverManager.getConnection leaks memory using EmbeddedDriver on non-existent database

Posted by "Jeff Clary (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/DERBY-2480?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Jeff Clary updated DERBY-2480:
------------------------------

    Attachment: Patch_DERBY-1947_and_DERBY-2480.diff

This might be a bit premature, but I am attaching a patch we are trying locally to fix this problem and DERBY-1947.  From our analysis, it looks like we are missing some calls to TransactionResourceImpl.cleanupOnError().

I have just now gotten set up to check out, build, and test Derby.  I am running derbyall against svn revision 521727 now, and will re-run it this afternoon with this patch in place.  I'll post my results here.


(By the way, sorry for not granting ASF license for the original test program...that was just a newbie error.  But I don't see any way to grant it now.)

> DriverManager.getConnection leaks memory using EmbeddedDriver on non-existent database
> --------------------------------------------------------------------------------------
>
>                 Key: DERBY-2480
>                 URL: https://issues.apache.org/jira/browse/DERBY-2480
>             Project: Derby
>          Issue Type: Bug
>    Affects Versions: 10.0.2.0, 10.0.2.1, 10.1.1.0, 10.1.2.1, 10.1.3.1, 10.2.1.6, 10.2.2.0, 10.3.0.0
>         Environment: Windows Vista, JDK 1.4.2_13
> Solaris 10, Sun JDK 1.4.2 & 1.5.0
>            Reporter: Jeff Clary
>            Priority: Minor
>         Attachments: heap-server-Xmx32m.png, Patch_DERBY-1947_and_DERBY-2480.diff, testOpenOfMissingDatabase.java
>
>
> Repeated calls to java.sql.DriverManager.getConnection("jdbc:derby:C:\\DOES_NOT_EXIST") leak memory and eventually lead to an OutOfMemoryError.
> This bug is similar to DERBY-1947 in that ContextManager objects are not getting removed from the HashSet.  The attached test program demonstrates the issue.  When run with VM options -Xms8m -Xmx8m, it throws an OutOfMemoryError after 19022 calls to DriverManager.getConnection.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Updated: (DERBY-2480) DriverManager.getConnection leaks memory when connecting to a non-existent database

Posted by "Jeff Clary (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/DERBY-2480?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Jeff Clary updated DERBY-2480:
------------------------------

    Attachment: derbyall_report.txt

I've  been working on my ongoing Derby setup issues, and have an *almost* clean run of the derbyall suite against this patch.  One single test failed due to an OutOfMemoryError.  I've attached my derbyall_report.txt for reference.

I see this bug is still unassigned.  Any committer out there want to take ownership of this one-liner and get it into the build?


> DriverManager.getConnection leaks memory when connecting to a non-existent database
> -----------------------------------------------------------------------------------
>
>                 Key: DERBY-2480
>                 URL: https://issues.apache.org/jira/browse/DERBY-2480
>             Project: Derby
>          Issue Type: Bug
>    Affects Versions: 10.0.2.0, 10.0.2.1, 10.1.1.0, 10.1.2.1, 10.1.3.1, 10.2.1.6, 10.2.2.0, 10.3.0.0
>         Environment: Windows Vista, JDK 1.4.2_13
> Solaris 10, Sun JDK 1.4.2, 1.5.0 & 1.6.0
> Red Hat Enterprise Linux 4 (2.6.9-34.ELsmp_64), Sun JDK 1.5.0 & 1.6.0
>            Reporter: Jeff Clary
>            Priority: Minor
>         Attachments: DERBY-2480-1.diff, derbyall_report.txt, heap-server-Xmx32m.png, Patch_DERBY-1947_and_DERBY-2480.diff, testOpenOfMissingDatabase.java
>
>
> Repeated calls to java.sql.DriverManager.getConnection("jdbc:derby:C:\\DOES_NOT_EXIST") leak memory and eventually lead to an OutOfMemoryError.
> This bug is similar to DERBY-1947 in that ContextManager objects are not getting removed from the HashSet.  The attached test program demonstrates the issue.  When run with VM options -Xms8m -Xmx8m, it throws an OutOfMemoryError after 19022 calls to DriverManager.getConnection.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Updated: (DERBY-2480) DriverManager.getConnection leaks memory using EmbeddedDriver on non-existent database

Posted by "Jeff Clary (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/DERBY-2480?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Jeff Clary updated DERBY-2480:
------------------------------

    Attachment: DERBY-2480-1.diff

At Dag's suggestion I have attached a patch that addresses only DERBY-2480.  It is a strict subset of the previous patch, so I am pretty confident that it should be good.  I am running derbyall against it right now.  Please consider it ready fo review.


> DriverManager.getConnection leaks memory using EmbeddedDriver on non-existent database
> --------------------------------------------------------------------------------------
>
>                 Key: DERBY-2480
>                 URL: https://issues.apache.org/jira/browse/DERBY-2480
>             Project: Derby
>          Issue Type: Bug
>    Affects Versions: 10.0.2.0, 10.0.2.1, 10.1.1.0, 10.1.2.1, 10.1.3.1, 10.2.1.6, 10.2.2.0, 10.3.0.0
>         Environment: Windows Vista, JDK 1.4.2_13
> Solaris 10, Sun JDK 1.4.2 & 1.5.0
>            Reporter: Jeff Clary
>            Priority: Minor
>         Attachments: DERBY-2480-1.diff, heap-server-Xmx32m.png, Patch_DERBY-1947_and_DERBY-2480.diff, testOpenOfMissingDatabase.java
>
>
> Repeated calls to java.sql.DriverManager.getConnection("jdbc:derby:C:\\DOES_NOT_EXIST") leak memory and eventually lead to an OutOfMemoryError.
> This bug is similar to DERBY-1947 in that ContextManager objects are not getting removed from the HashSet.  The attached test program demonstrates the issue.  When run with VM options -Xms8m -Xmx8m, it throws an OutOfMemoryError after 19022 calls to DriverManager.getConnection.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Updated: (DERBY-2480) DriverManager.getConnection leaks memory using EmbeddedDriver on non-existent database

Posted by "Jeff Clary (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/DERBY-2480?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Jeff Clary updated DERBY-2480:
------------------------------

    Derby Info: [Patch Available]

> DriverManager.getConnection leaks memory using EmbeddedDriver on non-existent database
> --------------------------------------------------------------------------------------
>
>                 Key: DERBY-2480
>                 URL: https://issues.apache.org/jira/browse/DERBY-2480
>             Project: Derby
>          Issue Type: Bug
>    Affects Versions: 10.0.2.0, 10.0.2.1, 10.1.1.0, 10.1.2.1, 10.1.3.1, 10.2.1.6, 10.2.2.0, 10.3.0.0
>         Environment: Windows Vista, JDK 1.4.2_13
> Solaris 10, Sun JDK 1.4.2 & 1.5.0
>            Reporter: Jeff Clary
>            Priority: Minor
>         Attachments: DERBY-2480-1.diff, heap-server-Xmx32m.png, Patch_DERBY-1947_and_DERBY-2480.diff, testOpenOfMissingDatabase.java
>
>
> Repeated calls to java.sql.DriverManager.getConnection("jdbc:derby:C:\\DOES_NOT_EXIST") leak memory and eventually lead to an OutOfMemoryError.
> This bug is similar to DERBY-1947 in that ContextManager objects are not getting removed from the HashSet.  The attached test program demonstrates the issue.  When run with VM options -Xms8m -Xmx8m, it throws an OutOfMemoryError after 19022 calls to DriverManager.getConnection.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Updated: (DERBY-2480) DriverManager.getConnection leaks memory using EmbeddedDriver on non-existent database

Posted by "John H. Embretsen (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/DERBY-2480?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

John H. Embretsen updated DERBY-2480:
-------------------------------------

           Derby Info:   (was: [Regression])
    Affects Version/s: 10.0.2.0
                       10.0.2.1
                       10.1.1.0
                       10.1.2.1
                       10.1.3.1
                       10.2.1.6

Removing the regression flag and changing affects versions, as further testing and an offline discussion with Kristian has resulted in the following findings:

   * the issue can be reproduced against older Derby version as well, unless an "invalid" database path (e.g. "C:\\whatever" on a unix system) AND a sane build is used...
   * If a sane build AND an invalid path is used, the booting attempts are stopped by an assertion failure, and no OutOfMemoryError (OOME) is seen:

org.apache.derby.shared.common.sanity.AssertFailure: ASSERT FAILED serviceName (/tmp/C:\DOES_NOT_EXIST) expected to equal getCanonicalServiceName(serviceName) (null)

     I am not yet sure if this is true for all versions of derby, or just some. Further testing is needed.

   * If a sane build and a valid path (e.g. "whateverDB") is used, we see the memory leak on all versions/platforms tested so far.
   * Also, if an insane build is used (regardless of path), we see the memory leak on all versions/platforms tested so far. I have tested insane versions of all official releases of Derby (and the current trunk) on Sun's 1.5.0_07 JVM.
   
With a max heap size of 32 MB the OOME occurs after about 49000 connection attempts.

I have not tested all variants and combinations of Derby versions, JVMs, database paths and operating systems, so I do not guarantee that these findings are 100% precise...


> DriverManager.getConnection leaks memory using EmbeddedDriver on non-existent database
> --------------------------------------------------------------------------------------
>
>                 Key: DERBY-2480
>                 URL: https://issues.apache.org/jira/browse/DERBY-2480
>             Project: Derby
>          Issue Type: Bug
>    Affects Versions: 10.0.2.0, 10.0.2.1, 10.1.1.0, 10.1.2.1, 10.1.3.1, 10.2.1.6, 10.2.2.0, 10.3.0.0
>         Environment: Windows Vista, JDK 1.4.2_13
> Solaris 10, Sun JDK 1.4.2 & 1.5.0
>            Reporter: Jeff Clary
>            Priority: Minor
>         Attachments: heap-server-Xmx32m.png, testOpenOfMissingDatabase.java
>
>
> Repeated calls to java.sql.DriverManager.getConnection("jdbc:derby:C:\\DOES_NOT_EXIST") leak memory and eventually lead to an OutOfMemoryError.
> This bug is similar to DERBY-1947 in that ContextManager objects are not getting removed from the HashSet.  The attached test program demonstrates the issue.  When run with VM options -Xms8m -Xmx8m, it throws an OutOfMemoryError after 19022 calls to DriverManager.getConnection.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Commented: (DERBY-2480) DriverManager.getConnection leaks memory using EmbeddedDriver on non-existent database

Posted by "John H. Embretsen (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/DERBY-2480?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_12484757 ] 

John H. Embretsen commented on DERBY-2480:
------------------------------------------

I tried the patch, DERBY-2480-1.diff, and it seems to fix this issue. Ran the repro (with modified database path on Solaris) against sane jars, 1M iterations with the embedded driver (8 MB max heap; fails after less than 20k iterations without the patch) and 160k iterations with the client driver (16 MB max heap in the server VM). I saw no signs of a memory leak. I used JDK 6 for testing and its JConsole tool for monitoring.

> DriverManager.getConnection leaks memory using EmbeddedDriver on non-existent database
> --------------------------------------------------------------------------------------
>
>                 Key: DERBY-2480
>                 URL: https://issues.apache.org/jira/browse/DERBY-2480
>             Project: Derby
>          Issue Type: Bug
>    Affects Versions: 10.0.2.0, 10.0.2.1, 10.1.1.0, 10.1.2.1, 10.1.3.1, 10.2.1.6, 10.2.2.0, 10.3.0.0
>         Environment: Windows Vista, JDK 1.4.2_13
> Solaris 10, Sun JDK 1.4.2 & 1.5.0
>            Reporter: Jeff Clary
>            Priority: Minor
>         Attachments: DERBY-2480-1.diff, heap-server-Xmx32m.png, Patch_DERBY-1947_and_DERBY-2480.diff, testOpenOfMissingDatabase.java
>
>
> Repeated calls to java.sql.DriverManager.getConnection("jdbc:derby:C:\\DOES_NOT_EXIST") leak memory and eventually lead to an OutOfMemoryError.
> This bug is similar to DERBY-1947 in that ContextManager objects are not getting removed from the HashSet.  The attached test program demonstrates the issue.  When run with VM options -Xms8m -Xmx8m, it throws an OutOfMemoryError after 19022 calls to DriverManager.getConnection.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Updated: (DERBY-2480) DriverManager.getConnection leaks memory using EmbeddedDriver on non-existent database

Posted by "John H. Embretsen (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/DERBY-2480?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

John H. Embretsen updated DERBY-2480:
-------------------------------------

    Attachment: heap-server-Xmx32m.png

I downloaded and modified the repro java file so that I could run it with the ClientDriver against a Derby Network Server. It seems that the issue is not limited to the EmbeddedDriver, as the server JVM (trunk/10.3) with a max heap of 32 MB hit an OutOfMemoryError after 46918 connection attempts (using JDK 6).

Attaching JConsole screenshot showing the heap usage for the server JVM: heap-server-Xmx32m.png.

> DriverManager.getConnection leaks memory using EmbeddedDriver on non-existent database
> --------------------------------------------------------------------------------------
>
>                 Key: DERBY-2480
>                 URL: https://issues.apache.org/jira/browse/DERBY-2480
>             Project: Derby
>          Issue Type: Bug
>    Affects Versions: 10.2.2.0, 10.3.0.0
>         Environment: Windows Vista, JDK 1.4.2_13
> Solaris 10, Sun JDK 1.4.2 & 1.5.0
>            Reporter: Jeff Clary
>            Priority: Minor
>         Attachments: heap-server-Xmx32m.png, testOpenOfMissingDatabase.java
>
>
> Repeated calls to java.sql.DriverManager.getConnection("jdbc:derby:C:\\DOES_NOT_EXIST") leak memory and eventually lead to an OutOfMemoryError.
> This bug is similar to DERBY-1947 in that ContextManager objects are not getting removed from the HashSet.  The attached test program demonstrates the issue.  When run with VM options -Xms8m -Xmx8m, it throws an OutOfMemoryError after 19022 calls to DriverManager.getConnection.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Updated: (DERBY-2480) DriverManager.getConnection leaks memory when connecting to a non-existent database

Posted by "John H. Embretsen (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/DERBY-2480?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

John H. Embretsen updated DERBY-2480:
-------------------------------------

    Attachment: d2480-junitTest_v1.stat
                d2480-junitTest_v1.diff

Attaching a patch (d2480-junitTest_v1.diff) which adds a JUnit test class to the ...functionTests.tests.memory package and a build file for that package. 

The test class is named ConnectionHandlingJunit.java, and its functionality is similar to that of the existing non-JUnit test class ConnectionHandling.java in the same package, added for DERBY-444. I imagine that the older test may be converted to JUnit at some point so that the two can be combined into one class - I was not creative enough to come up with a better name for the new test class.

The test uses java.sql.DriverManager to attempt to get a connection to a database that does not exist. The test is set up to run 130 thousand attempts, which should be more than enough to trigger this bug in JVMs with up to 64 MB of max heap size (the default on many desktop machines/JVMs).

The test is set up to run in embedded mode only. The test can run in client/server mode as well, but it has to be slightly modified and recompiled - see implementation comments.

The test has not been added to any larger JUnit suite, because it a) takes a while to run and b) eats JVM resources if the bug is present.

Run the test for example by doing: 

java junit.textui.TestRunner org.apache.derbyTesting.functionTests.tests.memory.ConnectionHandlingJunit

To observe test status (including memory "usage") while it is running, include -Dderby.tests.debug=true when starting the TestRunner.

Without Jeff's latest patch memory usage increases dramatically and an OutOfMemoryError is eventually thrown. With Jeff's patch, memory usage is very low and stable. I've run the test on Sun's JVMs 1.4.2_02, 1.5.0_07 and 1.6.0_01, using sane jars.

The test does not always fail when an OutOfMemoryError is thrown - I think this may be because the JVM is running out of resources and crashes before it gets that far. In any case, an alarm message should be printed when such an error occurs.

Please review/commit.


> DriverManager.getConnection leaks memory when connecting to a non-existent database
> -----------------------------------------------------------------------------------
>
>                 Key: DERBY-2480
>                 URL: https://issues.apache.org/jira/browse/DERBY-2480
>             Project: Derby
>          Issue Type: Bug
>    Affects Versions: 10.0.2.0, 10.0.2.1, 10.1.1.0, 10.1.2.1, 10.1.3.1, 10.2.1.6, 10.2.2.0, 10.3.0.0
>         Environment: Windows Vista, JDK 1.4.2_13
> Solaris 10, Sun JDK 1.4.2, 1.5.0 & 1.6.0
> Red Hat Enterprise Linux 4 (2.6.9-34.ELsmp_64), Sun JDK 1.5.0 & 1.6.0
>            Reporter: Jeff Clary
>         Assigned To: John H. Embretsen
>            Priority: Minor
>         Attachments: d2480-junitTest_v1.diff, d2480-junitTest_v1.stat, DERBY-2480-1.diff, derbyall_report.txt, heap-server-Xmx32m.png, Patch_DERBY-1947_and_DERBY-2480.diff, testOpenOfMissingDatabase.java
>
>
> Repeated calls to java.sql.DriverManager.getConnection("jdbc:derby:C:\\DOES_NOT_EXIST") leak memory and eventually lead to an OutOfMemoryError.
> This bug is similar to DERBY-1947 in that ContextManager objects are not getting removed from the HashSet.  The attached test program demonstrates the issue.  When run with VM options -Xms8m -Xmx8m, it throws an OutOfMemoryError after 19022 calls to DriverManager.getConnection.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Resolved: (DERBY-2480) DriverManager.getConnection leaks memory when connecting to a non-existent database

Posted by "Bryan Pendleton (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/DERBY-2480?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Bryan Pendleton resolved DERBY-2480.
------------------------------------

       Resolution: Fixed
    Fix Version/s: 10.3.0.0
       Derby Info:   (was: [Patch Available])

Thanks Jeff for the bug report, and for the patch. Thanks John for reviewing
the change and contributing the test program. And thanks to the other
reviewers for the comments and notes.

I submitted both patches in a single change to the trunk as revision 530159.


> DriverManager.getConnection leaks memory when connecting to a non-existent database
> -----------------------------------------------------------------------------------
>
>                 Key: DERBY-2480
>                 URL: https://issues.apache.org/jira/browse/DERBY-2480
>             Project: Derby
>          Issue Type: Bug
>    Affects Versions: 10.0.2.0, 10.0.2.1, 10.1.1.0, 10.1.2.1, 10.1.3.1, 10.2.1.6, 10.2.2.0, 10.3.0.0
>         Environment: Windows Vista, JDK 1.4.2_13
> Solaris 10, Sun JDK 1.4.2, 1.5.0 & 1.6.0
> Red Hat Enterprise Linux 4 (2.6.9-34.ELsmp_64), Sun JDK 1.5.0 & 1.6.0
>            Reporter: Jeff Clary
>         Assigned To: John H. Embretsen
>            Priority: Minor
>             Fix For: 10.3.0.0
>
>         Attachments: d2480-junitTest_v1.diff, d2480-junitTest_v1.stat, DERBY-2480-1.diff, derbyall_report.txt, heap-server-Xmx32m.png, Patch_DERBY-1947_and_DERBY-2480.diff, testOpenOfMissingDatabase.java
>
>
> Repeated calls to java.sql.DriverManager.getConnection("jdbc:derby:C:\\DOES_NOT_EXIST") leak memory and eventually lead to an OutOfMemoryError.
> This bug is similar to DERBY-1947 in that ContextManager objects are not getting removed from the HashSet.  The attached test program demonstrates the issue.  When run with VM options -Xms8m -Xmx8m, it throws an OutOfMemoryError after 19022 calls to DriverManager.getConnection.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Commented: (DERBY-2480) DriverManager.getConnection leaks memory using EmbeddedDriver on non-existent database

Posted by "Dag H. Wanvik (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/DERBY-2480?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_12483860 ] 

Dag H. Wanvik commented on DERBY-2480:
--------------------------------------

Hi Jeff, I looked at the patch, since I am working on the related
DERBY-1947. I think the change in your patch which adds the call on
cleanupOnError to EmbedConnection's constructor is orthogonal to the
changes I made in DERBY-1947-1, and it looks good.

I think that maybe the change you made to EmbedConnection's public
close method really addresses DERBY-1947? (I ran your repro
without OOM with just the change to the constructor's catch clause). 


I think it is better to make the changes for DERBY-1947 as a patch to
that issue, so you may want to simplify this patch to just keep the
constructor change. 

You may want to have a look at the patch I made for DERBY-1947. Feel
free to comment on that :) 



> DriverManager.getConnection leaks memory using EmbeddedDriver on non-existent database
> --------------------------------------------------------------------------------------
>
>                 Key: DERBY-2480
>                 URL: https://issues.apache.org/jira/browse/DERBY-2480
>             Project: Derby
>          Issue Type: Bug
>    Affects Versions: 10.0.2.0, 10.0.2.1, 10.1.1.0, 10.1.2.1, 10.1.3.1, 10.2.1.6, 10.2.2.0, 10.3.0.0
>         Environment: Windows Vista, JDK 1.4.2_13
> Solaris 10, Sun JDK 1.4.2 & 1.5.0
>            Reporter: Jeff Clary
>            Priority: Minor
>         Attachments: heap-server-Xmx32m.png, Patch_DERBY-1947_and_DERBY-2480.diff, testOpenOfMissingDatabase.java
>
>
> Repeated calls to java.sql.DriverManager.getConnection("jdbc:derby:C:\\DOES_NOT_EXIST") leak memory and eventually lead to an OutOfMemoryError.
> This bug is similar to DERBY-1947 in that ContextManager objects are not getting removed from the HashSet.  The attached test program demonstrates the issue.  When run with VM options -Xms8m -Xmx8m, it throws an OutOfMemoryError after 19022 calls to DriverManager.getConnection.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Updated: (DERBY-2480) DriverManager.getConnection leaks memory using EmbeddedDriver on non-existent database

Posted by "Kristian Waagan (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/DERBY-2480?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Kristian Waagan updated DERBY-2480:
-----------------------------------

             Priority: Minor  (was: Major)
           Derby Info: [Regression]
          Environment: 
Windows Vista, JDK 1.4.2_13
Solaris 10, Sun JDK 1.4.2 & 1.5.0

  was:Windows Vista, JDK 1.4.2_13

    Affects Version/s: 10.3.0.0

I tried the repro on Solaris 10 with both Java 1.4.2 and Java 1.5. Both failed with Derby 10.2.2.0 and with trunk.
However, I was not able to reproduce the bug with Derby 10.1.3.1, so this seems like a regression. I stopped the test after a little over 500'000 iterations.

We could maybe add the repro to the test suite, as doing the connect a reasonable number of times (say 20-50000 repetitions) doesn't take long when the memory leak is not around. 50000 iterations with 10.1.3.1 took around 25 seconds on my machine. The problem is that we have to run this in a separate VM, and I don't know how good support we have for that currently?

I also lowered the priority, as I consider this use-case a bit "on the edge" compared to common practice.

Thank you for the report :)

> DriverManager.getConnection leaks memory using EmbeddedDriver on non-existent database
> --------------------------------------------------------------------------------------
>
>                 Key: DERBY-2480
>                 URL: https://issues.apache.org/jira/browse/DERBY-2480
>             Project: Derby
>          Issue Type: Bug
>    Affects Versions: 10.2.2.0, 10.3.0.0
>         Environment: Windows Vista, JDK 1.4.2_13
> Solaris 10, Sun JDK 1.4.2 & 1.5.0
>            Reporter: Jeff Clary
>            Priority: Minor
>         Attachments: testOpenOfMissingDatabase.java
>
>
> Repeated calls to java.sql.DriverManager.getConnection("jdbc:derby:C:\\DOES_NOT_EXIST") leak memory and eventually lead to an OutOfMemoryError.
> This bug is similar to DERBY-1947 in that ContextManager objects are not getting removed from the HashSet.  The attached test program demonstrates the issue.  When run with VM options -Xms8m -Xmx8m, it throws an OutOfMemoryError after 19022 calls to DriverManager.getConnection.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Updated: (DERBY-2480) DriverManager.getConnection leaks memory when connecting to a non-existent database

Posted by "Kathey Marsden (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/DERBY-2480?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Kathey Marsden updated DERBY-2480:
----------------------------------

    Component/s: JDBC

> DriverManager.getConnection leaks memory when connecting to a non-existent database
> -----------------------------------------------------------------------------------
>
>                 Key: DERBY-2480
>                 URL: https://issues.apache.org/jira/browse/DERBY-2480
>             Project: Derby
>          Issue Type: Bug
>          Components: JDBC
>    Affects Versions: 10.0.2.0, 10.0.2.1, 10.1.1.0, 10.1.2.1, 10.1.3.1, 10.2.1.6, 10.2.2.0, 10.3.1.4
>         Environment: Windows Vista, JDK 1.4.2_13
> Solaris 10, Sun JDK 1.4.2, 1.5.0 & 1.6.0
> Red Hat Enterprise Linux 4 (2.6.9-34.ELsmp_64), Sun JDK 1.5.0 & 1.6.0
>            Reporter: Jeff Clary
>            Assignee: John H. Embretsen
>            Priority: Minor
>             Fix For: 10.3.1.4
>
>         Attachments: d2480-junitTest_v1.diff, d2480-junitTest_v1.stat, DERBY-2480-1.diff, derbyall_report.txt, heap-server-Xmx32m.png, Patch_DERBY-1947_and_DERBY-2480.diff, testOpenOfMissingDatabase.java
>
>
> Repeated calls to java.sql.DriverManager.getConnection("jdbc:derby:C:\\DOES_NOT_EXIST") leak memory and eventually lead to an OutOfMemoryError.
> This bug is similar to DERBY-1947 in that ContextManager objects are not getting removed from the HashSet.  The attached test program demonstrates the issue.  When run with VM options -Xms8m -Xmx8m, it throws an OutOfMemoryError after 19022 calls to DriverManager.getConnection.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.