Skip to content

Add a library to track multiple stack traces #7040

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

Closed
nex3 opened this issue Nov 29, 2012 · 12 comments
Closed

Add a library to track multiple stack traces #7040

nex3 opened this issue Nov 29, 2012 · 12 comments
Assignees
Labels
area-core-library SDK core library issues (core, async, ...); use area-vm or area-web for platform specific libraries. type-enhancement A request for a change that isn't a bug

Comments

@nex3
Copy link
Member

nex3 commented Nov 29, 2012

Currently, a future chain that's passing along an error keeps track of only a single stack trace: the stack when the error was originally thrown. This is useful in many cases, but doesn't provide a complete picture of the exception and is less useful when using APIs that return Futures. For example:

    Future<Map> readJson(url) {
      return http.read(url).transform(JSON.parse);
    }

If the call to http.read fails, the stack trace will only contain functions within the http library; it won't give any indication that readJson was called (or the function that called readJson, etc).

As far as I can tell the only way to fully expose the cause of an exception in a Future chain is to record the stack trace at each transform()/chain() call (possibly discarding duplicates). It may be possible to avoid doing this unless an exception is being passed along, which would be good.

@munificent
Copy link
Member

Issue #8656 has been merged into this issue.

@nex3
Copy link
Member Author

nex3 commented Feb 26, 2013

Added Library-Async label.

@a-siva
Copy link
Contributor

a-siva commented Feb 28, 2013

Issue #8656 has been merged into this issue.

3 similar comments
@sethladd
Copy link
Contributor

Issue #8656 has been merged into this issue.

@a-siva
Copy link
Contributor

a-siva commented Feb 28, 2013

Issue #8656 has been merged into this issue.

@sethladd
Copy link
Contributor

Issue #8656 has been merged into this issue.

@lrhn
Copy link
Member

lrhn commented Feb 28, 2013

You can capture stack traces that happen after the error, but that's not necessarily helpful in fixing the error. It might give more context to the error, so you can track back the "then"-chain from the error handler to the source of the error.

What you actually want is a "stack trace" chain of the calls that created the future that eventually completed with an error. That is not something we want to do in general, since it would require capturing a stack-trace for each "then" call before we know it's necessary.


Removed Type-Defect label.
Added Type-Enhancement label.

@sethladd
Copy link
Contributor

Hi Lasse,

Maybe we can do something in checked-mode, which is already slower but more helpful to the developer. Developing with Futures is quite painful, have you and the lib team come up with any prescriptive techniques for dealing with exceptions "deep in the bowels" of code? I'm at a loss for what to tell developers that run into this. Thanks!

@munificent
Copy link
Member

I could deal with this behavior being opt in. I don't even care if it's hard to opt in. Just give me some way to get the stack traces back when an async failure occurs.

One option would be to add a programmatic way to opt-in: some API that lets you set a "capture stack traces before async operations" flag.

@floitschG
Copy link
Contributor

This is now possible with Zones. They get called (registerCallback) when the callback is registered, and when it is invoked.

Not planning on adding more to Futures.


Added NotPlanned label.

@nex3
Copy link
Member Author

nex3 commented Nov 19, 2013

I'm re-opening this and assigning it to me, since I'm working on a library to do this using Zones, as Florian suggested.


Set owner to @nex3.
Removed Library-Async label.
Added Library-StackTrace, Started labels.
Unmarked this as being blocked by #4061.
Changed the title to: "Add a library to track multiple stack traces".

@nex3
Copy link
Member Author

nex3 commented Dec 16, 2013

pkg/stack_trace now has support for this, in the form of the Chain class.


Added Fixed label.

@nex3 nex3 added Type-Enhancement area-core-library SDK core library issues (core, async, ...); use area-vm or area-web for platform specific libraries. labels Dec 16, 2013
@nex3 nex3 self-assigned this Dec 16, 2013
@kevmoo kevmoo added type-enhancement A request for a change that isn't a bug and removed type-enhancement labels Mar 1, 2016
This issue was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area-core-library SDK core library issues (core, async, ...); use area-vm or area-web for platform specific libraries. type-enhancement A request for a change that isn't a bug
Projects
None yet
Development

No branches or pull requests

7 participants