Optionally aborting on uncaught exception

75 views
Skip to first unread message

Dave Pacheco

unread,
Feb 21, 2013, 3:59:50 PM2/21/13
to v8-u...@googlegroups.com
Last year I worked with members of the V8 team to add low-overhead debug
information to V8 so that we could debug Node.js programs postmortem.[1]  This
information has proven quite valuable, and we've configured our Node programs to
invoke abort(3C) (via Node's process.abort()) whenever we get the
"uncaughtException" event.  We've nailed several nasty production issues based
on the resulting core files without having to reproduce the problem.  See [2]
for a particularly nasty example.

That said, there's one problem with this approach: by the time we get to the
uncaughtException handler, all of the stack state associated with the exception
is gone.  If we blow an assertion or trip over an undefined variable inside a
function, it's often valuable to know what the arguments to that function were,
but that's all gone by the time the event is emitted.  My proposal is to add a
command line flag that causes V8 to call OS::Abort when an uncaught exception is
emitted.  The diffs are pretty small:


but the result is that we get a core file with the current JavaScript stack
intact, including arguments.  This particular change helped us nail two
instances of RangeError (see [3] for my write-up of one of them).

If the team is okay with this change, I'd like to submit a code review and have
it integrated into V8.

Thanks,
Dave


Yang Guo

unread,
Mar 27, 2013, 6:10:36 AM3/27/13
to v8-u...@googlegroups.com
Hi Dave,

Not sure if this really needs adding a command line flag. Wouldn't it be sufficient to set a break point in DoThrow when you need it? Or is it not possible to attach gdb? In that case, please follow https://code.google.com/p/v8/wiki/Contributing so that we can land the patch for you. The patch by itself looks alright to me, but you might want to consider adding OS::DumpBacktrace() as well.

Yang

Jakob Kummerow

unread,
Mar 27, 2013, 7:56:42 AM3/27/13
to v8-u...@googlegroups.com
Yang, Dave has already uploaded the patch at https://codereview.chromium.org/13071005/. It would be great if you had time to take a look, I'm not sure when I'll get around to it myself.


--
--
v8-users mailing list
v8-u...@googlegroups.com
http://groups.google.com/group/v8-users
---
You received this message because you are subscribed to the Google Groups "v8-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to v8-users+u...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.
 
 

Reply all
Reply to author
Forward
0 new messages