Closed Bug 64278 Opened 24 years ago Closed 24 years ago

ptthread.c assertion failure on startup

Categories

(NSPR :: NSPR, defect, P1)

4.0.2
x86
FreeBSD
defect

Tracking

(Not tracked)

RESOLVED FIXED

People

(Reporter: marauder, Assigned: wtc)

Details

(Keywords: crash)

Attachments

(1 file)

Receive the following messages on startup:
Assertion failure: 0 == rv, at ptthread.c:321
Abort trap - core dumped

Up until yesterday or so, putting ac_add_options --with-pthreads into .mozconfig
made the message go away, but now it seems to be back. (Building from CVS.)

Possibly relevant output from ./configure:
checking for pthread_attr_init in -lpthread... no
checking for pthread_attr_init in -lc_r... yes
checking whether gcc accepts -pthread... yes
checking for PR_GetCurrentThread in -lnspr4... no
checking for PR_GetCurrentThread in -lnspr4 with thread lib... no
checking for PL_CreateOptState in -lplc4... no
checking for PL_NewHashTable in -lplds4... no


FreeBSD bianca.marauder.tm 4.2-RELEASE FreeBSD 4.2-RELEASE #1: Mon Jan  1
21:09:22 EST 2001     root@bianca.marauder.tm:/usr/src/sys/compile/BIANCA  i386
Do you have a stack trace for the assertion?  Also, are there any other messages
displayed first?
Keywords: crash
all debug messages:

!548 marauder@bianca:/usr/home/marauder/srcmozilla/mozilla/dist/bin$ ./mozilla
./run-mozilla.sh ./mozilla-bin
MOZILLA_FIVE_HOME=.
  LD_LIBRARY_PATH=.
     LIBRARY_PATH=.:./components
       SHLIB_PATH=.
          LIBPATH=.
       ADDON_PATH=.
      MOZ_PROGRAM=./mozilla-bin
      MOZ_TOOLKIT=
        moz_debug=0
     moz_debugger=
Type Manifest File:
/usr/home/marauder/srcmozilla/mozilla/dist/bin/components/xpti.dat
nsNativeComponentLoader: autoregistering begins.
nsNativeComponentLoader: autoregistering succeeded
nNCL: registering deferred (0)
Assertion failure: 0 == rv, at ptthread.c:321
Abort trap - core dumped



backtrace from the corefile:

#0  0x283de320 in kill () from /usr/lib/libc_r.so.4
#1  0x284286a6 in abort () from /usr/lib/libc_r.so.4
#2  0x2830a22a in PR_Assert (s=0x28338caf "0 == rv", file=0x28338ca4
"ptthread.c", ln=321) at prlog.c:477
#3  0x2832c4fb in _PR_CreateThread (type=PR_USER_THREAD, start=0x281a48b4
<nsThread::Main(void *)>, arg=0x8148820, priority=PR_PRIORITY_NORMAL, 
    scope=PR_GLOBAL_THREAD, state=PR_JOINABLE_THREAD, stackSize=0, isGCAble=0)
at ptthread.c:321
#4  0x2832c9fe in PR_CreateThread (type=PR_USER_THREAD, start=0x281a48b4
<nsThread::Main(void *)>, arg=0x8148820, priority=PR_PRIORITY_NORMAL,
scope=PR_GLOBAL_THREAD, 
    state=PR_JOINABLE_THREAD, stackSize=0) at ptthread.c:506
#5  0x281a515f in nsThread::Init (this=0x8148820, runnable=0x8168644,
stackSize=0, priority=PR_PRIORITY_NORMAL, scope=PR_GLOBAL_THREAD,
state=PR_JOINABLE_THREAD)
    at nsThread.cpp:242
#6  0x281a52fd in NS_NewThread (result=0x8168658, runnable=0x8168644,
stackSize=0, state=PR_JOINABLE_THREAD, priority=PR_PRIORITY_NORMAL,
scope=PR_GLOBAL_THREAD)
    at nsThread.cpp:285
#7  0x28d826d1 in nsSocketTransportService::Init (this=0x8168640) at
nsSocketTransportService.cpp:163
#8  0x28d824ed in nsSocketTransportService::Create (aOuter=0x0,
aIID=@0x28e44f04, aResult=0xbfbfdb90) at nsSocketTransportService.cpp:100
#9  0x28192010 in nsGenericFactory::CreateInstance (this=0x8156f40, aOuter=0x0,
aIID=@0x28e44f04, aResult=0xbfbfdb90) at nsGenericFactory.cpp:47
#10 0x2818e94b in nsComponentManagerImpl::CreateInstance (this=0x8081980,
aClass=@0x28e45968, aDelegate=0x0, aIID=@0x28e44f04, aResult=0xbfbfdb90)
    at nsComponentManager.cpp:1201
#11 0x2819a731 in nsComponentManager::CreateInstance (aClass=@0x28e45968,
aDelegate=0x0, aIID=@0x28e44f04, aResult=0xbfbfdb90) at nsRepository.cpp:81
#12 0x2819bbbe in nsServiceManagerImpl::GetService (this=0x806e300,
aClass=@0x28e45968, aIID=@0x28e44f04, result=0x81685d0, shutdownListener=0x0)
    at nsServiceManager.cpp:344
#13 0x2819c48d in nsServiceManager::GetService (aClass=@0x28e45968,
aIID=@0x28e44f04, result=0x81685d0, shutdownListener=0x0) at
nsServiceManager.cpp:559
#14 0x28d7a8da in nsIOService::Init (this=0x81685c0) at nsIOService.cpp:61
#15 0x28d7b0a6 in nsIOService::Create (aOuter=0x0, aIID=@0x8067988,
aResult=0xbfbfde90) at nsIOService.cpp:121
#16 0x28192010 in nsGenericFactory::CreateInstance (this=0x8156f00, aOuter=0x0,
aIID=@0x8067988, aResult=0xbfbfde90) at nsGenericFactory.cpp:47
#17 0x2818e94b in nsComponentManagerImpl::CreateInstance (this=0x8081980,
aClass=@0x287a11b0, aDelegate=0x0, aIID=@0x8067988, aResult=0xbfbfde90)
    at nsComponentManager.cpp:1201
#18 0x2819a731 in nsComponentManager::CreateInstance (aClass=@0x287a11b0,
aDelegate=0x0, aIID=@0x8067988, aResult=0xbfbfde90) at nsRepository.cpp:81
#19 0x2819bbbe in nsServiceManagerImpl::GetService (this=0x806e300,
aClass=@0x287a11b0, aIID=@0x8067988, result=0x287a4d84, shutdownListener=0x0)
    at nsServiceManager.cpp:344
#20 0x2819c48d in nsServiceManager::GetService (aClass=@0x287a11b0,
aIID=@0x8067988, result=0x287a4d84, shutdownListener=0x0) at
nsServiceManager.cpp:559
#21 0x287899f8 in nsURLProperties::nsURLProperties (this=0x814c950,
aUrl=@0xbfbfe098) at nsURLProperties.cpp:45
#22 0x28792312 in nsUNIXCharset::nsUNIXCharset (this=0x8168540) at
nsUNIXCharset.cpp:71
#23 0x28792afe in NS_NewPlatformCharset (aOuter=0x0, aIID=@0x28202a58,
aResult=0xbfbfe2a0) at nsUNIXCharset.cpp:171
#24 0x28192010 in nsGenericFactory::CreateInstance (this=0x81561a0, aOuter=0x0,
aIID=@0x28202a58, aResult=0xbfbfe2a0) at nsGenericFactory.cpp:47
#25 0x2818e94b in nsComponentManagerImpl::CreateInstance (this=0x8081980,
aClass=@0xbfbfe324, aDelegate=0x0, aIID=@0x28202a58, aResult=0xbfbfe2a0)
    at nsComponentManager.cpp:1201
#26 0x2819a731 in nsComponentManager::CreateInstance (aClass=@0xbfbfe324,
aDelegate=0x0, aIID=@0x28202a58, aResult=0xbfbfe2a0) at nsRepository.cpp:81
#27 0x2819bbbe in nsServiceManagerImpl::GetService (this=0x806e300,
aClass=@0xbfbfe324, aIID=@0x28202a58, result=0xbfbfe400, shutdownListener=0x0)
    at nsServiceManager.cpp:344
#28 0x2819c206 in nsServiceManagerImpl::GetService (this=0x806e300,
aContractID=0x28202bc0 "@mozilla.org/intl/platformcharset;1", aIID=@0x28202a58,
result=0xbfbfe400, 
    shutdownListener=0x0) at nsServiceManager.cpp:491
#29 0x2819c67d in nsServiceManager::GetService (aContractID=0x28202bc0
"@mozilla.org/intl/platformcharset;1", aIID=@0x28202a58, result=0xbfbfe400, 
    shutdownListener=0x0) at nsServiceManager.cpp:604
#30 0x2819af9b in nsGetServiceByContractID::operator() (this=0xbfbfe46c,
aIID=@0x28202a58, aInstancePtr=0xbfbfe400) at nsServiceManager.cpp:64
#31 0x281e0d9f in nsCOMPtr<nsIPlatformCharset>::assign_from_helper
(this=0xbfbfe47c, helper=@0xbfbfe46c, aIID=@0x28202a58) at
../../dist/include/nsCOMPtr.h:958
#32 0x281e0f9f in nsCOMPtr<nsIPlatformCharset>::nsCOMPtr (this=0xbfbfe47c,
helper=@0xbfbfe46c) at ../../dist/include/nsCOMPtr.h:551
#33 0x281733fa in nsFSStringConversion::PrepareFSCharset () at
nsLocalFileCommon.cpp:132
#34 0x28173557 in nsFSStringConversion::PrepareEncoder () at
nsLocalFileCommon.cpp:157
#35 0x28173899 in nsFSStringConversion::UCSToNewFS (aIn=0x81b9780,
aOut=0xbfbfe520) at nsLocalFileCommon.cpp:200
#36 0x28174097 in NS_NewUnicodeLocalFile (path=0x81b9780, followLinks=1,
result=0xbfbfeb7c) at nsLocalFileCommon.cpp:319
#37 0x28cf28ed in ProfileStruct::InternalizeLocation (this=0x8086900,
aRegistry=0x8156e20, profKey=529, is4x=0, isOld50=0) at nsProfileAccess.cpp:1556
#38 0x28ced862 in nsProfileAccess::FillProfileInfo (this=0x81b9300,
regName=0x81b9400) at nsProfileAccess.cpp:516
#39 0x28ceb734 in nsProfileAccess::nsProfileAccess (this=0x81b9300) at
nsProfileAccess.cpp:173
#40 0x28cdf379 in nsProfile::nsProfile (this=0x8120e40) at nsProfile.cpp:245
#41 0x28ceb2da in nsProfileConstructor (aOuter=0x0, aIID=@0x80680b4,
aResult=0xbfbff1a0) at nsProfileFactory.cpp:27
#42 0x28192010 in nsGenericFactory::CreateInstance (this=0x8156c60, aOuter=0x0,
aIID=@0x80680b4, aResult=0xbfbff1a0) at nsGenericFactory.cpp:47
#43 0x2818e94b in nsComponentManagerImpl::CreateInstance (this=0x8081980,
aClass=@0x80690b0, aDelegate=0x0, aIID=@0x80680b4, aResult=0xbfbff1a0)
    at nsComponentManager.cpp:1201
#44 0x2819a731 in nsComponentManager::CreateInstance (aClass=@0x80690b0,
aDelegate=0x0, aIID=@0x80680b4, aResult=0xbfbff1a0) at nsRepository.cpp:81
#45 0x2819bbbe in nsServiceManagerImpl::GetService (this=0x806e300,
aClass=@0x80690b0, aIID=@0x80680b4, result=0xbfbff2a0, shutdownListener=0x0)
    at nsServiceManager.cpp:344
#46 0x2819c48d in nsServiceManager::GetService (aClass=@0x80690b0,
aIID=@0x80680b4, result=0xbfbff2a0, shutdownListener=0x0) at
nsServiceManager.cpp:559
#47 0x2819aec3 in nsGetServiceByCID::operator() (this=0xbfbff398,
aIID=@0x80680b4, aInstancePtr=0xbfbff2a0) at nsServiceManager.cpp:44
#48 0x805ff47 in nsCOMPtr<nsIProfileInternal>::assign_from_helper
(this=0xbfbff3b8, helper=@0xbfbff398, aIID=@0x80680b4) at
../../dist/include/nsCOMPtr.h:958
#49 0x8062e8f in nsCOMPtr<nsIProfileInternal>::nsCOMPtr (this=0xbfbff3b8,
helper=@0xbfbff398) at ../../dist/include/nsCOMPtr.h:551
#50 0x8055854 in InitializeProfileService (cmdLineArgs=0x80ac1c0) at
nsAppRunner.cpp:811
#51 0x80565d2 in main1 (argc=1, argv=0xbfbff668, nativeApp=0x0) at
nsAppRunner.cpp:984
#52 0x80575fd in main (argc=1, argv=0xbfbff668) at nsAppRunner.cpp:1287

