Closed Bug 236228 Opened 21 years ago Closed 21 years ago

NSPR LOG Buffering isn't WinDebug safe

Categories

(NSPR :: NSPR, defect)

x86
Windows XP
defect
Not set
normal

Tracking

(Not tracked)

RESOLVED FIXED

People

(Reporter: timeless, Assigned: wtc)

Details

Attachments

(1 file, 2 obsolete files)

Steps: build nspr build nspr tests set NSPR_LOG_FILE=WinDebug set NSPR_LOG_MODULES=all:5 run logger.exe there are two possible crashes. this stack is for the second: crash: ntdll.dll!RtlEnterCriticalSection() + 0xb > nspr4.dll!PR_LogFlush() Line 487 + 0xe C logger.exe!main(int argc=0x00000001, const char * * argv=0x00342c38) Line 153 C logger.exe!mainCRTStartup() Line 400 + 0xe C kernel32.dll!GetCurrentDirectoryW() + 0x44
Attachment #142759 - Flags: review?(wchang0222)
Is it possible to fix this bug while preserving buffering for WinDebug?
Status: NEW → ASSIGNED
preserve? .. heh, that sounds as if buffering ever worked for windebug. it didn't, it just crashed. Further, fputs() doesn't do anything with the nb param to _PUT_LOG. So to be blunt, buffering and _PUT_LOG don't work for _PR_USE_STDIO_FOR_LOGGING. I think I experienced that bug while I was testing my fix. Anyway, to do it would require a few things, one is moving the OutputDebugString call into _PUT_LOG, the other is storing and then mutating buf[nb] so that only nb bytes are logged.
Attachment #142759 - Attachment is obsolete: true
Attachment #142832 - Flags: review?(wchang0222)
wtc: could you please review this?
timeless, could you review and test this patch? This is essentially your patch with some minor editings and a change to use fwrite instead of fputs.
Attachment #142832 - Attachment is obsolete: true
Attachment #146815 - Flags: review?(timeless)
Attachment #142759 - Flags: review?(wchang0222)
Attachment #142832 - Flags: review?(wchang0222)
Comment on attachment 146815 [details] [diff] [review] alternative path v1.1 works fine, looks fine (after reading man fwrite) sorry about the \ formatting, i guess that's mozilla's style... warning, the bit in @@ -348,8 +361,8 @@ will conflict with the patch in bug 237326. (since that bug rewrites the entire function, but includes the same change.)
Attachment #146815 - Flags: review?(timeless) → review+
Patch checked into the NSPR tip (NSPR 4.6) and NSPRPUB_PRE_4_2_CLIENT_BRANCH (Mozilla 1.8 alpha). Thanks for the patch, timeless.
Status: ASSIGNED → RESOLVED
Closed: 21 years ago
Resolution: --- → FIXED
Target Milestone: --- → 4.6
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Creator:
Created:
Updated:
Size: