Closed Bug 49575 Opened 25 years ago Closed 16 years ago

SegFault in nsFSStringConversion::UCSToNewFS on Startup

Categories

(Core :: XPCOM, defect, P3)

x86
OpenBSD
defect

Tracking

()

RESOLVED INCOMPLETE

People

(Reporter: zach, Unassigned)

Details

When running Mozilla under OpenBSD 2.7 (gcc version 2.95.2, after patching according to bug 44426), i get a segfault in nsFSStringConversion::UCSToNewFS. The output from running Mozilla in GDB with a backtrace is below: (gdb) file /usr/home/zach/mozilla/dist/bin/mozilla-bin (gdb) r nsNativeComponentLoader: autoregistering begins. nsNativeComponentLoader: autoregistering succeeded nNCL: registering deferred (0) ***** Chrome Registration: Installing package at resource:/chrome/packages/core/ ***** Chrome Registration: Installing locale at resource:/chrome/locales/en-US/ ***** Chrome Registration: Installing package at resource:/chrome/packages/widget-toolkit/ ProfileManager : CreateNewProfile Profile Name: default Profile Dir: /home/zach/.mozilla Program received signal SIGSEGV, Segmentation fault. 0x4013aa1b in nsFSStringConversion::UCSToNewFS (this=0x40281994, aIn=0x177d00, aOut=0xdfbfd290) at nsLocalFileCommon.cpp:201 (gdb) bt #0 0x4013aa1b in nsFSStringConversion::UCSToNewFS (this=0x40281994, aIn=0x177d00, aOut=0xdfbfd290) at nsLocalFileCommon.cpp:201 #1 0x4013b60a in nsFileSpec::operator= (this=0xdfbfd3c4, inNativePath=@0xdfbfd3d0) at nsLocalFileCommon.cpp:388 #2 0x415fbec6 in ?? () from /usr/home/zach/mozilla/dist/bin/components/libprofile.so.1.0 #3 0x41600181 in ?? () from /usr/home/zach/mozilla/dist/bin/components/libprofile.so.1.0 #4 0x415f886d in ?? () from /usr/home/zach/mozilla/dist/bin/components/libprofile.so.1.0 #5 0x415f849f in ?? () from /usr/home/zach/mozilla/dist/bin/components/libprofile.so.1.0 #6 0x5e81 in main1 (argc=1, argv=0xdfbfdaf8, nativeApp=0x0) at nsAppRunner.cpp:894 #7 0x7002 in main (argc=1, argv=0xdfbfdaf8) at nsAppRunner.cpp:1123 ---------------------------------------------------------------- After playing around with the code I found out that if i make changes as: Index: nsLocalFileCommon.cpp =================================================================== RCS file: /cvsroot/mozilla/xpcom/io/nsLocalFileCommon.cpp,v retrieving revision 1.13 diff -r1.13 nsLocalFileCommon.cpp 158c158 < res = PrepareFSCharset(); --- > res = nsFSStringConversion::PrepareFSCharset(); 201c201 < res = PrepareEncoder(); --- > res = nsFSStringConversion::PrepareEncoder(); ---------------------------------------------------- With the above changes, I now get: (gdb) r Starting program: /usr/home/zach/mozilla/dist/bin/mozilla-bin nsNativeComponentLoader: autoregistering begins. nsNativeComponentLoader: autoregistering succeeded nNCL: registering deferred (0) ProfileManager : CreateNewProfile Profile Name: default Profile Dir: /home/zach/.mozilla NS_NewConverterStream failed Program received signal SIGSEGV, Segmentation fault. 0x40111b65 in basic_nsAWritableString<unsigned short>::AssignFromReadable ( this=0x40281994, rhs=@0x129e4c) at nsAWritableString.h:462 462 do_AssignFromReadable(rhs); (gdb) bt #0 0x40111b65 in basic_nsAWritableString<unsigned short>::AssignFromReadable ( this=0x40281994, rhs=@0x129e4c) at nsAWritableString.h:462 #1 0x40114f89 in basic_nsAWritableString<unsigned short>::Assign ( this=0x40281994, aReadable=@0x129e4c) at nsAWritableString.h:314 #2 0x40114fb9 in nsString::operator= (this=0x40281994, aString=@0x129e4c) at nsString2.h:451 #3 0x410f55c7 in ?? () from /usr/home/zach/mozilla/dist/bin/components/libuconv.so.1.0 #4 0x4013a455 in nsFSStringConversion::PrepareFSCharset (this=0x40281994) at nsLocalFileCommon.cpp:144 #5 0x4013a5bb in nsFSStringConversion::PrepareEncoder (this=0x40281994) at nsLocalFileCommon.cpp:158 #6 0x4013a9f8 in nsFSStringConversion::UCSToNewFS (this=0x40281994, aIn=0x119c00, aOut=0xdfbfd314) at nsLocalFileCommon.cpp:201 #7 0x4013b5ca in nsFileSpec::operator= (this=0xdfbfd448, inNativePath=@0xdfbfd454) at nsLocalFileCommon.cpp:388 #8 0x41219ec6 in ?? () from /usr/home/zach/mozilla/dist/bin/components/libprofile.so.1.0 #9 0x4121e181 in ?? () from /usr/home/zach/mozilla/dist/bin/components/libprofile.so.1.0 #10 0x4121686d in ?? () from /usr/home/zach/mozilla/dist/bin/components/libprofile.so.1.0 #11 0x4121649f in ?? () from /usr/home/zach/mozilla/dist/bin/components/libprofile.so.1.0 #12 0x5e81 in main1 (argc=1, argv=0xdfbfdb7c, nativeApp=0x0) at nsAppRunner.cpp:894 #13 0x7002 in main (argc=1, argv=0xdfbfdb7c) at nsAppRunner.cpp:1123 ------------------------ However, I think the Segfault i get after the patch, in AssignFromReadable and the segfault in UCSToNewFS, are not related.
OS: other → OpenBSD
I'm also seeing this on my OpenBSD 2.7-current (Well it was current 2 months ago) machine.
setting bug status to New
Status: UNCONFIRMED → NEW
Ever confirmed: true
It appears to me that string conversion may be being attempted before XPCOM has been initialized / loaded. This does not work because you have to initialize XPCOM before you can convert between charsets. If this is what is happening, XPCOM is working as designed.
Correction, looking at the later stack trace, it appears that autoregistration has already occurred, which I believe happens after XPCOM initializartion.
Scott, since this heavily involves string manipulation, I would like you to take a look at the stack traces and suggest a non-string cause of the fault. Thanks.
Assignee: rayw → scc
Status: NEW → ASSIGNED
Does OpenBSD run static constructors correctly?
I'm getting a similiar stack trace with today's source from the trunk. I'm building on OpenBSD-Current. Note that in order to compile with the latest source on OpenBSD you need to make a few changes described in bug 60730. #0 0x400c4a49 in nsFSStringConversion::FSToNewUCS () #1 0x400c4d6b in nsLocalFile::GetUnicodePath () #2 0x41ae6ffc in ProfileStruct::ExternalizeLocation () #3 0x41ae52da in nsProfileAccess::UpdateRegistry () #4 0x41ad9ec3 in nsProfile::MigrateProfileInfo () #5 0x41ad77f6 in nsProfile::ProcessArgs () #6 0x41ad5da4 in nsProfile::StartupWithArgs () #7 0x4177 in InitializeProfileService () #8 0x4bd0 in main1 () #9 0x5884 in main ()
What happens if you try my (latest) patch in bug 43591?
I applied dbaron's patch from bug 43591 and am now getting a different crash, but I think we are further along now. *** Deferring registration of sample JS components registerSelf for remoteControl *** Registering sample JS components CSSLoader::LoadAgentSheet - failed to get converter (gdb) bt #0 0x40830a76 in nsOSHelperAppService::DoContent () #1 0x4081f713 in nsDocumentOpenInfo::DispatchContent () #2 0x4081ee88 in nsDocumentOpenInfo::OnStartRequest () #3 0x4076e856 in nsJARChannel::OnStartRequest () #4 0x406b5864 in nsOnStartRequestEvent::HandleEvent () #5 0x406b5394 in nsStreamListenerEvent::HandlePLEvent () #6 0x40105a89 in PL_HandleEvent () #7 0x40105999 in PL_ProcessPendingEvents () #8 0x40106903 in nsEventQueueImpl::ProcessPendingEvents () #9 0x40cbf483 in event_processor_callback () #10 0x40cbf202 in our_gdk_io_invoke () #11 0x40539a74 in g_io_add_watch () #12 0x4053ad1e in g_get_current_time () #13 0x4053b065 in g_get_current_time () #14 0x4053b2f8 in g_main_run () #15 0x4045be2e in gtk_main () #16 0x40cbfa98 in nsAppShell::Run () #17 0x41b1f082 in nsAppShellService::Run () #18 0x41ad64e0 in nsProfile::LoadDefaultProfileDir () #19 0x41ad5dde in nsProfile::StartupWithArgs () #20 0x4177 in InitializeProfileService () #21 0x4bd0 in main1 () #22 0x5884 in main ()
Does the patch on bug 57347 help? If not, a stack trace with line numbers would probably be helpful.
I'm trying the patch from bug 57347 now. Unfortunately, I dunno if I can get line numbers for you because I'm getting similar errors to bug 59021 whenever I do a debug build. I don't think I'm running out of memory, because I was able to compile a debug M18 fine.
I tried that patch and we are getting even closer. I can now see the eBorderStyle printf. Never thought I'd be glad to see that but now I am. :) RegSelf Big5 to Unicode converter complete *** Deferring registration of sample JS components registerSelf for remoteControl *** Registering sample JS components CSSLoader::LoadAgentSheet - failed to get converter stream Registering plugin 0 for: "*","All types",".*" we don't handle eBorderStyle_close yet... please fix me CSSLoader::LoadAgentSheet - failed to get converter stream we don't handle eBorderStyle_close yet... please fix me CSSLoader::LoadAgentSheet - failed to get converter stream we don't handle eBorderStyle_close yet... please fix me CSSLoader::LoadAgentSheet - failed to get converter stream Memory fault (core dumped) (gdb) bt #0 0x402dcc2f in _thread_machdep_switch () #1 0x40329308 in _sigq_check_reqd () #2 0x402dbe36 in _thread_kern_sched_state () #3 0x402973d1 in poll () #4 0x408ae54f in _XPollfdCacheDel () #5 0x408af01d in _XRead () #6 0x408afaf7 in _XReply () #7 0x40894ac8 in XGetWindowProperty () #8 0x40893cd0 in XGetWMHints () #9 0x4084f8a0 in gdk_window_set_icon () #10 0x406b416d in nsWindow::SetIcon () #11 0x406b4083 in nsWindow::SetIcon () #12 0x406b4cbb in nsWindow::OnRealize () #13 0x406abbc4 in nsWidget::RealizeSignal () #14 0x407897c9 in gtk_marshal_NONE__NONE () #15 0x407be5c0 in gtk_handlers_run () #16 0x407bd7cd in gtk_signal_real_emit () #17 0x407baca3 in gtk_signal_emit () #18 0x407f9890 in gtk_widget_realize () #19 0x407f9851 in gtk_widget_realize () #20 0x406b2c4a in L1836 () #21 0x406aa3de in nsWidget::CreateWidget () #22 0x406aa545 in nsWidget::Create () #23 0x405fa1e4 in nsWebShellWindow::Initialize () #24 0x405f7860 in nsAppShellService::JustCreateTopWindow () #25 0x405f7670 in nsAppShellService::CreateTopLevelWindow () #26 0x405f012b in nsXULWindow::CreateNewChromeWindow () #27 0x405effd1 in nsXULWindow::GetNewWindow () #28 0x405e4d22 in nsChromeTreeOwner::GetNewWindow () #29 0x40437c66 in GlobalWindowImpl::OpenInternal () #30 0x40434441 in GlobalWindowImpl::OpenDialog () #31 0x4175ba89 in nsUnknownContentTypeHandler::Show () #32 0x40d8915f in nsExternalAppHandler::OnStartRequest () #33 0x40d7deb1 in nsDocumentOpenInfo::OnStartRequest () #34 0x40c76856 in nsJARChannel::OnStartRequest () #35 0x40bbd864 in nsOnStartRequestEvent::HandleEvent () #36 0x40bbd394 in nsStreamListenerEvent::HandlePLEvent () #37 0x40105a89 in PL_HandleEvent () #38 0x40105999 in PL_ProcessPendingEvents () #39 0x40106903 in nsEventQueueImpl::ProcessPendingEvents () #40 0x40687483 in event_processor_callback () #41 0x40687202 in our_gdk_io_invoke () #42 0x40865a74 in g_io_add_watch () #43 0x40866d1e in g_get_current_time () #44 0x40867065 in g_get_current_time () #45 0x408672f8 in g_main_run () #46 0x40787e2e in gtk_main () #47 0x40687a98 in nsAppShell::Run () #48 0x405f7082 in nsAppShellService::Run () #49 0x40b974e0 in nsProfile::LoadDefaultProfileDir () #50 0x40b96dde in nsProfile::StartupWithArgs () #51 0x4177 in InitializeProfileService () #52 0x4bd0 in main1 () #53 0x5884 in main ()
I'm not sure who should look at that crash. You might want to file another bug about it, so this one doesn't cover all OpenBSD crashes...
QA Contact: leger → kandrot
This bug has not been touched since 2000-12-02,therefore this reminder. Reporter could you please retest this with a current build and let us know if the problem is still present or the bug can be closed
I'm unable to retest (hardware problems with my only computer able to compile mozilla). It seems that as of Mozilla 1.1, others are able to compile and run mozilla with less severe problems. The bug has probably been fixed. This article: http://www.deadly.org/article.php3?sid=20020829002328 may provide further information.
giving up ancient string bugs to the new string owner. jag, you'll want to sort through these and see which ones still apply and go with or against the direction in which you intend strings evolve
Assignee: scc → jaggernaut
Status: ASSIGNED → NEW
should this be closed, or is there still something to be fixed, people? (bug cleaning)
...or maybe marked as a duplicate of bug 124958.
QA Contact: kandrot → nobody
Assignee: jag → nobody
QA Contact: nobody → xpcom
Status: NEW → RESOLVED
Closed: 16 years ago
Resolution: --- → INCOMPLETE
You need to log in before you can comment on or make changes to this bug.