Closed Bug 130954 Opened 22 years ago Closed 22 years ago

crash [@nsComponentManagerImpl::FreeServices] (this=0x0)

Categories

(Core :: XPCOM, defect)

x86
FreeBSD
defect
Not set
critical

Tracking

()

RESOLVED FIXED

People

(Reporter: timeless, Assigned: dougt)

Details

(Keywords: crash)

Crash Data

Attachments

(2 files, 2 obsolete files)

afaik nothing checks to verify that there is a gComponentManager.

[yes i know, at this point i'm already quite dead, but i don't need a core file telling me this]

console output:
###!!! ASSERTION: NS_InitXPCOM failed: 'NS_SUCCEEDED(rv)', file /home/timeless/mozilla/xpfe/bootstrap/nsAppRunner.cpp, line 1681
###!!! Break: at file /home/timeless/mozilla/xpfe/bootstrap/nsAppRunner.cpp, line 1681
###!!! ASSERTION: Setting main thread twice?: 'Error', file /home/timeless/mozilla/xpcom/threads/nsThread.cpp, line 401
###!!! Break: at file /home/timeless/mozilla/xpcom/threads/nsThread.cpp, line 401
###!!! ASSERTION: Setting main thread twice?: 'Error', file /home/timeless/mozilla/xpcom/threads/nsThread.cpp, line 401
###!!! Break: at file /home/timeless/mozilla/xpcom/threads/nsThread.cpp, line 401
###!!! ASSERTION: Setting main thread twice?: 'Error', file /home/timeless/mozilla/xpcom/threads/nsThread.cpp, line 401
###!!! Break: at file /home/timeless/mozilla/xpcom/threads/nsThread.cpp, line 401
###!!! ASSERTION: Setting main thread twice?: 'Error', file /home/timeless/mozilla/xpcom/threads/nsThread.cpp, line 401
###!!! Break: at file /home/timeless/mozilla/xpcom/threads/nsThread.cpp, line 401
###!!! ASSERTION: Setting main thread twice?: 'Error', file /home/timeless/mozilla/xpcom/threads/nsThread.cpp, line 401
###!!! Break: at file /home/timeless/mozilla/xpcom/threads/nsThread.cpp, line 401
###!!! ASSERTION: Setting main thread twice?: 'Error', file /home/timeless/mozilla/xpcom/threads/nsThread.cpp, line 401
###!!! Break: at file /home/timeless/mozilla/xpcom/threads/nsThread.cpp, line 401
###!!! ASSERTION: Setting main thread twice?: 'Error', file /home/timeless/mozilla/xpcom/threads/nsThread.cpp, line 401
###!!! Break: at file /home/timeless/mozilla/xpcom/threads/nsThread.cpp, line 401
###!!! ASSERTION: Setting main thread twice?: 'Error', file /home/timeless/mozilla/xpcom/threads/nsThread.cpp, line 401
###!!! Break: at file /home/timeless/mozilla/xpcom/threads/nsThread.cpp, line 401
###!!! ASSERTION: Setting main thread twice?: 'Error', file /home/timeless/mozilla/xpcom/threads/nsThread.cpp, line 401
###!!! Break: at file /home/timeless/mozilla/xpcom/threads/nsThread.cpp, line 401
Segmentation fault - core dumped
./run-mozilla.sh -g -d gdb51 ./mozilla-bin /root/coredumps/mozilla-bin.3087.core

#0  nsComponentManagerImpl::FreeServices (this=0x0) at /home/timeless/mozilla/xpcom/components/nsComponentManager.cpp:1918
#1  0x28268551 in NS_ShutdownXPCOM (servMgr=0x0) at /home/timeless/mozilla/xpcom/build/nsXPComInit.cpp:548
#2  0x0805cdaa in main (argc=1, argv=0xbfbff844) at /home/timeless/mozilla/xpfe/bootstrap/nsAppRunner.cpp:1706
#3  0x080569c5 in _start ()

#1  0x28268551 in NS_ShutdownXPCOM (servMgr=0x0) at /home/timeless/mozilla/xpcom/build/nsXPComInit.cpp:548
548         nsComponentManagerImpl::gComponentManager->FreeServices();
(gdb) l
543         // We may have AddRef'd for the caller of NS_InitXPCOM, so release it
544         // here again:
545         NS_IF_RELEASE(servMgr);
546
547         // Shutdown global servicemanager
548         nsComponentManagerImpl::gComponentManager->FreeServices();
Should we really be calling NS_ShutdownXPCOM if NS_InitXPCOM failed?
Keywords: crash
dbradley suggests that NS_InitXPCOM2 should clean up after itself and that we shouldn't call NS_ShutdownXPCOM
> dbradley suggests that NS_InitXPCOM2 should clean up after itself and that we
shouldn't call NS_ShutdownXPCOM

I would agree with that as a matter of principal. 
what conrad said.  
Ping->NEW  Is this still an issue?  This patch has not been checked in... is it
still valid?
Status: UNCONFIRMED → NEW
Ever confirmed: true
Attachment #74112 - Flags: review+
Comment on attachment 74112 [details] [diff] [review]
gracefully quit when there's no component manager

r=dougt.  this doesn't hurt anything.
Attached patch Fixes the problem at the source (obsolete) — Splinter Review
Comment on attachment 98075 [details] [diff] [review]
Fixes the problem at the source

>-  rv = NS_ShutdownXPCOM( NULL );
>+  if (NS_SUCCEEDED(rv)) 
>+    rv = NS_ShutdownXPCOM( NULL );
>   NS_ASSERTION(NS_SUCCEEDED(rv), "NS_ShutdownXPCOM failed");
this assertion is associated w/ the shutdown call. move it into a block {} for
r=timeless.
Attachment #98075 - Flags: review+
Attachment #98075 - Flags: needs-work+
Attachment #98075 - Attachment is obsolete: true
Comment on attachment 98515 [details] [diff] [review]
Fixes the problem at the source v.2

>@@ -1860,7 +1860,8 @@
>   // always exit in that case.
>   remoterv = HandleRemoteArguments(argc, argv, &argused);
>   if (argused) {
>-    NS_ShutdownXPCOM(NULL);
>+    if (NS_SUCCEEDED(rv)) // only call NS_ShutdownXPCOM if Init succeeded.
>+      NS_ShutdownXPCOM(NULL);
>     return remoterv;
>   }
> #endif
>@@ -1873,8 +1874,10 @@
>     NS_ASSERTION(NS_SUCCEEDED(rv), "DoOnShutdown failed");
>   }
> 
>-  rv = NS_ShutdownXPCOM( NULL );
>-  NS_ASSERTION(NS_SUCCEEDED(rv), "NS_ShutdownXPCOM failed");
>+  if (NS_SUCCEEDED(rv)) { // only call NS_ShutdownXPCOM if Init succeeded.
>+      rv = NS_ShutdownXPCOM( NULL );

How about fixing the bogo-spaces inside the parens?  The rest of the patch's
calls, if not all calls in the rest of this source file, don't use this style.

/be

>+      NS_ASSERTION(NS_SUCCEEDED(rv), "NS_ShutdownXPCOM failed");
>+  }
> 
>   return TranslateReturnValue(mainResult);
> }
Fixes brendan's nits.
"For the love of briano" NULL -> nsnull
Attachment #98515 - Attachment is obsolete: true
Comment on attachment 98519 [details] [diff] [review]
 Fixes the problem at the source v.2

sr=brendan@mozilla.org, thanks for cleaning this up.  Who should r=?

/be
Attachment #98519 - Flags: superreview+
The file blames to just about everyone.  I randomly picked alec to review this.
 Could you also look at timeless patch (74112)
adding alecf to the cc list so that he can see the review request...
Comment on attachment 98519 [details] [diff] [review]
 Fixes the problem at the source v.2

sr=alecf
Attachment #98519 - Flags: review+
Checking in nsAppRunner.cpp;
/cvsroot/mozilla/xpfe/bootstrap/nsAppRunner.cpp,v  <--  nsAppRunner.cpp
new revision: 1.372; previous revision: 1.371
done


Also checked in null check:

Checking in nsXPComInit.cpp;
/cvsroot/mozilla/xpcom/build/nsXPComInit.cpp,v  <--  nsXPComInit.cpp
new revision: 1.156; previous revision: 1.155
done
Status: NEW → RESOLVED
Closed: 22 years ago
Resolution: --- → FIXED
Crash Signature: [@nsComponentManagerImpl::FreeServices]
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Creator:
Created:
Updated:
Size: