Closed Bug 523672 Opened 15 years ago Closed 15 years ago

test_handlerService.js asserting on Linux debug unittests: ###!!! ASSERTION: index exceeds allowable range: 'i < mLength'

Categories

(Core Graveyard :: File Handling, defect, P1)

x86
Linux
defect

Tracking

(Not tracked)

RESOLVED FIXED
mozilla1.9.3a1

People

(Reporter: ted, Assigned: dbaron)

References

()

Details

(Keywords: regression)

Attachments

(1 file, 1 obsolete file)

Currently both test_handlerService.js and test_bookmarks.js are consistently crashing with what looks like the same stack on the Linux debug unittest runs. It's complicated by not having symbols for the stack (bug 519196).
No longer depends on: 519196
Depends on: 519196
Marco, Shawn, have either of you run this test on a debug Linux build?
hm, i did run all places toolkit tests on a linux debug build last month, but did not see anything strange.
Same stack for both? those tests are testing really different code paths...
Right, I assume the faulty code is lower in the platform somewhere, and both tests just happen to trigger it.
Ok, I reproduced these in a Linux debug build, they're separate issues. Not having symbols just makes it really tough to see! The test_bookmarks failure is bug 520445. The test_handlerService.js failure is different.
Summary: test_bookmarks.js and test_handlerService.js crashing on Linux debug unittests → test_handlerService.js crashing on Linux debug unittests
This is really lame. Inside the assertion here:
http://hg.mozilla.org/mozilla-central/annotate/7f1f309a34f8/uriloader/exthandler/unix/nsGNOMERegistry.cpp#l129
aFileExt is an empty string, so accessing aFileExt[0] hits the assertion here:
http://hg.mozilla.org/mozilla-central/annotate/7f1f309a34f8/xpcom/string/public/nsTSubstring.h#l235

CCing reed since he added that assertion.
Component: General → File Handling
QA Contact: general → file-handling
Summary: test_handlerService.js crashing on Linux debug unittests → test_handlerService.js asserting on Linux debug unittests: ###!!! ASSERTION: index exceeds allowable range: 'i < mLength'
Oh, I guess he just landed the patch in CVS. CCing Mike Hommey, who authored it.
Some more info, I think the bug is slightly up the stack. GetFromExtension is being called from here:
http://hg.mozilla.org/mozilla-central/annotate/7f1f309a34f8/uriloader/exthandler/unix/nsMIMEInfoUnix.cpp#l83
but I think the GetPrimaryExtension() call right before that is failing, because mExtensions is an empty array:
http://hg.mozilla.org/mozilla-central/annotate/7f1f309a34f8/uriloader/exthandler/nsMIMEInfoImpl.cpp#l127

But GetHasDefaultHandler is ignoring the NS_ERROR_NOT_INITIALIZED return value and using the empty ext string.
(In reply to comment #6)
> Oh, I guess he just landed the patch in CVS. CCing Mike Hommey, who authored
> it.

IIRC, this has landed a while ago.
(In reply to comment #7)
> Some more info, I think the bug is slightly up the stack. GetFromExtension is
> being called from here:
> http://hg.mozilla.org/mozilla-central/annotate/7f1f309a34f8/uriloader/exthandler/unix/nsMIMEInfoUnix.cpp#l83
> but I think the GetPrimaryExtension() call right before that is failing,
> because mExtensions is an empty array:
> http://hg.mozilla.org/mozilla-central/annotate/7f1f309a34f8/uriloader/exthandler/nsMIMEInfoImpl.cpp#l127
> 
> But GetHasDefaultHandler is ignoring the NS_ERROR_NOT_INITIALIZED return value
> and using the empty ext string.

Yes, it looks like this change is the culprit
http://hg.mozilla.org/mozilla-central/diff/99f24b52e463/uriloader/exthandler/unix/nsMIMEInfoUnix.cpp
Ccing Wolfgang, who landed the patch.
Blocks: 327323
Keywords: regression
Attached patch don't ignore failure (obsolete) — Splinter Review
The "obvious" patch, just returning rv on failure, makes this test fail (but not assert), since it propagates up to the JS as an exception. Returning NS_OK here when we get NS_ERROR_NOT_INITIALIZED seems...weird, but it works and the test passes. I'm not sure if this is the right fix. Should we be propagating the NS_ERROR_NOT_INITIALIZED, and make the test expect it? What else would that break?
Assignee: nobody → ted.mielczarek
Status: NEW → ASSIGNED
Attachment #407751 - Flags: review?(bzbarsky)
Mike, Wolfgang, does this patch look like the right solution?
No longer depends on: 519196
Comment on attachment 407751 [details] [diff] [review]
don't ignore failure

That looks wrong.
We are only supposed to leave with NS_OK if we got an answer. If not we need to fall through to the next nsMIMEIfoImpl::GetHasDefaultHandler, don't we?
(In reply to comment #13)
> (From update of attachment 407751 [details] [diff] [review])
> That looks wrong.
> We are only supposed to leave with NS_OK if we got an answer. If not we need to
> fall through to the next nsMIMEIfoImpl::GetHasDefaultHandler, don't we?

I was about to tell you something like that: you should let the hildon and
mimeinfoimpl path go through.

I'd say setting mimeinfo to NULL when you get NS_ERROR_NOT_INITIALIZED would be
good.
Yeah, the right fix here is to only call the GetFromExtension if the ext is nonempty.
(In reply to comment #14)
> I was about to tell you <snip>

I though that was Ted, sorry Wolfgang.
Someone else want to take this and do the right fix? I don't really know this code.
Assignee: ted.mielczarek → dbaron
Attachment #407751 - Attachment is obsolete: true
Attachment #407818 - Flags: review?(bzbarsky)
Attachment #407751 - Flags: review?(bzbarsky)
Attachment #407818 - Flags: review?(bzbarsky) → review+
http://hg.mozilla.org/mozilla-central/rev/5ec653ccfb52
Status: ASSIGNED → RESOLVED
Closed: 15 years ago
Priority: -- → P1
Resolution: --- → FIXED
Target Milestone: --- → mozilla1.9.3a1
Product: Core → Core Graveyard
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: