ionic-team / ionic-app-scripts

App Build Scripts for Ionic Projects
http://ionicframework.com/
MIT License
608 stars 304 forks source link

Quiting ionic serve leaves the node process still in memory #438

Open nickwinger opened 8 years ago

nickwinger commented 8 years ago

I'm on a windows 7 machine runnig ionic serve nightly build. If i quit ionic serve by pressing "q" or "quit" the node processes are still in memory taking up 1GB of memory. I have to manually quit them via the task manager. Funny thing: although ionic serve got quit, if i make changes to the code the watcher seems to be still there and triggers on the command line.

not killing the processes manually and starting ionic serve again spawns new node process, taking up tons of GB all in all.

Expected behaviour: Quiting ionic serve should kill all related node processes.

danbucholtz commented 8 years ago

Please update the ionic cli and let us know if this is still an issue. npm install -g ionic@latest. ionic --version should be 2.1.12.

Thanks, Dan

nickwinger commented 8 years ago

Hi Dan,

i'm afraid the problem ist still there.

When i kill the node process with the Task Manager in the Console Window where "ionic serve" was running i get the following output:

npm ERR! Windows_NT 6.1.7601
npm ERR! argv "C:\\Program Files\\nodejs\\node.exe" "C:\\Users\\nick\\AppData\\Roaming\\npm\\node_modules\\npm\\bin\\npm
-cli.js" "run" "watch"
npm ERR! node v6.9.1
npm ERR! npm  v3.10.9
npm ERR! code ELIFECYCLE
npm ERR! urano@0.0.1 watch: `ionic-app-scripts watch`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the urano@0.0.1 watch script 'ionic-app-scripts watch'.
npm ERR! Make sure you have the latest version of node.js and npm installed.
npm ERR! If you do, this is most likely a problem with the urano package,
npm ERR! not with npm itself.
npm ERR! Tell the author that this fails on your system:
npm ERR!     ionic-app-scripts watch
npm ERR! You can get information on how to open an issue for this project with:
npm ERR!     npm bugs urano
npm ERR! Or if that isn't available, you can get their info via:
npm ERR!     npm owner ls urano
npm ERR! There is likely additional logging output above.

npm ERR! Please include the following file with any support request:
npm ERR!     C:\dev\UranoIonic\npm-debug.log

and this is the npm-debug.log:

0 info it worked if it ends with ok
1 verbose cli [ 'C:\\Program Files\\nodejs\\node.exe',
1 verbose cli   'C:\\Users\\nick\\AppData\\Roaming\\npm\\node_modules\\npm\\bin\\npm-cli.js',
1 verbose cli   'run',
1 verbose cli   'watch' ]
2 info using npm@3.10.9
3 info using node@v6.9.1
4 verbose run-script [ 'prewatch', 'watch', 'postwatch' ]
5 info lifecycle urano@0.0.1~prewatch: urano@0.0.1
6 silly lifecycle urano@0.0.1~prewatch: no script for prewatch, continuing
7 info lifecycle urano@0.0.1~watch: urano@0.0.1
8 verbose lifecycle urano@0.0.1~watch: unsafe-perm in lifecycle true
9 verbose lifecycle urano@0.0.1~watch: PATH: C:\Users\nick\AppData\Roaming\npm\node_modules\npm\bin\node-gyp-bin;C:\dev\UranoIonic\node_modules\.bin;C:\Program Files (x86)\Microsoft Visual Studio 14.0\Common7\IDE\CommonExtensions\Microsoft\TestWindow;C:\Program Files (x86)\MSBuild\14.0\bin;C:\Program Files (x86)\Microsoft Visual Studio 14.0\Common7\IDE\;C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\BIN;C:\Program Files (x86)\Microsoft Visual Studio 14.0\Common7\Tools;C:\Windows\Microsoft.NET\Framework\v4.0.30319;C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\VCPackages;C:\Program Files (x86)\Microsoft Visual Studio 14.0\Team Tools\Performance Tools;C:\Program Files (x86)\Microsoft SDKs\Windows\v10.0A\bin\NETFX 4.6.1 Tools\;C:\ProgramData\Oracle\Java\javapath;C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem;C:\Windows\System32\WindowsPowerShell\v1.0\;C:\Windows\system32\config\systemprofile\.dnx\bin;C:\Program Files\Microsoft DNX\Dnvm\;C:\Program Files\Microsoft SQL Server\130\Tools\Binn\;C:\Program Files (x86)\Skype\Phone\;C:\Program Files\Git\cmd;C:\Program Files\Microsoft SQL Server\Client SDK\ODBC\110\Tools\Binn\;C:\Program Files (x86)\Microsoft SQL Server\120\Tools\Binn\ManagementStudio\;C:\Program Files (x86)\Microsoft SQL Server\120\Tools\Binn\;C:\Program Files\Microsoft SQL Server\120\Tools\Binn\;C:\Program Files (x86)\Microsoft SQL Server\120\DTS\Binn\;C:\Program Files\Microsoft SQL Server\120\DTS\Binn\;C:\Program Files\nodejs\;C:\Users\nick\AppData\Local\Programs\Python\Python35-32\Scripts\;C:\Users\nick\AppData\Local\Programs\Python\Python35-32\;C:\Program Files (x86)\Microsoft VS Code\bin;C:\Program Files\Java\jdk1.8.0_92\bin;C:\Users\nick\AppData\Local\Android\sdk\platform-tools;C:\cmd;c:\openssl\bin;C:\Users\nick\AppData\Roaming\npm
10 verbose lifecycle urano@0.0.1~watch: CWD: C:\dev\UranoIonic
11 silly lifecycle urano@0.0.1~watch: Args: [ '/d /s /c', 'ionic-app-scripts watch' ]
12 silly lifecycle urano@0.0.1~watch: Returned: code: 1  signal: null
13 info lifecycle urano@0.0.1~watch: Failed to exec watch script
14 verbose stack Error: urano@0.0.1 watch: `ionic-app-scripts watch`
14 verbose stack Exit status 1
14 verbose stack     at EventEmitter.<anonymous> (C:\Users\nick\AppData\Roaming\npm\node_modules\npm\lib\utils\lifecycle.js:255:16)
14 verbose stack     at emitTwo (events.js:106:13)
14 verbose stack     at EventEmitter.emit (events.js:191:7)
14 verbose stack     at ChildProcess.<anonymous> (C:\Users\nick\AppData\Roaming\npm\node_modules\npm\lib\utils\spawn.js:40:14)
14 verbose stack     at emitTwo (events.js:106:13)
14 verbose stack     at ChildProcess.emit (events.js:191:7)
14 verbose stack     at maybeClose (internal/child_process.js:877:16)
14 verbose stack     at Process.ChildProcess._handle.onexit (internal/child_process.js:226:5)
15 verbose pkgid urano@0.0.1
16 verbose cwd C:\dev\UranoIonic
17 error Windows_NT 6.1.7601
18 error argv "C:\\Program Files\\nodejs\\node.exe" "C:\\Users\\nick\\AppData\\Roaming\\npm\\node_modules\\npm\\bin\\npm-cli.js" "run" "watch"
19 error node v6.9.1
20 error npm  v3.10.9
21 error code ELIFECYCLE
22 error urano@0.0.1 watch: `ionic-app-scripts watch`
22 error Exit status 1
23 error Failed at the urano@0.0.1 watch script 'ionic-app-scripts watch'.
23 error Make sure you have the latest version of node.js and npm installed.
23 error If you do, this is most likely a problem with the urano package,
23 error not with npm itself.
23 error Tell the author that this fails on your system:
23 error     ionic-app-scripts watch
23 error You can get information on how to open an issue for this project with:
23 error     npm bugs urano
23 error Or if that isn't available, you can get their info via:
23 error     npm owner ls urano
23 error There is likely additional logging output above.
24 verbose exit [ 1, true ]
ataraxus commented 8 years ago

This issue is quite long present, i believe after switching to webpack.

having it on my win7 machine:

$ ionic info

Your system information:

 ordova CLI: 6.4.0
Ionic Framework Version: 2.0.0-rc.3
Ionic CLI Version: 2.1.12
Ionic App Lib Version: 2.1.7
Ionic App Scripts Version: 0.0.46
ios-deploy version: Not installed
ios-sim version: Not installed
OS: Windows 7
Node Version: v6.9.1
Xcode version: Not installed
Simpler1 commented 8 years ago

Same as: #416 Unable to quit the build script like before

danbucholtz commented 8 years ago

@ataraxus, @Simpler1, we'll take a look. It definitely exits on Mac. Is there an easy way to validate on Windows?

ataraxus commented 8 years ago

Pretty easy just run ionic serve exit after its done via q or ctrl-c and have look at the task manager ctrl-shift-esc

ataraxus commented 8 years ago

@danbucholtz i investigated this further and have to correct my statement above. I dont get this if i use the default win7 CMD. i only get this if I use cygwin, which is a commonly used bash emulator for win7. nevertheless it used to work with cygwin before.

@nickwinger any chance that you are also using cygwin?

nickwinger commented 8 years ago

No, i'm running stock windows 7 command line

ataraxus commented 8 years ago

maybe this is some sort of race condition, i do have a quite underpowered machine ...

Marcus-L commented 7 years ago

Happens to me after CTRL-C'ing out of ionic run android --device -l

Here's ionic info:

Ionic Framework Version: 2.1.0
Ionic CLI Version: 2.2.1
Ionic App Lib Version: 2.2.0
Ionic App Scripts Version: 1.1.3
ios-deploy version: Not installed
ios-sim version: Not installed
OS: Windows 10
Node Version: v7.6.0
Xcode version: Not installed

If I do a ps -n node (powershell) right after CTRL-C:

PS C:\> ps -n node

Handles  NPM(K)    PM(K)      WS(K)     CPU(s)     Id  SI ProcessName
-------  ------    -----      -----     ------     --  -- -----------
   3382     197   498936     503724      18.36  20712   2 node
    201      20    38248      42644       0.53 106060   2 node

Sometimes there are 3 processes, sometimes 2. This is starting from a state where no oother apps are already running node processes.

barocsi commented 6 years ago

it's still spawning new and new processes as it refreshes the app...guys still not able to fix this after 2 years?

mansouryaacoubi commented 6 years ago

Issue still exists with Ionic 4.1.1, Windows 7, NodeJS v8.11.4

Have to kill all tasks in Windows via taskkill /F /IM node.exe

mansouryaacoubi commented 6 years ago

Thanks to a coworker I found out, that this issue seems to exist using a cygwin-terminal like babun or other. git bash and powershell do not encounter that problem.

aleksey-the-kid commented 6 years ago

Thanks to a coworker I found out, that this issue seems to exist using a cygwin-terminal like babun or other. git bash and powershell do not encounter that problem.

I am using git bash and Windows 10 -- issue is still present, so, I believe, this is not the case