Closed
Bug 1020292
Opened 12 years ago
Closed 12 years ago
defineLazyModuleGetter and defineLazyServiceGetter should cause test failures if they fail
Categories
(Toolkit :: Async Tooling, defect)
Toolkit
Async Tooling
Tracking
()
RESOLVED
WONTFIX
People
(Reporter: Yoric, Unassigned)
References
(Depends on 1 open bug, Blocks 1 open bug)
Details
No description provided.
| Reporter | ||
Comment 1•12 years ago
|
||
As far as I can tell, an error in a call to defineLazy{Module, Service, ø}Getter should cause a test failure.
There are several ways to implement this. From the top of my head, in case of defineLazy{Module, Service, ø}Getter error, we can:
1. Crash.
2. Leak a Promise.reject() and let the existing uncaught rejections mechanisms handle the issue.
3. Notify the observer service on a topic "uncaught-async-error" and adapt the test harnesses to fail upon notification of these topics.
Cons:
1. We don't want this in release.
2. Adds a dependency towards Promise.jsm. May or may not be a problem (by now, we're using Promise.jsm all around the code).
3. We need to adapt each test harness independently.
Any idea?
Comment 2•12 years ago
|
||
(In reply to David Rajchenbach Teller [:Yoric] from comment #1)
> As far as I can tell, an error in a call to defineLazy{Module, Service,
> ø}Getter should cause a test failure.
Lazy getters fail lazily, but if the code that uses the getter is exercised and the getter fails to load the target, I expect the test to fail anyways.
So there shouldn't be an actual issue I think, or am I missing something?
Flags: needinfo?(paolo.mozmail)
Comment 3•12 years ago
|
||
I think paolo is right, this sounds a little bit paranoid error checking, if importing a module fails, some code will be very broken. The only advantage seems to figure if some module is not exercised by any test, but still it sounds a rare case that nobody notices that in product (and at that point I expect someone will add a test for the filed bug)
Flags: needinfo?(mak77)
| Reporter | ||
Comment 4•12 years ago
|
||
It's more about finding the error early, rather than having to painfully trace the final error back to the missing import (without any stack information).
Comment 5•12 years ago
|
||
I can't imagine how may be painful to trace a "Something is undefined" error, when Something is exported by a module... Do you think that's common enough and hard to track to deserve specific error handling? I don't think so, but maybe I am ignoring some important fact that you already considered. Off-hand I don't see a large enough benefit to cover adding/complicating module import code.
| Reporter | ||
Comment 6•12 years ago
|
||
I vaguely recall the following bug in WebApps code:
1. During its first load, module "Foo" does some important side-effect (register some observers, maybe, I don't remember the details);
2. Module "Foo" is imported lazily, but with an error;
3. Import takes place in some observer and the error is swallowed (probably by xpconnect, I don't remember the details);
4. Failure appears several hundred lines below in the logs;
5. Debugging fun ensues.
Now, one can argue that the real issue is point 3. (aka bug 991595).
Comment 7•12 years ago
|
||
It sounds like a very exotic case as well as sounds like that module had poor testing coverage, that is a review-failure first of all.
I'm pretty sure there are cases like that around and this code would catch them, but I'm arguing that the code complication cost overweight that benefit if we do anything that is not trivial.
Moreover, in case of defineLazyModuleGetter we reportError eventual failures (http://mxr.mozilla.org/mozilla-central/source/js/xpconnect/loader/XPCOMUtils.jsm#229) it's hard to not notice that.
If you wish, we could also dump() there, so it's also visible in xpcshell-tests and in the console.
And as you said, the other errors should not be swallowed.
Btw, I didn't reply comment 0. The most trivial path would be to crash, but I think it wouldn't really solve the issue you are pointing out, developer spending time trying to figure what happened, indeed a crash may well cause him to spend hours trying to debug cpp code to find the crash origin (it would be different if from js we had something like MOZ_ASSERT that crashes but prints a reason and the js stack for that).
3. is a no-go due to the cost-benefit weight.
The only remaining option is 2, would the stack be clear enough in that case, may we provide a reject argument that would be printed out by the harness?
| Reporter | ||
Comment 8•12 years ago
|
||
Closing bug. Let's reopen it after the next catastrophe :)
> The only remaining option is 2, would the stack be clear enough in that case, may we provide a reject argument that would be printed out by the harness?
Yes to both.
Status: NEW → RESOLVED
Closed: 12 years ago
Resolution: --- → WONTFIX
| Reporter | ||
Comment 9•11 years ago
|
||
So, I have been hit by this again.
STR:
1. Some problem prevents a module from being [lazy] importable. Error message gets lost in mochitest noise.
2. Waste time finding out what's wrong.
Comment 10•11 years ago
|
||
(In reply to David Rajchenbach Teller [:Yoric] from comment #9)
> Error message gets lost in mochitest noise.
This is the right thing to spend time fixing.
| Reporter | ||
Comment 11•11 years ago
|
||
Well, I have been bitten by this again.
You need to log in
before you can comment on or make changes to this bug.
Description
•