Closed Bug 380468 Opened 17 years ago Closed 9 years ago

Crash in tests during xpcom-shutdown

Categories

(Core :: Networking: HTTP, defect)

defect
Not set
critical

Tracking

()

RESOLVED INVALID

People

(Reporter: hello, Unassigned)

References

Details

(Keywords: crash)

Attachments

(2 files)

I'm adding to the places tests, and created a test which imports a microsummary from a bookmarks.html.

When xpcshell exits, I get an "Abort trap" message from the shell script.  Upon further investigation, it seems that something like the following is happening:

- An event is broadcast to inform listeners that a shutdown is taking place.
- The cache is properly shut down
- An xpcom-shutdown event is sent to a thread, and its pending events are processed until it acks the shutdown.
- The thread runs an event which causes it do a network connection, which hits the cache after it has shut down.

Doing some testing there were some variations depending on my code - sometimes the backtrace showed that the pending event was an xmlhttprequest failing because sThreadJSContextStack was null (because nsContentUtils::Shutdown had already happened), but essentially this seems to me to be the same problem: we should clear out the event queues of threads *before* issuing the general xpcom-shutdown event.

Then again, my knowledge of xpcom internals is very limited, so take my suggestion with several grains of salt.

To reproduce this problem:

* Apply 'wip patch mk III' from bug 373501.
* build
* cd objdir/browser/components/places
* make check

To test in gdb:

* cd tests
* TOPSRCDIR=/path/to/mozilla NATIVE_TOPSRCDIR=/path/to/mozilla gdb ../../../../dist/bin/xpcshell
* run -f /Users/thunder/sources/mozilla-trunk/mozilla/tools/test-harness/xpcshell-simple/head.js -f ../../../../_tests/xpcshell-simple/test_browser_places/unit/head_bookmarks.js -f ../../../../_tests/xpcshell-simple/test_browser_places/unit/test_bookmarks_html.js -f /Users/thunder/sources/mozilla-trunk/mozilla/tools/test-harness/xpcshell-simple/tail.js -f ../../../../_tests/xpcshell-simple/test_browser_places/unit/tail_bookmarks.js
Attached file Stack trace 1
Whoops, forgot to change my /Users/thunder/... paths above, but you get the idea.
Attached file Stack trace 2
After talking with Seth S. today I think this might be a duplicate of bug 319934.
No, it's different.  Same very general underlying problem (shutdown race), totally different crash location and exact details of _what_ is racing.
Oh, "stack trace 2" would be the same thing as bug 319934, yes.  The first stack trace is a different issue, though.  One that should probably be assigned to necko.
To be precise, nsHttpChannel::OnStartRequest should not be processing redirections after shutdown, imo.
We should block on this, we have a unit test that can't be enabled without triggering this crash.
Flags: blocking1.9?
Component: XPCOM → Networking: HTTP
OS: Mac OS X → All
QA Contact: xpcom → networking.http
Hardware: PC → All
I *should* have fixed stack #2 in bug 319934. I cannot reproduce the other one on Windows.
This bug shouldn't be reproducable in the browser (because we shut down the network well before xpcom-shutdown), and there's a workaround for unit tests (explicitly go offline before shutdown), so I'm not going to block on this.
Flags: blocking1.9? → blocking1.9-
Severity: major → critical
Keywords: crash
so is what's left only related to tests?  still wanted?
(In reply to Wayne Mery (:wsmwk, use Needinfo for questions) from comment #10)
> so is what's left only related to tests?  still wanted?

given comment 8 and comment 9 I'd guess this is no longer valid
Status: NEW → RESOLVED
Closed: 9 years ago
Resolution: --- → INVALID
Summary: Crash during xpcom-shutdown → Crash in tests during xpcom-shutdown
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: