Skip to content
This repository has been archived by the owner on Sep 6, 2021. It is now read-only.

Add a top-level exception handler to the Node process #7521

Closed
njx opened this issue Apr 15, 2014 · 19 comments
Closed

Add a top-level exception handler to the Node process #7521

njx opened this issue Apr 15, 2014 · 19 comments

Comments

@njx
Copy link

njx commented Apr 15, 2014

We should globally catch exceptions in Node, so the entire process doesn't get hosed by a bad extension. If we do catch such an exception, we probably need to restart the node process, but at least it wouldn't stay in a bad state.

@njx
Copy link
Author

njx commented Apr 15, 2014

I'm actually wondering if we already have code somewhere that tries to restart the Node process if it dies - it seems like we have some logic around auto-reconnecting domains, so it seems like that's an expected case. But @jadbox was running into a problem where an extension was basically making all the Node features in Brackets unusable because it threw an exception in the Node code, and it seemed like the whole process died and didn't restart.

@njx
Copy link
Author

njx commented Apr 15, 2014

Marking high priority since we should really look at this soon.

@njx
Copy link
Author

njx commented Apr 15, 2014

Not sure this is really bigger than a breadbox, but I'm going to nominate it on the Kanban board anyway so we don't lose sight of it.

@redmunds
Copy link
Contributor

wondering if we already have code somewhere that tries to restart the Node process if it dies

This is done in brackets-shell. On Windows: https://github.com/adobe/brackets-shell/blob/master/appshell/appshell_node_process_win.cpp#L110

@njx
Copy link
Author

njx commented Apr 15, 2014

Hm, ok. We should try to figure out why it seemed like @jadbox's node process was persistently dead.

@zaggino
Copy link
Contributor

zaggino commented Apr 16, 2014

From my experiences with brackets-git, I don't think the node process actually restarts when it's brought down by an uncaught exception. I've recently had an issue with this and file watchers just stayed off until I restarted my Brackets.

@zaggino
Copy link
Contributor

zaggino commented Apr 16, 2014

Forgot to note that the behavior was different on Linux and Windows - on Windows file watchers "survived" the launch of a non-existing file with an error from node in the console, but on Linux they crashed. I had to do a fs.stat check before trying to execute a file to keep the error away.

This is the domain file brackets-git are using currently: https://github.com/zaggino/brackets-git/blob/master/src/domains/cli.js

@zaggino
Copy link
Contributor

zaggino commented Apr 16, 2014

Also, when there's a typo - nothing will help ... I've submitted a PR which helps with this a bit: adobe/brackets-shell#432

@chr-1x
Copy link

chr-1x commented Apr 17, 2014

This is definitely necessary. I'm getting crashes about every ~5-10 minutes with Brackets open - at first I thought it was an extension, but it persisted after I disabled all of them. The app goes blue, none of the menu options work and it won't close unless I terminate the process manually. Really annoying because besides this issue I absolutely adore Brackets.

@ingorichter
Copy link
Contributor

@chronister on which platform do you see this issue? I've merged adobe/brackets-shell#432 to get a better idea what might have caused the issue to see some output in the console. But it's definitely only a small step towards a solution for this issue.

@chr-1x
Copy link

chr-1x commented Apr 17, 2014

@ingorichter Windows 7 64 Bit. Since I posted that, it's actually been fairly stable - I'll have to mess around a bit more to see if I can reproduce the conditions that cause instability; I think it might be something in a node.js project I had open. However, opening the developer tools doesn't seem to be working - the chrome window says it's unable to connect to localhost:9234. Also, building the latest copy of brackets-shell is proving difficult, as I'm getting some jasmine errors. I'll try to see what I can do.

@pthiess pthiess added this to the Brackets 1.0 milestone Apr 21, 2014
@pthiess
Copy link
Contributor

pthiess commented Apr 21, 2014

Nominate for 1.0.

@ingorichter
Copy link
Contributor

@chronister What issues do you see building brackets-shell? Do you see them on master?
It seems strange to me, that you can't connect to localhost:9234 when you have Brackets running. Did you built Brackets yourself? Or does this happen with one of the official builds?

@njx
Copy link
Author

njx commented Apr 24, 2014

That symptom is a different problem - it's a crash in the shell's render process. An exception in the Node process doesn't take down the Brackets UI - it just disables some functionality like file watching and extension installation. Could you file a separate bug on what you're seeing, and list the extensions you have installed if any? Thanks.

On Apr 16, 2014, at 8:32 PM, "Andrew" <[email protected]mailto:[email protected]> wrote:

This is definitely necessary. I'm getting crashes about every ~5-10 minutes with Brackets open - at first I thought it was an extension, but it persisted after I disabled all of them. The app goes blue, none of the menu options work and it won't close unless I terminate the process manually. Really annoying because besides this issue I absolutely adore Brackets.

Reply to this email directly or view it on GitHubhttps://github.com//issues/7521#issuecomment-40677489.

@dangoor
Copy link
Contributor

dangoor commented May 1, 2014

Reviewed, keeping for 1.0

@peterflynn
Copy link
Member

@dangoor Any objections to pushing this out of 1.0? It hasn't seemed like a common problem yet. In 1.0-review we removed the milestone -- but for this one we wanted to make sure it's ok with you too.

@dangoor
Copy link
Contributor

dangoor commented Aug 13, 2014

Yeah, I agree that it hasn't seemed a common problem and we can punt from 1.0.

@peterflynn
Copy link
Member

Should this be closed as 'move to backlog' since a card was created for it? https://trello.com/c/DsAfNtlA/1254-s-research-gracefully-handle-node-exceptions

@dangoor
Copy link
Contributor

dangoor commented Oct 5, 2014

Yes, that makes sense. Closing move to back log...

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

8 participants