Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Process node.exe doesn't exit when close the window #35

Open
pakchoidora opened this issue Jan 10, 2014 · 4 comments
Open

Process node.exe doesn't exit when close the window #35

pakchoidora opened this issue Jan 10, 2014 · 4 comments

Comments

@pakchoidora
Copy link

Sometimes, when you launch a app and hang it there for about half an hour, and then you click the close button of the window, it closed, but the node.exe process is still there in the task managar when you check it.
Is there any way to fix this out? pls
This cause a issue that when you run the app for several times, and there will be a bunch of processes of node.exe in the system

maybe this can be called "bug".
in file "index.js" at "deskshell-api"
at about line 97
app.rDebugApi.on('*',function(event) {...}

this listener only work once
it was defined in "index.js" at "chrome-rDebug"
at about line 619 and
used at about line 645
they only work once.

@sihorton
Copy link
Owner

This is a complex issue since chrome (the window) starts its own process and then exits immediately. Also sometimes chrome decides to "join" or re-use an existing browser process that is running, this means that it is quite difficult to detect when the window process closes. However the code is getting better on this point. Try the following:-

  1. Make sure that you have:
    "exitOnAppWinClose": true
    in your app.desk as this will tell node.exe process to exit once the window exits.

  2. Add an on window unload event in your application. This will get called when the window is closed, in this function you can then send a socket message to nodejs and tell it you are exiting. Node can then do process.exit() to terminate itself.

We are still looking for best practices to solve this issue, as we discover good solutions we can update the main deskshell implementation.

@pakchoidora
Copy link
Author

Thanks for replying.
Since a version of chrome which i can't call out.The event window.onunload is desperated, and it won't work any more.
I have a hack way to fix this up, using the chrome extension as that we can make it default to manage window's clos e event,but there still have some problem that Chrome Extension API work strange.API chrome.windows.onRemoved doesn't work every time.So sad and I can't figure this out.

@sihorton
Copy link
Owner

We will be moving to a cef3 based browser instead of chrome soon (code is working on mac already). This should solve the problem, when lanching the window we will get the process id and then know when it closes. This should fix the entire issue as well as give further benefits. So if you can live with the issue for now it should go away soon.

@lvbeck
Copy link
Contributor

lvbeck commented May 22, 2014

I use window.onbeforeunload event instead of window.onunload because the window.onunload also trigger when refresh the window, which is unwanted.

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

No branches or pull requests

3 participants