Closed
Bug 120651
Opened 23 years ago
Closed 23 years ago
Leak in getting cert list
Categories
(NSS :: Libraries, defect, P1)
Tracking
(Not tracked)
RESOLVED
FIXED
3.4
People
(Reporter: rangansen, Assigned: rrelyea)
References
Details
Attachments
(4 files)
2.54 KB,
patch
|
Details | Diff | Splinter Review | |
945 bytes,
patch
|
Details | Diff | Splinter Review | |
1.79 KB,
patch
|
Details | Diff | Splinter Review | |
2.20 KB,
patch
|
Details | Diff | Splinter Review |
Getting a list of CA certs by calling 'PK11_ListCerts' and subsequently invoking CERT_DestroyCertList is leaking a big chunk of memmory. In fact just executing a block like: for(int j=0;j<20;j++){ caList = PK11_ListCerts(PK11CertListCA, 0); CERT_DestroyCertList(caList); } increases around 300K of VM in each pass [and the total VM consumed steadily rises - never goes down]. This is probably not a cache related issue, because repeating the same call increases VM consumption by almost the same amount everytime.
Reporter | ||
Updated•23 years ago
|
Priority: -- → P1
Comment 2•23 years ago
|
||
At one time I had run this through purify and it was clean. I'll try it again.
Assignee | ||
Comment 3•23 years ago
|
||
On the latest source, Purify shows not leaks on
Status: NEW → RESOLVED
Closed: 23 years ago
Resolution: --- → FIXED
Assignee | ||
Comment 4•23 years ago
|
||
The above comment should read "on the latest source, Purify shows no leaks in the sample code fragment"
Reporter | ||
Comment 5•23 years ago
|
||
True, but running the code fragment in a debugger, and tracking the Virtual Mem usage in NT, it still shows an increment of VM usage by around 120K in each pass. I am not sure why purify does not show it, but since the VM usage grows pretty consistently and never seems to reach a steady value [even after 50 passes], there's definitely a leak somewhere. What's interesting is that the increment of VM usage per pass has now come down from around 300K to 120K, indicating some of the involved leaks have already got plugged, probably as a side effect of other fixes.
Status: RESOLVED → REOPENED
Resolution: FIXED → ---
Assignee | ||
Comment 6•23 years ago
|
||
Can you specify the EXACT steps you are going through to reproduce this problem. I don't see that in my simple test program which just includes your code fragment. Thanks.
Reporter | ||
Comment 7•23 years ago
|
||
I just set a breakpoint here: for(int j=0;j<50;j++){ ---> caList = PK11_ListCerts(PK11CertListCA, 0); CERT_DestroyCertList(caList); } and open the NT Task Manager->Processes Tab, add VM Size in the display by selecting it from view->select columns. Everytime it executes the loop, the VM size grows by around 120K.
Reporter | ||
Comment 8•23 years ago
|
||
Bob, here's the test program - #include <security/nss.h> #include <security/ssl.h> #include <security/pk11func.h> #include <security/cert.h> #include <security/certt.h> #include <security/certdb.h> #include <security/nssb64.h> #include <security/secmod.h> #include <prlink.h> main() { CERTCertList * caList; int k; char c; caList = NULL; NSS_InitReadWrite("."); for(k=0;k<50;k++){ caList = PK11_ListCerts(PK11CertListCA, 0); CERT_DestroyCertList(caList); printf("Loop %d Done",k); scanf("%c",&c); } }
Assignee | ||
Comment 9•23 years ago
|
||
OK this bug is at least related to the leaks found in 123081. bob
Depends on: 123081
Assignee | ||
Comment 10•23 years ago
|
||
The following patches reduce the memory leaks by 1/3. You need to apply all three patches. I'm also going to check in changes which renames the .c files in the built-in directory so they dont' conflict with the files in the ckfw directory. The patches do not reflect those changes.
Assignee | ||
Comment 11•23 years ago
|
||
Assignee | ||
Comment 12•23 years ago
|
||
Note this patch also requires a regen of certdata.h
Assignee | ||
Comment 13•23 years ago
|
||
These patches are in files that will also be renamed.
Assignee | ||
Comment 14•23 years ago
|
||
1) Fix leaks in error paths (bfind.c -- found by inspection). 2) Don't allocate hash table data out of the arena. PL_Hash grows and shrinks the hash buckets as necessary. In arenas they will just grow. 3) Don't allocate temparary locks out of the global instance arena pool. This looks like we get down to '0' leaks (we are at least small enough not to show measurable growth in the VM table after 200 runs.
Assignee | ||
Comment 15•23 years ago
|
||
See patch
Status: REOPENED → RESOLVED
Closed: 23 years ago → 23 years ago
Resolution: --- → FIXED
You need to log in
before you can comment on or make changes to this bug.
Description
•