Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(180)

Issue 169703002: Add an error listener on isolates. (Closed)

Created:
6 years, 10 months ago by Lasse Reichstein Nielsen
Modified:
6 years, 7 months ago
Reviewers:
floitsch
CC:
reviews_dartlang.org, siva, Søren Gjesse, Ivan Posva
Visibility:
Public.

Description

Add an error listener on isolates. While any error listener is attached to an isolate, uncaught errors are reported to the listener through his supplied sendPort. The current format for the error is [error.toString(), stack == null ? null : stack.toString()] This is wrapped on the receiving side. The isolate exposes the errors as a broadcast stream of error events. R=floitsch@google.com Committed: https://code.google.com/p/dart/source/detail?r=36290

Patch Set 1 #

Total comments: 2

Patch Set 2 : New implementation. Works. #

Total comments: 15

Patch Set 3 : Include test in CL. Remove debug print. #

Patch Set 4 : Rewrite. Now catch all in IsolateContext.eval #

Total comments: 8

Patch Set 5 : Typo #

Patch Set 6 : Typo too. #

Patch Set 7 : Mark isolate_throws_test/01 failing. The test is wrong, and we should remove it (In another CL). #

Unified diffs Side-by-side diffs Delta from patch set Stats (+440 lines, -7 lines) Patch
M sdk/lib/_internal/lib/isolate_helper.dart View 1 2 3 4 5 9 chunks +64 lines, -7 lines 0 comments Download
M sdk/lib/isolate/isolate.dart View 1 3 chunks +96 lines, -0 lines 0 comments Download
A tests/isolate/handle_error2_test.dart View 1 2 3 4 1 chunk +89 lines, -0 lines 0 comments Download
A tests/isolate/handle_error3_test.dart View 1 2 3 4 1 chunk +116 lines, -0 lines 0 comments Download
A tests/isolate/handle_error_test.dart View 1 2 1 chunk +71 lines, -0 lines 0 comments Download
M tests/isolate/isolate.status View 1 2 3 4 5 6 2 chunks +4 lines, -0 lines 0 comments Download

Messages

