Skip to content

src: fix domains + --abort-on-uncaught-exception

If run with --abort-on-uncaught-exception, V8 will abort the process whenever it does not see a JS-installed CatchClause in the stack. C++ TryCatch clauses are ignored. Domains work by setting a FatalException handler which is ignored when running in abort mode.

This patch modifies MakeCallback to call its target function through a JS function that installs a CatchClause and manually calls _fatalException on error, if the process is both using domains and is in abort mode.

Fixes: https://github.com/iojs/io.js/issues/836


Some notes on this:

I am not a fan of how I've got the ParseArgs stuff working – specifically, the abort_on_uncaught_exc_ hangs off of the Environment object (which seems correct) but is also stored globally in a static boolean in node.cc. This is mostly out of expedience, since the environment hasn't been created yet, but I want to preserve the initial value. This feels bad, I am open to suggestions on how to make that better.

This does add the overhead of one branch to all MakeCallback calls. I'm not sure if there's a way to get around this, though.

Currently it does not respond to changes from require('v8').setFlagsFromString. I wanted to get a read on the approach before complicating that code.

R=@trevnorris + @bnoordhuis, /cc @Geek

Merge request reports

Loading