Closed Bug 645535 Opened 14 years ago Closed 14 years ago

when starting Firefox, lots of WARNING: NS_ENSURE_SUCCESS(rv, rv) failed with result 0x80520012: file netwerk/base/src/nsFileStreams.cpp, line 209

Categories

(Core :: Networking, defect)

x86_64
Linux
defect
Not set
normal

Tracking

()

RESOLVED FIXED
mozilla5

People

(Reporter: dbaron, Assigned: azakai)

References

Details

(Whiteboard: [console-spew])

Attachments

(2 files)

When I start up Firefox, I see a lot of: WARNING: NS_ENSURE_SUCCESS(rv, rv) failed with result 0x80520012: file /home/dbaron/builds/ssd/mozilla-central/mozilla/netwerk/base/src/nsFileStreams.cpp, line 209 This warning was introduced in bug 634666, in https://hg.mozilla.org/mozilla-central/rev/204bb4873d1b . I *think* 0x08520012 is NS_ERROR_FILE_NOT_DIRECTORY (but I did the math in my head). In any case, these warnings print too much to the console -- either (a) this isn't an exceptional condition and the NS_ENSURE_SUCCESS should just be an if (NS_FAILED(rv)) return rv;, or (b) it's an exceptional condition and we should fix the callers causing it to avoid it. The stack for the spew of these at startup is: #0 NS_DebugBreak_P (aSeverity=0, aStr=0x7fffe0716ce0 "NS_ENSURE_SUCCESS(rv, rv) failed with result 0x80520012", aExpr=0x0, aFile=0x7ffff68f3030 "/home/dbaron/builds/ssd/mozilla-central/mozilla/netwerk/base/src/nsFileStreams.cpp", aLine=209) at /home/dbaron/builds/ssd/mozilla-central/mozilla/xpcom/base/nsDebugImpl.cpp:264 #1 0x00007ffff487eac2 in nsFileStream::DoOpen (this=<value optimized out>) at /home/dbaron/builds/ssd/mozilla-central/mozilla/netwerk/base/src/nsFileStreams.cpp:209 #2 0x00007ffff487d4b4 in nsFileStream::MaybeOpen (this=0x7fffe06df960, aFile=0x0, aIoFlags=0, aPerm=-158388176, aDeferred=209) at /home/dbaron/builds/ssd/mozilla-central/mozilla/netwerk/base/src/nsFileStreams.cpp:191 #3 0x00007ffff487d815 in nsFileInputStream::Open (this=0x7fffe06df960, aFile=0x7fffe07255c0, aIOFlags=1, aPerm=0) at /home/dbaron/builds/ssd/mozilla-central/mozilla/netwerk/base/src/nsFileStreams.cpp:284 #4 0x00007ffff487da29 in nsFileInputStream::Init (this=0x7fffe06df960, aFile=0x7fffe07255c0, aIOFlags=-1, aPerm=-1, aBehaviorFlags=209) at /home/dbaron/builds/ssd/mozilla-central/mozilla/netwerk/base/src/nsFileStreams.cpp:316 #5 0x00007ffff5adfce2 in nsOSHelperAppService::CreateInputStream ( aFilename=<value optimized out>, aFileInputStream=<value optimized out>, aLineInputStream=<value optimized out>, aBuffer=..., aNetscapeFormat=0x7fffffffaefc, aMore=0x7fffffffaef8) at /home/dbaron/builds/ssd/mozilla-central/mozilla/uriloader/exthandler/unix/nsOSHelperAppService.cpp:341 #6 0x00007ffff5ae1041 in nsOSHelperAppService::GetTypeAndDescriptionFromMimetypesFile (aFilename=..., aFileExtension=..., aMajorType=<value optimized out>, aMinorType=<value optimized out>, aDescription=<value optimized out>) at /home/dbaron/builds/ssd/mozilla-central/mozilla/uriloader/exthandler/unix/nsOSHelperAppService.cpp:390 #7 0x00007ffff5ae3cd4 in nsOSHelperAppService::LookUpTypeAndDescription ( aFileExtension=..., aMajorType=..., aMinorType=..., aDescription=..., aUserData=<value optimized out>) at /home/dbaron/builds/ssd/mozilla-central/mozilla/uriloader/exthandler/unix/nsOSHelperAppService.cpp:301 #8 0x00007ffff5ae4ca7 in nsOSHelperAppService::GetFromExtension ( this=<value optimized out>, aFileExt=...) at /home/dbaron/builds/ssd/mozilla-central/mozilla/uriloader/exthandler/unix/nsOSHelperAppService.cpp:1329 #9 0x00007ffff5ae54f3 in nsOSHelperAppService::GetMIMEInfoFromOS ( this=0x7fffe04b7b70, aType=..., aFileExt=..., aFound=0x7fffffffbcd8) at /home/dbaron/builds/ssd/mozilla-central/mozilla/uriloader/exthandler/unix/nsOSHelperAppService.cpp:1571 #10 0x00007ffff5accc6b in nsExternalHelperAppService::GetTypeFromExtension ( this=0x7fffe04b7b70, aFileExt=..., aContentType=...) at /home/dbaron/builds/ssd/mozilla-central/mozilla/uriloader/exthandler/nsExternalHelperAppService.cpp:2762 #11 0x00007ffff5acadc8 in nsExternalHelperAppService::GetTypeFromFile ( this=0x7fffe04b7b70, aFile=<value optimized out>, aContentType=...) at /home/dbaron/builds/ssd/mozilla-central/mozilla/uriloader/exthandler/nsExternalHelperAppService.cpp:2898 #12 0x00007ffff4940e03 in nsFileChannel::MakeFileInputStream ( this=0x7fffe0716840, file=0x7fffe06f39d0, stream=<value optimized out>, contentType=...) at /home/dbaron/builds/ssd/mozilla-central/mozilla/netwerk/protocol/file/nsFileChannel.cpp:301 #13 0x00007ffff49424c9 in nsFileChannel::OpenContentStream ( this=0x7fffe0716840, async=<value optimized out>, result=<value optimized out>, channel=<value optimized out>) at /home/dbaron/builds/ssd/mozilla-central/mozilla/netwerk/protocol/file/nsFileChannel.cpp:370 #14 0x00007ffff486fdb5 in nsBaseChannel::Open (this=0x0, result=0x7fffffffc2a8) at /home/dbaron/builds/ssd/mozilla-central/mozilla/netwerk/base/src/nsBaseChannel.cpp:548 #15 0x00007ffff4a5ba1d in NS_OpenURI (this=0x7fffe0611810, aFPIStr=<value optimized out>, aURLStr=<value optimized out>, aBaseURL=<value optimized out>, aStream=<value optimized out>, aAbsURL=<value optimized out>) at ../../../dist/include/nsNetUtil.h:282 #16 nsExpatDriver::OpenInputStreamFromExternalDTD (this=0x7fffe0611810, aFPIStr=<value optimized out>, aURLStr=<value optimized out>, aBaseURL=<value optimized out>, aStream=<value optimized out>, aAbsURL=<value optimized out>) at /home/dbaron/builds/ssd/mozilla-central/mozilla/parser/htmlparser/src/nsExpatDriver.cpp:802 #17 0x00007ffff4a5bed3 in nsExpatDriver::HandleExternalEntityRef ( this=0x7fffe0611810, openEntityNames=<value optimized out>, base=0x7fffe060c964, systemId=0x7fffe07170c0, publicId=0x0) at /home/dbaron/builds/ssd/mozilla-central/mozilla/parser/htmlparser/src/nsExpatDriver.cpp:710 #18 0x00007ffff4a94857 in doProlog (parser=0x7fffe0640050, enc=0x7ffff721bf80, s=0x7fffe069b98c "%", end=<value optimized out>, tok=<value optimized out>, next=0x7fffe069b9ac "\n", nextPtr=0x7fffffffc8a8, haveMore=1 '\001') at /home/dbaron/builds/ssd/mozilla-central/mozilla/parser/expat/lib/xmlparse.c:4588 #19 0x00007ffff4a9523b in prologProcessor (parser=0x7fffe0640050, s=0x7fffe069b1f0 "<", end=0x7fffe06ab1f0 "", nextPtr=0x7fffffffc8a8) at /home/dbaron/builds/ssd/mozilla-central/mozilla/parser/expat/lib/xmlparse.c:3809 #20 prologInitProcessor (parser=0x7fffe0640050, s=0x7fffe069b1f0 "<", end=0x7fffe06ab1f0 "", nextPtr=0x7fffffffc8a8) at /home/dbaron/builds/ssd/mozilla-central/mozilla/parser/expat/lib/xmlparse.c:3626 #21 0x00007ffff4a903dd in MOZ_XML_Parse (parser=0x0, s=0x7fffe069b1f0 "<", len=<value optimized out>, isFinal=0) at /home/dbaron/builds/ssd/mozilla-central/mozilla/parser/expat/lib/xmlparse.c:1528 #22 0x00007ffff4a5776f in nsExpatDriver::ParseBuffer (this=0x7fffe0611810, aBuffer=0x7fffe069b1f0, aLength=32768, aIsFinal=0, aConsumed=0x7fffffffcb6c) at /home/dbaron/builds/ssd/mozilla-central/mozilla/parser/htmlparser/src/nsExpatDriver.cpp:1006 #23 0x00007ffff4a5d24b in nsExpatDriver::ConsumeToken (this=0x7fffe0611810, aScanner=<value optimized out>, aFlushTokens=<value optimized out>) at /home/dbaron/builds/ssd/mozilla-central/mozilla/parser/htmlparser/src/nsExpatDriver.cpp:1104 #24 0x00007ffff4a74cc0 in nsParser::Tokenize (this=0x7fffe04ceeb0, aIsFinalChunk=0) at /home/dbaron/builds/ssd/mozilla-central/mozilla/parser/htmlparser/src/nsParser.cpp:3086 #25 0x00007ffff4a7afe6 in nsParser::ResumeParse (this=0x7fffe04ceeb0, allowIteration=<value optimized out>, aIsFinalChunk=<value optimized out>, aCanInterrupt=1) at /home/dbaron/builds/ssd/mozilla-central/mozilla/parser/htmlparser/src/nsParser.cpp:2318 #26 0x00007ffff4a73ef8 in nsParser::OnDataAvailable (this=0x7fffe04ceeb0, request=<value optimized out>, aContext=<value optimized out>, pIStream=<value optimized out>, sourceOffset=<value optimized out>, aLength=129087) at /home/dbaron/builds/ssd/mozilla-central/mozilla/parser/htmlparser/src/nsParser.cpp:2950 #27 0x00007ffff486f11e in nsBaseChannel::OnDataAvailable ( this=0x7fffe064bf60, request=<value optimized out>, ctxt=<value optimized out>, stream=0x7fffe064c648, offset=0, count=129087) at /home/dbaron/builds/ssd/mozilla-central/mozilla/netwerk/base/src/nsBaseChannel.cpp:755 #28 0x00007ffff4887933 in nsInputStreamPump::OnStateTransfer ( this=0x7fffe064c370) at /home/dbaron/builds/ssd/mozilla-central/mozilla/netwerk/base/src/nsInputStreamPump.cpp:510 #29 0x00007ffff4887c80 in nsInputStreamPump::OnInputStreamReady ( this=0x7fffe064c370, stream=0x7fffe0716ce0) at /home/dbaron/builds/ssd/mozilla-central/mozilla/netwerk/base/src/nsInputStreamPump.cpp:400 #30 0x00007ffff623978d in nsInputStreamReadyEvent::Run (this=0x7fffe0617de0) at /home/dbaron/builds/ssd/mozilla-central/mozilla/xpcom/io/nsStreamUtils.cpp:112 #31 0x00007ffff62668fd in nsThread::ProcessNextEvent (this=0x7fffe0000e40, mayWait=0, result=<value optimized out>) at /home/dbaron/builds/ssd/mozilla-central/mozilla/xpcom/threads/nsThread.cpp:647 #32 0x00007ffff61e1134 in NS_ProcessNextEvent_P (thread=0x0, mayWait=-529437472) at nsThreadUtils.cpp:250 #33 0x00007ffff60b5b7b in mozilla::ipc::MessagePump::Run (this=0x6b7a10, aDelegate=0x6c8420) at /home/dbaron/builds/ssd/mozilla-central/mozilla/ipc/glue/MessagePump.cpp:110 #34 0x00007ffff62dc06c in MessageLoop::RunInternal (this=0x6c8420) at /home/dbaron/builds/ssd/mozilla-central/mozilla/ipc/chromium/src/base/message_loop.cc:219 #35 MessageLoop::RunHandler (this=0x6c8420) at /home/dbaron/builds/ssd/mozilla-central/mozilla/ipc/chromium/src/base/message_loop.cc:202 #36 MessageLoop::Run (this=0x6c8420) at /home/dbaron/builds/ssd/mozilla-central/mozilla/ipc/chromium/src/base/message_loop.cc:176 #37 0x00007ffff5ee1bc0 in nsBaseAppShell::Run (this=0x7fffe00138f0) at /home/dbaron/builds/ssd/mozilla-central/mozilla/widget/src/xpwidgets/nsBaseAppShell.cpp:192 #38 0x00007ffff5baa43a in nsAppStartup::Run (this=0x74f760) at /home/dbaron/builds/ssd/mozilla-central/mozilla/toolkit/components/startup/nsAppStartup.cpp:218 #39 0x00007ffff484e341 in XRE_main (argc=<value optimized out>, argv=<value optimized out>, aAppData=<value optimized out>) at /home/dbaron/builds/ssd/mozilla-central/mozilla/toolkit/xre/nsAppRunner.cpp:3768 #40 0x0000000000400f6c in main (argc=4, argv=0x7fffffffde68) at /home/dbaron/builds/ssd/mozilla-central/mozilla/browser/app/nsBrowserApp.cpp:158
http://twpol.dyndns.org/mozilla/misc/nserror?0x80520012 says NS_ERROR_FILE_NOT_FOUND. And yes, trying to Open() a file stream on a nonexistent file doesn't seem like something we should be warning about. Alon, want to fix?
Assignee: nobody → azakai
When I looked at backtraces for them, I saw most of the errors coming from trying to open ~/.mailcap, I believe, which doesn't exist.
Yes, that would match the stack in comment 0.
Attached patch patchSplinter Review
Here's a patch. Sorry about this happening in the first place.
Attachment #522416 - Flags: review?(bzbarsky)
Comment on attachment 522416 [details] [diff] [review] patch You need this for all the DoPendingOpen callers too, no?
Well, in something like this NS_IMETHODIMP nsFileInputStream::Read(char* aBuf, PRUint32 aCount, PRUint32* aResult) { nsresult rv = DoPendingOpen(); NS_ENSURE_SUCCESS(rv, rv); I thought we do want to get warnings about failures here, since our code that calls Read() etc. doesn't assume failure of this sort is acceptable - it wasn't acceptable before DEFER_OPEN. Do we want to change that?
Did Open() use to warn before if the file wasn't there?
This is how I see things: * Before DEFER_OPEN, Init() called Open(), and failure was acceptable (the file isn't there, for example), so no warning. But failure in a later call to Read() etc. is less unacceptable. * After DEFER_OPEN, Init() does not call Open() necessarily. If it doesn't, then an acceptable failure due to the file not existing will happen when Read() etc. is called. However, in our code when we call Read(), we don't expect acceptable errors, so it seems safer to warn in that case. Maybe I am making too much of the distinction here though. Should I just remove the warnings in the calls to DoPendingOpen?
Hmm. I guess that the startup stuff doesn't use DEFER_OPEN, so it wouldn't care what you did with Read. OK, let's go with the patch in this bug for now.
Attachment #522416 - Flags: review?(bzbarsky) → review+
Keywords: checkin-needed
Flags: in-testsuite-
Whiteboard: [console-spew] → [console-spew][fixed-in-cedar]
Keywords: checkin-needed
This was merged into m-c back a while ago. http://hg.mozilla.org/mozilla-central/rev/3e931d76b8aa
Status: NEW → RESOLVED
Closed: 14 years ago
Resolution: --- → FIXED
Whiteboard: [console-spew][fixed-in-cedar] → [console-spew]
Target Milestone: --- → mozilla2.2
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: