Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

VM should pause on the throwing exceptions in futures, which will not be handled by any catchError() #15120

Closed
DartBot opened this issue Nov 16, 2013 · 18 comments
Labels
area-vm Use area-vm for VM related issues, including code coverage, FFI, and the AOT and JIT backends. closed-obsolete Closed as the reported issue is no longer relevant

Comments

@DartBot
Copy link

DartBot commented Nov 16, 2013

This issue was originally filed by Erik.Gri...@gmail.com


What steps will reproduce the problem?

  1. Set the
  2. Run the example https://github.com/ErikGrimes/polymer_elements/blob/master/example/polymer_selector.html

What is the expected output? What do you see instead?
Expected: The editor should break at the source of the exception (Uncaught DataCloneError).
Actual: The editor continues on.

What version of the product are you using? On what operating system?

Dart Editor version 1.0.0_r30187 (DEV)
Dart SDK version 1.0.0.3_r30187

Please provide any additional information below.

I suspect what's going on here is the UncaughtDataCloneError is an unhanded async error in the sdk or dart libraries. So from the the editors perspective, it's not "uncaught". I think two things need to happen.

  1. The editor needs to break on uncaught async errors
  2. The zone or whatever it is that is responsible for handling uncaught async errors need to report them in a way that enables the source of the error to be tracked down.
@DartBot
Copy link
Author

DartBot commented Nov 16, 2013

This comment was originally written by Erik.G...@gmail.com


Step 1 should be "Set the editor preference Run and Debug -> Break On Exceptions to 'Uncaught'"

@sethladd
Copy link
Contributor

Added Area-Editor, Triaged labels.

@clayberg
Copy link

Set owner to @devoncarew.
Added this to the Later milestone.
Removed Priority-Unassigned label.
Added Priority-Medium label.

@DartBot
Copy link
Author

DartBot commented Jan 8, 2014

This comment was originally written by @zoechi


The DataCloneError is issue #14779

@devoncarew
Copy link
Member

I think what's happening here is that the Zone is catching and handling the error. From the POV of the application and the user it's an uncaught exception. From the POV of the debugger it's been caught and handled. We need to reconcile the two viewpoints.

Adding Florian (who I think did the zones work) and Matthias to get their thoughts.


cc @floitschG.
cc @mhausner.

@floitschG
Copy link
Contributor

Yes.
We need to breakpoint into handleUncaughtError of the rootZone to give users a good experience. There is not a lot we can do to avoid that.

Fwiw browsers have a similar issue with onerror. They consider errors as uncaught, even if the onerror handler returns true.

@DartBot
Copy link
Author

DartBot commented Mar 7, 2014

This comment was originally written by @mhausner


It looks like either we bake the knowledge as to what counts as an uncaught exception into the core VM, or we leave it up to the debugger front-end to determine whether an exception should be considered as uncaught or not.

The debugger client can implement this by telling the VM to break on all exceptions, and then determine which ones to show to the user and which ones not.

@floitschG
Copy link
Contributor

Fwiw there could be some interesting logic involved.

For example:
===
var f = new Future.value(499);
f = f.then((x) => throw "bad");
f = f.then(print);
===

Here the throw "bad" is uncaught. The problem is, that we only know that once we have run through the successors (here the "print").
A great debugger could have enough knowledge to see that the 'throw' isn't handled and break already then. (This would give access to the live stack frames).

I'm bringing this up, because I expect this to have some (even if small) influence on the decision where we want to put the logic.

@clayberg
Copy link

clayberg commented Apr 9, 2014

Removed this from the Later milestone.
Added this to the 1.4 milestone.

@kasperl
Copy link

kasperl commented May 8, 2014

Removed this from the 1.4 milestone.
Added this to the 1.5 milestone.

@jmesserly
Copy link

Issue #16387 has been merged into this issue.

@kasperl
Copy link

kasperl commented Jun 4, 2014

Removed this from the 1.5 milestone.
Added this to the 1.6 milestone.

@kasperl
Copy link

kasperl commented Jul 10, 2014

Removed this from the 1.6 milestone.
Added Oldschool-Milestone-1.6 label.

@kasperl
Copy link

kasperl commented Aug 4, 2014

Removed Oldschool-Milestone-1.6 label.

@sethladd
Copy link
Contributor

Added Editor-Debugging label.

@clayberg
Copy link

cc @scheglov.

@scheglov
Copy link
Contributor

How can the debugger client know if there is any chained catchError() invocation somewhere in the other library that calls some function? Or that its test() function will actually allow to handle it?

It seems that it would require to do much Dart code analysis, which mean that it naturally belongs to VM, not to the debugger client.


import 'dart:async';

main() {
  useFuture()
  .catchError((e) {
    print('handled: $e');
  })
  ;
}

Future useFuture() {
  var f = new Future.value(499);
  f = f.then((x) => throw "bad");
  return f = f.then(print);
}



cc @devoncarew.
Removed the owner.
Removed Area-Editor label.
Added Area-VM label.
Changed the title to: "VM should pause on the throwing exceptions in futures, which will not be handled by any catchError()".

@floitschG
Copy link
Contributor

I only see the following (imperfect) solution:
when there is a completeError (or similar operation that leads to a Future with an error) the debugger breaks, inspects the completing future, and transitively looks if it has listeners. Looking for visitors is a private operation that depends on the implementation of Futures. It must be tuned for our internal implementation(s).

Note: even then it is very imperfect, since users can add error-handlers after a call to completeError.
In fact: new Future.error(499) by construction doesn't have an error-handler yet. I have no idea how to handle this case... :(

@DartBot DartBot added Type-Defect area-vm Use area-vm for VM related issues, including code coverage, FFI, and the AOT and JIT backends. labels Sep 22, 2014
@mit-mit mit-mit added the closed-obsolete Closed as the reported issue is no longer relevant label Nov 20, 2015
@mit-mit mit-mit closed this as completed Nov 20, 2015
@kevmoo kevmoo removed the triaged label Mar 1, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area-vm Use area-vm for VM related issues, including code coverage, FFI, and the AOT and JIT backends. closed-obsolete Closed as the reported issue is no longer relevant
Projects
None yet
Development

No branches or pull requests

10 participants