Closed rosmo closed 10 years ago
hey there,
I've had a successful go at that one; ... after some failures :)
The problem is, that php uses a longjmp to leave the whole execution stack, which effectively simply jumps out of v8's executeString and all its isolation fluff ... leading to a crash on next garbage collection.
The hack from above, yet just kind of a "proof of concept", overwrites zend_error_cb callback to catch fatal error handling, then first leaves all stack frames down to the JS -> PHP transition, re-enters the isolate there, calls v8::TerminateExecution and returns back into JS context. After termination of v8 execution the PHP fatal error is "re-thrown"
The current implementation has a few flaws:
... which should be easy going to implement, so I'll follow up, ... just to let you know for the moment :)
... but the example from above at least doesn't crash the engine anymore :D
cheers ~stesie
A fatal error in PHP called from JS results in a segmentation fault while cleaning up.
Output:
Stack trace:
I tried some workarounds to this, like removing the locking before calling IdleNotification in php_v8js_free_storage but that results in memory leaks. Adding v8::TerminateExecution before IdleNotification doesn't help either. I also tried moving the whole script->Run() into a new thread, but basically the code never returns from it.