This auto-restart mechanism seems fragile. If an extension loads bad node code at startup, there is a chance we could get in an infinite loop here. We should consider a "safe" mode that only loads our trusted (and tested!) extensions. Auto-restarts would only happen in "safe" mode.