Closed Bug 218846 Opened 21 years ago Closed 17 years ago

The primordial thread is attached again in _PR_CleanupIO in PR_Cleanup.

Categories

(NSPR :: NSPR, defect)

x86
Windows XP
defect
Not set
normal

Tracking

(Not tracked)

RESOLVED FIXED

People

(Reporter: wtc, Assigned: wtc)

References

Details

Attachments

(1 file, 1 obsolete file)

This bug is in the NSPR classic code base. I haven't looked at the pthread version to see if it also has this bug. In PR_Cleanup, we first set the current thread to NULL (in _PR_MD_EXIT_THREAD) and then call _PR_CleanupIO. But _PR_CleanupIO calls PR_Lock, which attaches the current thread again. Here is the stack trace: =>[1] _PRI_AttachThread(type = RW_WRITER, priority = PR_PRIORITY_NORMAL, stack = (nil), flags = 0), line 1453 in "pruthr.c" [2] _pr_current_thread_tls(), line 359 in "solaris.c" [3] PR_Lock(lock = 0x24f50), line 224 in "prulock.c" [4] _PR_Putfd(fd = 0x22778), line 173 in "prfdcach.c" [5] PR_FreeFileDesc(fd = 0x22778), line 149 in "prio.c" [6] _PR_CleanupIO(), line 80 in "prio.c" [7] PR_Cleanup(), line 453 in "prinit.c" [8] main(argc = 1, argv = 0xffbef90c), line 409 in "foreign.c" Seems that we need to move the _PR_MD_EXIT_THREAD call near the end of the PR_Cleanup call.
*** Bug 222709 has been marked as a duplicate of this bug. ***
PR_Cleanup must be slightly reordered: threads must be cleaned-up *AFTER* CleanupIO(), as CleanupIO() does a _pr_current_thread_tls.
Sorry for the delay. We have been successfully using the proposed patch (for NSPR version 4.3) since beginning of March.
QA Contact: wtchang → nspr
Status: NEW → ASSIGNED
Target Milestone: --- → 4.7.1
To fix the memory leaks in PR_Cleanup, we must move the _PR_CleanupIO call before the _PR_MD_EXIT_THREAD(me) call. I moved _PR_CleanupIO (and _PR_CleanupNet) further up, before where we start to clean up the current thread. I checked in this patch (a variant of Gerard's patch) on the NSPR trunk (NSPR 4.7.1). Checking in prinit.c; /cvsroot/mozilla/nsprpub/pr/src/misc/prinit.c,v <-- prinit.c new revision: 3.49; previous revision: 3.48 done
Attachment #154971 - Attachment is obsolete: true
Status: ASSIGNED → RESOLVED
Closed: 17 years ago
Resolution: --- → FIXED
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Creator:
Created:
Updated:
Size: