Closed Bug 102492 Opened 23 years ago Closed 18 years ago

TestXPTCInvoke segfaults under solaris when build with gcc 3.0.1

Categories

(SeaMonkey :: Build Config, defect)

Sun
Solaris
defect
Not set
normal

Tracking

(Not tracked)

RESOLVED WORKSFORME

People

(Reporter: internationils, Unassigned)

References

Details

/sup/opt/mozilla-0.9.4/bin > ./run-mozilla.sh ./TestXPTCInvoke MOZILLA_FIVE_HOME=. LD_LIBRARY_PATH=.:./plugins:/usr/openwin/lib:/usr/lib:/lib:/usr/ucblib:/sup/li b:/usr/openwin/lib:/usr/lib:/lib:/usr/ucblib:/sup/lib LIBRARY_PATH=.:./components SHLIB_PATH=. LIBPATH=. ADDON_PATH=. MOZ_PROGRAM=./TestXPTCInvoke MOZ_TOOLKIT= moz_debug=0 moz_debugger= Segmentation Fault - core dumped Oh no! ./TestXPTCInvoke just dumped a core file. Do you want to debug this ? You need a lot of memory for this, so watch out ? [y/n] n
/sup/build/mozilla/debugbuild-solaris/dist/bin > gdb TestXPTCInvoke core GNU gdb 5.0 Copyright 2000 Free Software Foundation, Inc. GDB is free software, covered by the GNU General Public License, and you are welcome to change it and/or distribute copies of it under certain conditions. Type "show copying" to see the conditions. There is absolutely no warranty for GDB. Type "show warranty" for details. This GDB was configured as "sparc-sun-solaris2.7"... Core was generated by `./TestXPTCInvoke'. Program terminated with signal 9, Killed. Reading symbols from /sup/build/mozilla/debugbuild-solaris/dist/bin/./libxpcom.so...done. Loaded symbols for /sup/build/mozilla/debugbuild-solaris/dist/bin/./libxpcom.so Reading symbols from /sup/build/mozilla/debugbuild-solaris/dist/bin/./libplds4.so...done. Loaded symbols for /sup/build/mozilla/debugbuild-solaris/dist/bin/./libplds4.so Reading symbols from /sup/build/mozilla/debugbuild-solaris/dist/bin/./libplc4.so...done. Loaded symbols for /sup/build/mozilla/debugbuild-solaris/dist/bin/./libplc4.so Reading symbols from /sup/build/mozilla/debugbuild-solaris/dist/bin/./libnspr4.so...done. Loaded symbols for /sup/build/mozilla/debugbuild-solaris/dist/bin/./libnspr4.so Reading symbols from /usr/lib/librt.so.1...done. Loaded symbols for /usr/lib/librt.so.1 Reading symbols from /usr/lib/libsocket.so.1...done. Loaded symbols for /usr/lib/libsocket.so.1 Reading symbols from /usr/lib/libdl.so.1...done. Loaded symbols for /usr/lib/libdl.so.1 Reading symbols from /sup/lib/libstdc++.so.3...done. Loaded symbols for /sup/lib/libstdc++.so.3 Reading symbols from /usr/lib/libm.so.1...done. Loaded symbols for /usr/lib/libm.so.1 Reading symbols from /sup/lib/libgcc_s.so.1...done. Loaded symbols for /sup/lib/libgcc_s.so.1 Reading symbols from /usr/lib/libpthread.so.1...done. Loaded symbols for /usr/lib/libpthread.so.1 Reading symbols from /usr/lib/libc.so.1...done. Loaded symbols for /usr/lib/libc.so.1 Reading symbols from /usr/lib/libthread.so.1...done. Loaded symbols for /usr/lib/libthread.so.1 Reading symbols from /usr/lib/libnsl.so.1...done. Loaded symbols for /usr/lib/libnsl.so.1 Reading symbols from /usr/lib/libaio.so.1...done. Loaded symbols for /usr/lib/libaio.so.1 Reading symbols from /usr/lib/libmp.so.2...done. Loaded symbols for /usr/lib/libmp.so.2 Reading symbols from /usr/platform/SUNW,Ultra-5_10/lib/libc_psr.so.1...done. Loaded symbols for /usr/platform/SUNW,Ultra-5_10/lib/libc_psr.so.1 #0 0xfef8b9e8 in _lock_try_adaptive () from /usr/lib/libthread.so.1 (gdb) where #0 0xfef8b9e8 in _lock_try_adaptive () from /usr/lib/libthread.so.1 #1 0xfef7c704 in pthread_mutex_lock () from /usr/lib/libthread.so.1 #2 0xff10f534 in _MD_ATOMIC_INCREMENT (val=0xff152330) at ../../../../../nsprpub/pr/src/misc/pratom.c:166 #3 0xff10f924 in PR_AtomicIncrement (val=0xff152330) at ../../../../../nsprpub/pr/src/misc/pratom.c:301 #4 0xff10c8a0 in PR_NewThreadPrivateIndex (newIndex=0xff154e6c, dtor=0xff10c500 <_PR_RELEASE_LOCK_STACK>) at ../../../../../nsprpub/pr/src/threads/prtpd.c:137 #5 0xff10c398 in _PR_InitRWLocks () at ../../../../../nsprpub/pr/src/threads/prrwlock.c:396 #6 0xff117a3c in _PR_InitStuff () at ../../../../../nsprpub/pr/src/misc/prinit.c:239 #7 0xff117a68 in _PR_ImplicitInitialization () at ../../../../../nsprpub/pr/src/misc/prinit.c:252 #8 0xff129488 in PR_NewLock () at ../../../../../nsprpub/pr/src/pthreads/ptsynch.c:149 #9 0xff2a4f6c in _Z12InitTraceLogv () at ../../../xpcom/base/nsTraceRefcnt.cpp:829 #10 0xff2a6030 in _ZN13nsTraceRefcnt7LogCtorEPvPKcj (aPtr=0x25c5c, aType=0xff319f30 "nsHashtable", aInstanceSize=44) at ../../../xpcom/base/nsTraceRefcnt.cpp:1825 #11 0xff21b730 in _ZN11nsHashtableC2Eji (this=0x25c5c, aInitSize=16, threadSafe=0) at ../../../xpcom/ds/nsHashtable.cpp:232 #12 0xff2f2420 in _ZN19nsSupportsHashtableC1Eji (this=0x25c5c, aSize=16, threadSafe=0) at ../../dist/include/nsHashtable.h:166 #13 0xff29cec4 in _ZN16nsLoggingServiceC1Ev (this=0x25c50) at ../../../xpcom/base/nsLogging.cpp:60 #14 0xff29def8 in _Z20EnsureLoggingServicev () at ../../../xpcom/base/nsLogging.cpp:244 #15 0xff29e2e0 in _Z9NS_GetLogPKcj (name=0xff327ab8 "LogInfo", controlFlags=2) at ../../../xpcom/base/nsLogging.cpp:309 #16 0xff2a018c in _Z41__static_initialization_and_destruction_0ii (__initialize_p=1, __priority=65535) at ../../dist/include/nsBufferHandle.h:44 #17 0xff2a01c0 in _GLOBAL__I__ZN16nsLoggingServiceC2Ev () at ../../dist/include/nsBufferHandle.h:363 #18 0xff2ee764 in __do_global_ctors_aux () at ../../../string/obsolete/nsString2.cpp:1928 #19 0xff20c534 in _init () from /sup/build/mozilla/debugbuild-solaris/dist/bin/./libxpcom.so #20 0xff3b9f3c in ?? () #21 0xff3b9df4 in ?? () #22 0xff3c15c0 in ?? () #23 0xff3b2d44 in ?? () (gdb) quit /sup/build/mozilla/debugbuild-solaris/dist/bin > cat ../../mozbuild /sup/build/mozilla/mybuild > ../configure --enable-tests --enable-debug --disable-optimize --disable-xprint --without-gnu-ld --without-gnu-nm --without-gnu-as --with-as=//usr/ccs/bin/as --with-ld=/usr/ccs/bin/ld --with-nm=/usr/ccs/bin/nm --prefix=/sup /sup/build/mozilla/debugbuild-solaris/dist/bin > gcc --version 3.0.1 /sup/build/mozilla/debugbuild-solaris/dist/bin > uname -a SunOS topaze 5.7 Generic_106541-02 sun4u sparc /sup/build/mozilla/debugbuild-solaris/dist/bin >
THis bug is very repeatable. I have a core file available if someone is interested. Even with optimizsation and GNU linkers etc. the crash is exactly the same. I still have the tree built, so I can try things if anyone has any experimental patches etc. to fix the problem.
It needs some ASM fixes for the new ABI - see bug 71627 ->xpconnect, and confirming based on 71627.
Assignee: dougt → dbradley
Blocks: 71627
Status: UNCONFIRMED → NEW
Component: XPCOM → XPConnect
Ever confirmed: true
QA Contact: scc → pschwartau
John/David, is this yours?
Assignee: dbradley → dougt
I think TestXPTCInvoke would get farther than it did here if bug 71627 were the only problem.
From the stack trace I don't see anything related to XPT call other than the test name. It appears to have crashed in _lock_try_adaptive while trying to create a new lock, during creating the settings hash table while logging something. So unless something bad happened, stack not cleaned up, or something during a method call before this happened, I doubt it's an XPT call issue.
Target Milestone: --- → mozilla0.9.5
not enough time. 0.9.5 -> 0.9.6
Target Milestone: mozilla0.9.5 → mozilla0.9.6
Assignee: dougt → shaver
Mike, I am reassign this to you since you own bug 71627.
This looks like an NSPR issue, maybe -- wtc, can you take a look?
Assignee: shaver → wtc
Component: XPConnect → NSPR
Product: Browser → NSPR
Target Milestone: mozilla0.9.6 → ---
It is crashing in the Solaris pthread library. Could you do % ldd ./TestXPTCInvoke and paste the output here? Also, please paste the command line with which you linked TestXPTCInvoke. You can try building and running NSPR test programs to see if NSPR works. % cvs co mozilla/nsprpub % cd mozilla/nsprpub % ./configure % gmake % cd pr/tests % gmake # run a few tests % ./cvar -d % ./cvar2 % ./perf
Assignee: wtc → shaver
Component: NSPR → XPConnect
Product: NSPR → Browser
Target Milestone: --- → mozilla0.9.6
/sup/build/mozilla/debugbuild-solaris/dist/bin > ldd ./TestXPTCInvoke libxpcom.so => (file not found) libplds4.so => (file not found) libplc4.so => (file not found) libnspr4.so => (file not found) librt.so.1 => /usr/lib/librt.so.1 libsocket.so.1 => /usr/lib/libsocket.so.1 libdl.so.1 => /usr/lib/libdl.so.1 libstdc++.so.3 => /sup/lib/libstdc++.so.3 libm.so.1 => /usr/lib/libm.so.1 libgcc_s.so.1 => /sup/lib/libgcc_s.so.1 libpthread.so.1 => /usr/lib/libpthread.so.1 libc.so.1 => /usr/lib/libc.so.1 libaio.so.1 => /usr/lib/libaio.so.1 libnsl.so.1 => /usr/lib/libnsl.so.1 libmp.so.2 => /usr/lib/libmp.so.2 libthread.so.1 => /usr/lib/libthread.so.1 /sup/build/mozilla/debugbuild-solaris/dist/bin >
Here's the linking info that you wanted. I can't provide more info as I'm moving and need to clean out my accounts, and don't have time to do the CVS steps you requested. Sorry... /sup/build/mozilla/debugbuild-solaris/xpcom > rm reflect/xptcall/tests/TestXPTCI nvoke /sup/build/mozilla/debugbuild-solaris/xpcom > make make[1]: Entering directory `/sup/build/mozilla/debugbuild-solaris/xpcom/typelib' ....... make[1]: Entering directory `/sup/build/mozilla/debugbuild-solaris/xpcom/reflect/xptcall/tests' c++ -I/usr/openwin/include -fno-rtti -fno-exceptions -pedantic -Wno-long-long -pipe -fshort-wchar -pthreads -DDEBUG -DDEBUG_lohner -DTRACING -g -o TestXPTCInvoke TestXPTCInvoke.o -L../../../../dist/bin -L../../../../dist/lib -L../../../../dist/bin -lxpcom -liberty -L/sup/build/mozilla/debugbuild-solaris/dist/lib -lplds4 -lplc4 -lnspr4 -lposix4 -lsocket -ldl -lm true TestXPTCInvoke ../../../../config/nsinstall -R -m 755 TestXPTCInvoke ../../../../dist/bin make[1]: Leaving directory `/sup/build/mozilla/debugbuild-solaris/xpcom/reflect/xptcall/tests'
Based on the information provided by Nils Lohner, I believe this is a build config problem. The test program TestXPTCInvoke is linked with libc.so.1 before libthread.so.1. This linking order is problematic and is caused by not using the -pthread flag of c++. You can achieve the equivalent effect by using the -D_REENTRANT compiler flag and the -lpthread -lthread linker flags, but I recommend using the -pthread flag of gcc and c++ for both compiling and linking. (You would use the -mt flag with the Solaris WorkShop or Forte 6 compilers.) cls, is this your area or should this bug stay in XPConnect?
Sorry, I noticed that we are using the -pthreads flag. My mistake. I don't know why the -pthreads flag of c++ doesn't do the right thing. In any case, you can fix the problem by linking with -lpthread -lthread before any system libraries, that is, replacing -lposix4 -lsocket -ldl -lm by -lpthread -lthread -lposix4 -lsocket -ldl -lm
Comparing the library linking orders of 'c++ -pthreads' and 'CC -mt', I see the difference in the order between libc.so.1 and libthread.so.1. Note that although 'c++ -pthreads' links with libpthread.so.1 before libc.so.1, I've found that to be insufficient, and in fact, it is the order between libc.so.1 and libthread.so.1 that matters. Here is the output of my experiments. (The contents of the test program foo.cpp is not important, except that it shows that both 'c++ -pthreads' and 'CC -mt' define the _REENTRANT macro.) bonn:/u/wtc/tmp 53% c++ -v Reading specs from /builds/local/lib/gcc-lib/sparc-sun-solaris2.6/2.95.2/specs gcc version 2.95.2 19991024 (release) bonn:/u/wtc/tmp 54% c++ -pthreads foo.cpp bonn:/u/wtc/tmp 55% ./a.out Hello world! _REENTRANT bonn:/u/wtc/tmp 56% ldd ./a.out libm.so.1 => /usr/lib/libm.so.1 libpthread.so.1 => /usr/lib/libpthread.so.1 libc.so.1 => /usr/lib/libc.so.1 libdl.so.1 => /usr/lib/libdl.so.1 libthread.so.1 => /usr/lib/libthread.so.1 /usr/platform/SUNW,Ultra-5_10/lib/libc_psr.so.1 bonn:/u/wtc/tmp 57% CC -V CC: Sun WorkShop 6 update 1 C++ 5.2 Patch 109508-03 2001/04/07 bonn:/u/wtc/tmp 58% CC -mt foo.cpp bonn:/u/wtc/tmp 59% ./a.out Hello world! _REENTRANT bonn:/u/wtc/tmp 60% ldd ./a.out libCrun.so.1 => /usr/lib/libCrun.so.1 libm.so.1 => /opt/SUNWspro/lib/libm.so.1 libw.so.1 => /usr/lib/libw.so.1 libthread.so.1 => /usr/lib/libthread.so.1 libc.so.1 => /usr/lib/libc.so.1 libdl.so.1 => /usr/lib/libdl.so.1 /usr/platform/SUNW,Ultra-5_10/lib/libc_psr.so.1
I'm going to throw this over to cls for build-flag fixage, I think. But it's _so_ not a blocker.
Assignee: shaver → cls
Severity: blocker → normal
Target Milestone: mozilla0.9.6 → ---
*** Bug 133684 has been marked as a duplicate of this bug. ***
*** Bug 149461 has been marked as a duplicate of this bug. ***
Target Milestone: --- → Future
Mass reassign to default build config owner
Assignee: cls → mozbugs-build
- Mozilla compiles fine with all variants of gcc-3.x on my Solaris 8 sparc box as long as you don't use GNU binutils (as, ld...) as documented at ftp://depot.mcom.com/pub/pioch/mozilla-1.4a/ README Read also ftp://depot.mcom.com/pub/pioch/mozilla-1.3/ README (my build is an UltraSparc, albeit 32-bit, sparc executable)
Mass reassign of Build/Config bugs to Leaf.
Assignee: mozbugs-build → leaf
Component: XPConnect → Build Config
Target Milestone: Future → ---
setting default QA -
QA Contact: PhilSchwartau → general
Assignee: leaf → cmp
Product: Browser → Seamonkey
Mass reassign of open bugs for chase@mozilla.org to build@mozilla-org.bugs.
Assignee: chase → build
Mass re-assign of bugs that aren't on the build team radar, so bugs assigned to build@mozilla-org.bugs reflects reality. If there is a bug you really think we need to be looking at, please *email* build@mozilla.org with a bug number and explanation.
Assignee: build → nobody
Status: NEW → RESOLVED
Closed: 18 years ago
Resolution: --- → WORKSFORME
You need to log in before you can comment on or make changes to this bug.