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

ng serve proper way to stop how in ubuntu #8734

Closed
sambanthar opened this issue Dec 4, 2017 · 13 comments
Closed

ng serve proper way to stop how in ubuntu #8734

sambanthar opened this issue Dec 4, 2017 · 13 comments
Labels
needs: more info Reporter must clarify the issue

Comments

@sambanthar
Copy link

even i use ctrl + c its terminated but still 4200 is running port.

Port 4200 is already in use. Use '--port' to specify a different port.

@clydin clydin added the needs: more info Reporter must clarify the issue label Dec 4, 2017
@clydin clydin self-assigned this Dec 4, 2017
@clydin
Copy link
Member

clydin commented Dec 4, 2017

Terminating the process is the generally accepted method to stop the development server. This may be OS related.
However, without the information requested in the issue template further analysis is not really possible.

@cedvdb
Copy link

cedvdb commented Dec 5, 2017

@sambanthar You have to check if something is running on your port 4200.

@sambanthar
Copy link
Author

if i use ctrl + c in a windows machine its ask me to terminate yes / no.

but in ubuntu machine i use it ctrl + c its nothing ask nothing show . but i use ng serve 4200 is already in use.

what i am asking very simple i use ng serve -o to run the development server how to stop serving

@clydin
Copy link
Member

clydin commented Dec 21, 2017

What you are doing is appropriate to stop the development server.
If you are still encountering this issue please open a new issue with the full issue template details so that further assistance can be provided if possible.

@clydin clydin closed this as completed Dec 21, 2017
@caviroski
Copy link

webpack: Compiled successfully.
^C
[1]+ Killed: 9 ng serve

webpack: Compiled successfully.
^Z
[1]+ Stopped ng serve

If you use Ctrl+Z in Mac you will have ´Port 4200 is already in use. Use '--port' to specify a different port.´later.

@sambanthar
Copy link
Author

@caviroski this is the same issue i am facing in ubuntu machine

@alex88
Copy link

alex88 commented Feb 20, 2018

@clydin I have the same issue, I've installed angular-cli, created a new project and every time I run yarn start (which runs ng serve) trying to close the server with ctrl-c isn't enough, even after doing ctrl-c (while server is idle and not compiling) the process keeps running.
I've to manually do killall ng to close it.

Pstree shows this while server is running:

 |     \-+= 26715 alex /bin/zsh -l
 |       \-+= 29424 alex node /usr/local/Cellar/yarn/1.3.2/libexec/bin/yarn.js start
 |         \-+- 29425 alex ng
 |           \--- 29427 alex /usr/local/Cellar/node/9.5.0/bin/node /Users/alex/Projects/xxx/node_modules/@ngtools/webpack/src/type_checker_worker.js 9d93e901-158a-4cf9-ba1b-2f0582ffcfeb

after ctrl-c the shell (process 26715) doesn't have any child running, while the ng process is running alone as the same PID but just child of PID 00001.

File watcher is still watching files and if I save one I get (in the previous shell):

Date: 2018-02-20T06:04:50.302Z - Hash: 3e9f3ccb9b5102205767 - Time: 746ms
5 unchanged chunks

WARNING in AngularCompilerPlugin: Forked Type Checker exited unexpectedly. Falling back to type checking on main thread.

webpack: Compiled with warnings.

I'm using OSX 10.13.3 and Node 9.5.0, angular-cli 1.7.0

Let me know if you need further debugging and ore something else

UPDATE: nvm just seen #9647

@JohannesRudolph
Copy link
Contributor

We have discovered the same issue after some recent angular cli or related depdency upgrade. I vote for reopening this issue.

We can for sure say that the ng process used to exit properly when it received a SIGINT and the type_checker_worker.js childprocess was not there. Now we have the type_checker_worker.js process and it leaves the ng process dangling on exit (and hence keeps on hogging the port).

@JohannesRudolph
Copy link
Contributor

I've discovered some more... when I call ng serve directly from bash, I have no problems exiting it with Ctrl+C. However, we typically invoke ng serve from a nodejs script as a node child_process.

Again, this used to work previously and now it doesn't anymore.

@olcaydaser
Copy link

After Ctrl+C, fuser -k 4200/tcp(https://stackoverflow.com/a/48145559) command works for me to kill 4200 port, and use "ng serve" command to compile it again. 👯‍♂️

@ayushnigamsworld
Copy link

On CentOS, pkill -9 ng should be the apt way I suppose.

@consman
Copy link

consman commented Dec 24, 2018

They should have something like
ng serve --stop
Ctrl-C seems somewhat crude to stopping any process.
Have I been stuck in back end java for too long?

@angular-automatic-lock-bot
Copy link

This issue has been automatically locked due to inactivity.
Please file a new issue if you are encountering a similar or related problem.

Read more about our automatic conversation locking policy.

This action has been performed automatically by a bot.

@angular-automatic-lock-bot angular-automatic-lock-bot bot locked and limited conversation to collaborators Sep 9, 2019
@clydin clydin removed their assignment Jun 28, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
needs: more info Reporter must clarify the issue
Projects
None yet
Development

No branches or pull requests

9 participants