Closed Bug 430544 Opened 17 years ago Closed 2 years ago

Solve the leak of PLArenas in NSS tools

Categories

(NSS :: Tools, defect, P5)

Tracking

(Not tracked)

RESOLVED INACTIVE

People

(Reporter: wtc, Unassigned)

References

Details

Attachments

(1 file)

Since NSS uses PLArena's extensively, any NSS tool that calls PR_Cleanup should also call PL_ArenaFinish (right before the PR_Cleanup call) to destroy NSPR's internal PLArena freelist.
Should we just make NSS_Shutdown call this function? That would fix all the tools and customer programs, too, in one blow. And if the customer programs are already calling it (fat chance!) it wouldn't hurt if it gets called twice, I think.
NSS_Shutdown can't call PL_ArenaFinish or PR_Cleanup because the application may continue to use PLArena or NSPR after shutting down NSS. We can add a SECU_Shutdown function that does NSS_Shutdown PL_ArenaFinish PR_Cleanup or add a SECU_ShutdownNSPR function that does PL_ArenaFinish PR_Cleanup to share the common shutdown sequence in the command-line tools.
If NSS can't clean them up, could/should NSPR clean up the arenas at the very least? I assume that if the arenas need NSPR, NSPR can clean them up safely. If not, it should probably be documented.
I think you're suggesting that PR_Cleanup could call PL_ArenaFinish. IIRC, the reason we don't do that is to avoid circular dependencies between NSPR's shared libraries. NSPR has 3 or 4 shared libs in all. We let all the libs depend on libnspr4, but we don't let libnspr4 depend on any of the others. Now, some ways to work around that might include: a) having a way for the other libs to dynamically register shut down functions with libnspr, so that libnspr's PR_Cleanup can call those shutdown functions without being linked against those libs. b) create Cleanup functions in the other libs, e.g. PL_Cleanup, that call PR_Cleanup, and convert NSS's test programs to call PL_Cleanup instead of PR_Cleanup.
Summary: NSS tools should call PL_ArenaFinish on shutdown → Solve the leak of PLArenas in NSS tools
Depends on: 581804
Comment on attachment 461053 [details] [diff] [review] certutil-arenafinish.diff (checked in) r=wtc. I checked in this patch on the NSS trunk (NSS 3.13). Checking in certutil.c; /cvsroot/mozilla/security/nss/cmd/certutil/certutil.c,v <-- certutil.c new revision: 1.150; previous revision: 1.149 done
Attachment #461053 - Attachment description: certutil-arenafinish.diff → certutil-arenafinish.diff (checked in)
Attachment #461053 - Flags: review?(wtc) → review+
Severity: minor → S4
Status: NEW → RESOLVED
Closed: 2 years ago
Priority: -- → P5
Resolution: --- → INACTIVE
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Creator:
Created:
Updated:
Size: