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

Terminate in Console View leaves node.exe running when using Run Configuration NPM /project/package.json start (similar to npm start) #190

Open
skleeschulte opened this issue May 6, 2015 · 8 comments

Comments

@skleeschulte
Copy link

This is my setup:

  • Eclipse Luna SR2 (4.4.2) under Windows 7 x64 with jre1.8.0_45
  • Eclipse was setup this way: extracted eclipse-platform-4.4.2-win32-x86_64.zip, installed Eclipse Marketplace Client, then installed Nodeclipse via Drag&Drop from nodeclipse.org
  • node version v0.12.2
  • express-generator is installed globally (version 4.12.1)

Now in eclipse I created a new Node.js Express Project. The default run configuration is package.json with goal "install". I changed goal from "install" to "start". This works perfectly - the start command in package.json is "node ./bin/www" and I can see this command appear in the console view when I run the project. I also see the log output when request are made to the express app. However, if I click the red icon "Terminate" inside the console view (as described here: http://www.nodeclipse.org/usage), node.exe does not exit. It looks like the console is somehow "detached" and the debug view says that package.json terminated. But if I try to start the app again, it says that the port is already in use, and I can see node.exe is still running in windows task manager. After I kill the process in windows task manager, I can run the project again in eclipse.

If I run the project via windows command line ("npm start") and then exit with Ctrl+C, node.exe is terminated properly.

@paulvi
Copy link
Member

paulvi commented Sep 23, 2015

Stefan, if the issue is still on with 4.5 Mars ?

@skleeschulte
Copy link
Author

Alright, I just tested again with:

  • Eclipse Mars (4.5) under Windows 7 x64 with jre1.8.0_60
  • Eclipse was setup this way: extracted eclipse-SDK-4.5-win32-x86_64.zip, installed Eclipse Marketplace Client, then installed Nodeclipse via Drag&Drop from nodeclipse.org (today, 23.09.2015)
  • node version v4.1.0
  • express-generator is installed globally (version 4.13.1)

I created a new Node.js Express Project (File -> New -> Node.js Express Project). Then executed the npm install run command, then created a new npm start command. Now the behaviour is even more strange:

  • The npm start command works fine, console shows standard express output, I can access the express website with the browser at localhost:3000 and the requests are logged in the eclipse console.
  • In Windows Task Manager, I can see two node.exe processes are started.
  • When I click the red "stop" button in eclipse, these two node.exe processes keep running.
  • At this point, I can reload the website in the browser once. This request is not logged in the eclipse console. And right after this reload, the two node.exe processes exit. Now I cannot reload the website a second time.

This behaviour is reproducable.

@paulvi
Copy link
Member

paulvi commented Sep 23, 2015

I was playing today with debugging, stopping and restarting node several time, and I have not run into this issue.

I see the key point is

At this point, I can reload the website in the browser once. This request is not logged in the eclipse console. And right after this reload, the two node.exe processes exit. Now I cannot reload the website a second time.

That is your software is server in wait cycle, and KILL signal is only processed after waiter got response.

This is dummy guessing, and also not in line with Node.js event loop model.

note, that Nodeclipse itself does nothing special to kill process. It is done by eclipse APIs.

@paulvi
Copy link
Member

paulvi commented Sep 23, 2015

The description is a bit too wordy.

In Windows Task Manager, I can see two node.exe processes are started.

Why there are 2 node.exe processes ?
Can you kill them all and see when they appear?

I have just tried with express, and it is OK,
only one node process

image

@paulvi
Copy link
Member

paulvi commented Sep 23, 2015

Then executed the npm install run command,

Why do you need that? When you create Express project via IDE you should get modules already downloaded.

I usually do right-clicking on .\bin\www then Run as -> Node application

Then executed the npm install run command, then created a new npm start command.

How do you do this?

@skleeschulte
Copy link
Author

Usually I start express with npm start. This way start scripts configured in package.json are run. This should explain why two node.exe processes appear (running npm start from command line also starts two node.exe processes).

In eclipse I do this with a new Run Configuration:

  • Drop-Down menu next to the green Play-Button at the top -> Run configurations
  • New NPM configuration:
    • File: /project/package.json
    • Goal: start
  • Run

@paulvi
Copy link
Member

paulvi commented Sep 24, 2015

OK, this way I also got 2 node processes and unable to stop from Eclipse

Also if running from command line npm start, there are also 2 node processes started

So I guess, we should check npm docs or sources for what it actually does.

For you I would suggest to use right-clicking on .\bin\www then Run as -> Node application,
because debugging should also be launched in the same way:
right-clicking on .\bin\www then Debug as -> Node application,

I don't think and don't want to spend time for launching debugging via npm start

@paulvi paulvi changed the title Terminate in Console View leaves node.exe running Terminate in Console View leaves node.exe running when using Run Configuration NPM /project/package.json start (similar to npm start) Sep 24, 2015
@paulvi
Copy link
Member

paulvi commented Sep 24, 2015

related to #177

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

No branches or pull requests

2 participants