I've been getting this on my FreeBSD 4.2-STABLE as well and the problem is
that they made some changes a little before 4.2-RELASE where they changed
the max priority that an app can set for a pthread to 31 and mozilla is
trying to set it to 42.

Unfortunately, on FreeBSD the stupid define that sets this number
(PTHREAD_MAX_PRIORITY) is in a private header file that doesn't get installed.
This means you get an ugly version number check.

Here's a patch against the mozilla repository on 1/10/2001

Index: nsprpub/pr/include/md/_pth.h
===================================================================
RCS file: /cvsroot/mozilla/nsprpub/pr/include/md/_pth.h,v
retrieving revision 3.15.46.1
diff -u -r3.15.46.1 _pth.h
--- nsprpub/pr/include/md/_pth.h        2000/04/04 00:25:43     3.15.46.1
+++ nsprpub/pr/include/md/_pth.h        2001/01/11 04:21:01
@@ -206,7 +206,11 @@
 #elif defined(FREEBSD) || defined(NETBSD) || defined(OPENBSD) \
        || defined(BSDI) || defined(RHAPSODY) /* XXX */
 #define PT_PRIO_MIN            0
-#define PT_PRIO_MAX            126
+#  if __FreeBSD_cc_version >= 420000
+#    define PT_PRIO_MAX        31
+#  else /* __FreeBSD_cc_version >= 420000 */
+#    define PT_PRIO_MAX            126
+#  endif  /* __FreeBSD_cc_version >= 420000 */
 #else
 #error "pthreads is not supported for this architecture"
 #endif
Thanks Peter, that patch works a treat :-)
 #elif defined(NETBSD) || defined(OPENBSD) \
        || defined(BSDI) || defined(RHAPSODY) /* XXX */
 #define PT_PRIO_MIN            0
 #define PT_PRIO_MAX            126
 #elif defined(FREEBSD)
 #define PT_PRIO_MIN            0
 #if __FreeBSD_cc_version >= 420000
 #  define PT_PRIO_MAX        31
 #else /* __FreeBSD_cc_version >= 420000 */
 #  define PT_PRIO_MAX            126
 #endif  /* __FreeBSD_cc_version >= 420000 */
 #else
 #error "pthreads is not supported for this architecture"
 #endif
would someone please try this version?
Assignee: asa → wtc
Component: Browser-General → NSPR
Keywords: approval, patch, review
Product: Browser → NSPR
QA Contact: doronr → wtc
Peter's patch looks good to me.  Confirming to get on wtc's radar.
Severity: normal → critical
Status: UNCONFIRMED → NEW
Ever confirmed: true
I also asked the FreeBSD guys about this one and got this reply:

>As far as I read the POSIX spec, this is not exported.  I'll have a look
>at it again when I get the chance.
>
>That said, POSIX only guarantees priorities in the range 0-31 (which is
>what we now allow).  The exception is for SCHED_OTHER which can be
>implementation defined.  Either way you look at it, it seems that a
>properly coded threaded application ought to rely on priorities in
>the range 0-31 (for non-SCHED_OTHER), or should scope them out at
>run-time.
> - Daniel Eischen

It may make sense to change the pthread code to just use 0-31 for all the
platforms as that seems to be the standard.
wtc's patch works for me and is the right way to do it.
I checked in my patch (id=22334) on the tip and the
NSPRPUB_RELEASE_4_1_BRANCH.  Note that until this
fix is checked in on the NSPRPUB_CLIENT_BRANCH, the
Mozilla build won't pick it up by default.  However,
you can modify mozilla/client.mk to have it pull the
NSPRPUB_RELEASE_4_1_BRANCH of NSPR.
Status: NEW → ASSIGNED
Priority: -- → P2
Target Milestone: --- → 4.1.1
Priority: P2 → P1
I checked in the patch on the NSPRPUB_CLIENT_BRANCH.
Marked the bug fixed.
Status: ASSIGNED → RESOLVED
Closed: 24 years ago
Resolution: --- → FIXED
Version: other → 4.0.2
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Creator:
Created:
Updated:
Size: