Closed Bug 49813 Opened 24 years ago Closed 21 years ago

"threadsafe" nsDirectoryIndexStream uses nsDirEnumeratorUnix triggering "not thread-safe" assertion

Categories

(Core :: Networking, defect, P3)

x86
FreeBSD
defect

Tracking

()

VERIFIED FIXED

People

(Reporter: jesup, Assigned: timeless)

References

()

Details

(Keywords: assertion)

Attachments

(2 files)

Got this assertion when browsing to file:///tmp on FreeBSD 3.4.  Build was
a fresh pull and clobber 8/21/00.  Probably related to bug 47356.

Breakpoint 2, nsDebug::Assertion (
    aStr=0x281eab80 "nsDirEnumeratorUnix not thread-safe", 
    aExpr=0x281f5ca0 "owningThread == NS_CurrentThread()", 
    aFile=0x281f5c7d "nsDebug.cpp", aLine=487) at nsDebug.cpp:191
(gdb) bt
#0  nsDebug::Assertion (
    aStr=0x281eab80 "nsDirEnumeratorUnix not thread-safe", 
    aExpr=0x281f5ca0 "owningThread == NS_CurrentThread()", 
    aFile=0x281f5c7d "nsDebug.cpp", aLine=487) at nsDebug.cpp:191
#1  0x281972f8 in NS_CheckThreadSafe (owningThread=0x8767600, 
    msg=0x281eab80 "nsDirEnumeratorUnix not thread-safe")
    at nsDebug.cpp:487
#2  0x28171c03 in nsDirEnumeratorUnix::Release (this=0x8f24220)
    at nsLocalFileUnix.cpp:150
#3  0x805eb57 in nsCOMPtr<nsISimpleEnumerator>::~nsCOMPtr (
    this=0x90c5f64, __in_chrg=2) at ../../dist/include/nsCOMPtr.h:489
#4  0x28749ce3 in nsDirectoryIndexStream::~nsDirectoryIndexStream (
    this=0x90c5f00, __in_chrg=3) at nsDirectoryIndexStream.cpp:92
#5  0x28749f0b in nsDirectoryIndexStream::Release (this=0x90c5f00)
    at nsDirectoryIndexStream.cpp:114
#6  0x805b4c9 in nsCOMPtr<nsIInputStream>::assign_assuming_AddRef (
    this=0x8bd8858, newPtr=0x0) at ../../dist/include/nsCOMPtr.h:471
#7  0x281cbab5 in nsCOMPtr<nsIInputStream>::assign_with_AddRef (
    this=0x8bd8858, rawPtr=0x0)
    at ../../../../dist/include/nsCOMPtr.h:848
#8  0x281cbced in nsCOMPtr<nsIInputStream>::operator= (this=0x8bd8858, 
    rhs=0x0) at ../../../../dist/include/nsCOMPtr.h:583
#9  0x28738b6c in nsFileTransport::Process (this=0x8bd8800)
    at nsFileTransport.cpp:512
#10 0x287381bd in nsFileTransport::Run (this=0x8bd8800)
    at nsFileTransport.cpp:360
#11 0x2819088b in nsThreadPoolRunnable::Run (this=0x8258680)
    at nsThread.cpp:689
#12 0x2818e4cd in nsThread::Main (arg=0x81e4de0) at nsThread.cpp:84
#13 0x282fd271 in _pt_root (arg=0x8238f80) at ptthread.c:198
#14 0x28346a5e in _thread_start () from /usr/lib/libc_r.so.3
#15 0x0 in ?? ()
(gdb)
After checking a little more on non-thread-safe issues, I'm raising this to 
Major.  thread-safety issues could cause crashes and/or dataloss.
Severity: normal → major
Target Milestone: --- → mozilla0.9.2
Target Milestone: mozilla0.9.2 → mozilla0.9.3
Missed the 0.9.3 train.
Target Milestone: mozilla0.9.3 → mozilla0.9.4
and 0.9.4
Target Milestone: mozilla0.9.4 → mozilla0.9.5
->0.9.6
Target Milestone: mozilla0.9.5 → mozilla0.9.6
-> 1.0
Target Milestone: mozilla0.9.6 → mozilla1.0
Bugs targeted at mozilla1.0 without the mozilla1.0 keyword moved to mozilla1.0.1 
(you can query for this string to delete spam or retrieve the list of bugs I've 
moved)
Target Milestone: mozilla1.0 → mozilla1.0.1
Moving all threading bugs to XPCOM. See bug 160356.
Component: Threading → XPCOM
retargeting
Target Milestone: mozilla1.0.1 → Future
Attached patch fix callerSplinter Review
I attached one way that should resolve this problem
Assignee: rpotts → timeless
Component: XPCOM → Networking
Keywords: assertion
QA Contact: rpotts → benc
Summary: nsDirEnumeratorUnix not thread-safe → "threadsafe" nsDirectoryIndexStream uses nsDirEnumeratorUnix triggering "not thread-safe" assertion
Target Milestone: Future → ---
Attachment #134506 - Flags: superreview?(darin)
Attachment #134506 - Flags: review?(darin)
Comment on attachment 134506 [details] [diff] [review]
fix caller

i think it'd be better to not store mDir.  it doesn't even seem to be used for
anything past Init(), so i think you can just stop storing it :-)
Attachment #134506 - Flags: superreview?(darin)
Attachment #134506 - Flags: review?(darin)
Attachment #134506 - Flags: review-
I have this vague recollection that I needed this for something. this ties into
the THREADSAFE_I18N stuff too, of course.
Attachment #134810 - Flags: review?(darin)
Comment on attachment 134810 [details] [diff] [review]
fix caller, skip the useless member

hmm... if we are no longer saving mDir, then is the Clone really necessary?
darin: well, the "interface" doesn't specify whether the nsIFile it takes is
usable. it turns out that you "fixed" the caller (nsFileChannel) by having it
create a new nsIFile which it passed to nsDirectoryIndexStream. Given the way
the code is today, I'll drop the clone and add comments to the .h indicating
that the nsIFile will be used on its calling thread.
Status: NEW → ASSIGNED
Comment on attachment 134810 [details] [diff] [review]
fix caller, skip the useless member

r+sr=darin w/ dir cloning dropped.
Attachment #134810 - Flags: superreview+
Attachment #134810 - Flags: review?(darin)
Attachment #134810 - Flags: review+
checked in
Status: ASSIGNED → RESOLVED
Closed: 21 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: