jalangi2 icon indicating copy to clipboard operation
jalangi2 copied to clipboard

Add parameter to endExecution() to indicate a sudden exit

Open msridhar opened this issue 10 years ago • 1 comments

If a node program calls process.exit(), the underlying process exits immediately, without cleaning up the call stack, etc. In direct.js, we add an exit listener that at least ensures that endExecution() is invoked even if process.exit is called. But, this does not take care of all issues for the analysis client, as, e.g., it may be written expecting all functionEnter callbacks to have a corresponding functionExit callback. I can't think of anything we can really do here. We could monkey-patch process.exit to just throw some exception, but that can be caught by the application code. Just logging an issue in case there's an idea for how to hide the process.exit ugliness from analyses.

msridhar avatar May 15 '15 03:05 msridhar

After discussion with @ksen007, we decided that to handle this case, we should add another parameter to the endExecution callback indicating when the program has exited suddenly, e.g., due to process.exit. When this parameter is set, the analysis can then know that invariants may be violated (e.g., function enters may not be matched by function exits), and can handle the situation accordingly.

msridhar avatar May 18 '15 22:05 msridhar