Closed Bug 443874 Opened 14 years ago Closed 14 years ago

Need a hook for thread creation and destruction in thread pool


(Core :: XPCOM, defect)

Not set





(Reporter: bent.mozilla, Assigned: bent.mozilla)




(2 files, 1 obsolete file)

Attached patch Patch, v1 (obsolete) — Splinter Review
The JS engine asserts that all contexts created on a particular thread have been destroyed by the time the thread dies, and it asserts this at thread destruction time via NSPR's per-thread data destruction mechanism. I'm using a thread pool to create per-thread contexts in bug 437152 and I needed a way to be notified when a thread was created and destroyed in the pool to prevent the assertions. I couldn't use the per-thread data destructor mechanism because the JS engine does the same thing (and registers its TLS index first).

Attached is one possible fix. Benjamin, what do you think?
Attachment #328298 - Flags: review?(benjamin)
Version: unspecified → Trunk
Comment on attachment 328298 [details] [diff] [review]
Patch, v1

I'd really love a test for this...
Attachment #328298 - Flags: review?(benjamin) → review-
Attached patch Patch, v2Splinter Review
Ok, this has tests. It also makes the thread pool release the listener after the shutdown() method rather than waiting until the thread pool is destroyed.
Attachment #328298 - Attachment is obsolete: true
Attachment #330118 - Flags: review?(benjamin)
Attachment #330118 - Flags: review?(benjamin) → review+
Pushed to moz-central.

Mossop realized I forgot to bump the uuid of nsIThreadPool. Checked in a followup that did only that.
Closed: 14 years ago
Resolution: --- → FIXED
The test is hanging on one windows box... I disabled it for the moment until I get a windows build going.
MacOSX Darwin 9.2.2 mozilla-central qm-moz2mini01

Finished running TestTextFormatter
Running TestThreadPoolListener
Running ThreadPoolListener tests...
../../dist/bin/ line 131: 90077 Segmentation fault      "$prog" ${1+"$@"}
make[2]: *** [check] Error 139
make[1]: *** [check] Error 2
make: *** [check] Error 2
SeaMonkey Mac (Tiger) is timing out on that test frequently, it only passes very rarely.
I've backed this out with changeset 29af572a67ba due to multiple test failures.
Resolution: FIXED → ---
I believe that the real fix for the test failures is bug 449822, but I'll test by a cheap workaround.
Attached patch Fix testSplinter Review
This applies on top of attachment 330118 [details] [diff] [review] and, if my theory is correct, should fix the hanging/crashing unit tests we saw on tinderbox.
Attachment #333247 - Flags: review?(jst)
Attachment #333247 - Flags: superreview+
Attachment #333247 - Flags: review?(jst)
Attachment #333247 - Flags: review+
Checked in, and it stuck this time!
Closed: 14 years ago14 years ago
Resolution: --- → FIXED
You need to log in before you can comment on or make changes to this bug.