Total messages: 13 (0 generated)
Lasse Reichstein Nielsen
6 years, 10 months ago (2014-02-17 14:01:21 UTC) #1
floitsch
I like where this is going, but I don't necessarily agree with the semantics yet: ...
6 years, 10 months ago (2014-02-17 14:21:39 UTC) #2
Lasse Reichstein Nielsen
On 2014/02/17 14:21:39, floitsch wrote: > I like where this is going, but I don't ...
6 years, 10 months ago (2014-02-18 09:48:19 UTC) #3
Lasse Reichstein Nielsen
https://codereview.chromium.org/169703002/diff/1/sdk/lib/_internal/lib/isolate_helper.dart File sdk/lib/_internal/lib/isolate_helper.dart (right): https://codereview.chromium.org/169703002/diff/1/sdk/lib/_internal/lib/isolate_helper.dart#newcode274 sdk/lib/_internal/lib/isolate_helper.dart:274: final Capability inspectCapability = new Capability(); What is "full ...
6 years, 10 months ago (2014-02-18 09:48:57 UTC) #4
Lasse Reichstein Nielsen
PTAL
6 years, 7 months ago (2014-05-13 07:57:35 UTC) #5
Lasse Reichstein Nielsen
https://codereview.chromium.org/169703002/diff/60001/sdk/lib/_internal/lib/isolate_helper.dart File sdk/lib/_internal/lib/isolate_helper.dart (right): https://codereview.chromium.org/169703002/diff/60001/sdk/lib/_internal/lib/isolate_helper.dart#newcode419 sdk/lib/_internal/lib/isolate_helper.dart:419: print("[[$errorMsg, ($url:$line${column == null ? "" : ":$column"}) $error(${error.runtimeType})]]"); ...
6 years, 7 months ago (2014-05-13 09:24:40 UTC) #6
floitsch
Fyi. https://codereview.chromium.org/169703002/diff/60001/sdk/lib/_internal/lib/isolate_helper.dart File sdk/lib/_internal/lib/isolate_helper.dart (right): https://codereview.chromium.org/169703002/diff/60001/sdk/lib/_internal/lib/isolate_helper.dart#newcode383 sdk/lib/_internal/lib/isolate_helper.dart:383: // If no listeners have been registered, consider ...
6 years, 7 months ago (2014-05-13 12:47:45 UTC) #7
Lasse Reichstein Nielsen
https://codereview.chromium.org/169703002/diff/60001/sdk/lib/_internal/lib/isolate_helper.dart File sdk/lib/_internal/lib/isolate_helper.dart (right): https://codereview.chromium.org/169703002/diff/60001/sdk/lib/_internal/lib/isolate_helper.dart#newcode392 sdk/lib/_internal/lib/isolate_helper.dart:392: if (JS("var", "#.onerror", globalThis) == null) { On 2014/05/13 ...
6 years, 7 months ago (2014-05-13 13:02:07 UTC) #8
Lasse Reichstein Nielsen
https://codereview.chromium.org/169703002/diff/60001/sdk/lib/_internal/lib/isolate_helper.dart File sdk/lib/_internal/lib/isolate_helper.dart (right): https://codereview.chromium.org/169703002/diff/60001/sdk/lib/_internal/lib/isolate_helper.dart#newcode392 sdk/lib/_internal/lib/isolate_helper.dart:392: if (JS("var", "#.onerror", globalThis) == null) { The problem ...
6 years, 7 months ago (2014-05-15 11:46:42 UTC) #9
Lasse Reichstein Nielsen
New implementation. PTAL again.
6 years, 7 months ago (2014-05-15 11:46:52 UTC) #10
floitsch
LGTM although I'm concerned about the not having "break on uncaught error". https://codereview.chromium.org/169703002/diff/100001/sdk/lib/_internal/lib/isolate_helper.dart File sdk/lib/_internal/lib/isolate_helper.dart ...
6 years, 7 months ago (2014-05-15 12:15:25 UTC) #11
Lasse Reichstein Nielsen
Committed patchset #7 manually as r36290 (presubmit successful).
6 years, 7 months ago (2014-05-19 10:55:23 UTC) #12
Lasse Reichstein Nielsen
6 years, 7 months ago (2014-05-19 11:13:36 UTC) #13
Message was sent while issue was closed.
https://codereview.chromium.org/169703002/diff/100001/sdk/lib/_internal/lib/i...
File sdk/lib/_internal/lib/isolate_helper.dart (right):

https://codereview.chromium.org/169703002/diff/100001/sdk/lib/_internal/lib/i...
sdk/lib/_internal/lib/isolate_helper.dart:406: print(error);
Done.

https://codereview.chromium.org/169703002/diff/100001/sdk/lib/_internal/lib/i...
sdk/lib/_internal/lib/isolate_helper.dart:427: } catch (e, s) {
True. 
That may have been one of the reasons for preferring onerror.
The problem is that we can't check before executing "code" whether errors are
fatal, since the code may be able to change that.

When we do synchronous sends to other isolates, throwing isn't an option anyway,
so this is the safest thing that works in all cases.
We could start counting how many isolates we are currently inside, and if only
one, do thrown there and catch it in onerror (and set some state so we know what
is happening in which isolate, and so we don't have to parse the crap that ends
up in onerror).

https://codereview.chromium.org/169703002/diff/100001/tests/isolate/handle_er...
File tests/isolate/handle_error2_test.dart (right):

https://codereview.chromium.org/169703002/diff/100001/tests/isolate/handle_er...
tests/isolate/handle_error2_test.dart:47: // Start paused so we have time to set
up the error handler.
Will do.

Powered by Google App Engine
This is Rietveld 408576698