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

Sending intr (ctrl + c / interrupt) to ember serve doesn't fully terminate the app #8969

Open
pichfl opened this issue Dec 19, 2019 · 22 comments

Comments

@pichfl
Copy link
Contributor

pichfl commented Dec 19, 2019

Sending ctrl + c to a running ember serve should terminate the server and running ember-cli instance, but for some reason it does not completely clean up after itself and leaves my command prompt in an unfinished state, making it necessary for me to press return to actually get back to my regular prompt.

source/project on 🌱 master [$] via ⬢ v12.13.1 took 3s
❯ yarn start

(Ember project runs as expected)

ctrl + c

cleaning up...
⠋ cleaning up⏎

source/project on 🌱 master [$] via ⬢ v12.13.1 took 3s
_

("❯ " character missing, no more autocompletion from my shell, etc)

I'm using fish, but the same thing happens on zsh and bash, both with my current prompt enabled and disabled.

It's really annoying and I wonder if it breaks more stuff beyond just me having to remember to do the extra key press which resets my prompt like that:

source/project on 🌱 master [$] via ⬢ v12.13.1 took  49s


source/project on 🌱 master [$] via ⬢ v12.13.1 took  49s
❯

source/project on 🌱 master [$] via ⬢ v12.13.1 took  49s
❯

Output from ember version --verbose && npm --version && yarn --version:

ember-cli: 3.14.0
node: 12.4.0
v8: 7.4.288.27-node.18
uv: 1.29.1
zlib: 1.2.11
brotli: 1.0.7
ares: 1.15.0
modules: 72
nghttp2: 1.38.0
napi: 4
llhttp: 1.1.3
http_parser: 2.8.0
openssl: 1.1.1b
cldr: 35.1
icu: 64.2
tz: 2019a
unicode: 12.1
os: darwin x64
6.12.1
1.21.1
@rwjblue
Copy link
Member

rwjblue commented Dec 19, 2019

@pichfl - Can you help us track this down by providing as close to step by step instructions on reproducing? My guess is that ora isn't being reset properly in all pathways, but a repro will really help.

I also use starship for my prompt atm, so hopefully I'll be able to get this to reproduce.

@runspired
Copy link
Contributor

I've been experiencing this for the last few versions, probably should have reported it, but many of the apps I work on do crazy things so it took me a while to realize I hit it with new apps too.

@pichfl
Copy link
Contributor Author

pichfl commented Dec 19, 2019

I tried in the snippets above, it happens anytime I run an Ember project and stop it via ctrl+c.

It doesn't matter if I enable starship or not. I tested bash, zsh, fish. Each with and without starship and each on both Terminal.app and iTerm.

If it helps, these are the devDependencies in one of the projects:

    "@ember/optional-features": "^1.1.0",
    "@ember/render-modifiers": "1.0.2",
    "@fullhuman/postcss-purgecss": "^1.3.0",
    "@glimmer/component": "1.0.0",
    "@jaames/iro": "^4.5.3",
    "@mapbox/mapbox-sdk": "^0.9.0",
    "@sentry/browser": "^5.10.2",
    "@sentry/integrations": "^5.10.2",
    "@turf/circle": "^6.0.1",
    "babel-eslint": "^10.0.3",
    "broccoli-asset-rev": "^3.0.0",
    "date-fns": "^2.8.1",
    "ember-auto-import": "^1.5.3",
    "ember-cli": "~3.14.0",
    "ember-cli-app-version": "^3.2.0",
    "ember-cli-babel": "^7.13.2",
    "ember-cli-dependency-checker": "^3.2.0",
    "ember-cli-deprecation-workflow": "^1.0.1",
    "ember-cli-document-title-northm": "^1.0.3",
    "ember-cli-eslint": "^5.0.0",
    "ember-cli-htmlbars": "^4.2.0",
    "ember-cli-inject-live-reload": "^2.0.2",
    "ember-cli-postcss": "^5.0.0",
    "ember-cli-sri": "^2.1.1",
    "ember-cli-template-lint": "^1.0.0-beta.1",
    "ember-cli-uglify": "~3.0.0",
    "ember-concurrency": "machty/ember-concurrency#mf-avoid_double_compute_assertion",
    "ember-data": "3.14.0",
    "ember-data-storefront": "^0.17.1",
    "ember-export-application-global": "^2.0.1",
    "ember-fetch": "^7.0.0",
    "ember-focus-trapper": "^0.3.0",
    "ember-hbs-minifier": "^0.4.1",
    "ember-intl": "^4.2.2",
    "ember-load-initializers": "^2.1.1",
    "ember-maybe-import-regenerator": "^0.1.6",
    "ember-qunit": "^4.6.0",
    "ember-radio-button": "^2.0.1",
    "ember-resolver": "^6.0.0",
    "ember-router-scroll": "~1.3.3",
    "ember-set-helper": "^0.1.1",
    "ember-simple-auth": "~2.1.0",
    "ember-simple-auth-token": "^4.0.7",
    "ember-source": "3.15.0",
    "ember-truth-helpers": "^2.1.0",
    "eslint": "^6.7.2",
    "eslint-plugin-ember": "^7.7.2",
    "eslint-plugin-node": "^10.0.0",
    "jwt-decode": "^2.2.0",
    "konva": "^4.0.18",
    "loader.js": "^4.7.0",
    "marked": "^0.8.0",
    "moment": "^2.24.0",
    "normalize.css": "^8.0.1",
    "nouislider": "^14.1.0",
    "pikaday": "^1.8.0",
    "postcss-import": "^12.0.1",
    "postcss-preset-env": "^6.7.0",
    "prettier": "^1.19.1",
    "qunit-dom": "^0.9.2",
    "tailwindcss": "^1.1.4",
    "webfontloader": "^1.6.28"

@ro0gr
Copy link
Contributor

ro0gr commented Dec 19, 2019

Have you tried to reproduce it with a new app, so we can understand if that's related to some extra dependency or comes by default?

@pichfl
Copy link
Contributor Author

pichfl commented Dec 19, 2019

Sure. Just did. Happens with a new project as well when using ember-cli @ 3.10, 3.11, 3.12, 3.13 and 3.14 (didn't check canary/betas).

@runspired
Copy link
Contributor

I've had it on a new app with betas recently

@ro0gr
Copy link
Contributor

ro0gr commented Dec 20, 2019

ok, I found it reproduces to me when I run it via yarn start. Doing npm start and ember s works as expected for me. Can you please confirm it happens only via yarn start, or is it also a case for ember s on your end?

upd: yes, I can see you provide examples with yarn start in your description. So I assume we have the same issue.

@pichfl
Copy link
Contributor Author

pichfl commented Dec 21, 2019

Happens using globally installed (using Volta) ember-cli, also. ember serve results in the same problems.

@pichfl
Copy link
Contributor Author

pichfl commented Jan 19, 2020

Is there any way to help with this? I'm not even sure where to look in the first place.

@rwjblue
Copy link
Member

rwjblue commented Feb 11, 2020

In general, I would guess this would be the result of a missign ui.stopProgress (which is provided by ora via console-ui), but a quick search (comparing startProgress calls and stopProgress calls) doesn't make it obvious which one is not being stopped.

@pichfl
Copy link
Contributor Author

pichfl commented Feb 11, 2020

Would it be a bad idea to just throw in something like this?

process.on('SIGINT', () => {
  ui.stopProgress(); 
});

Edit This might not work on Windows, but I'm not sure if it's a problem there in the first place.

Copy link
Member

rwjblue commented Feb 11, 2020

Does that fix the issue you are seeing?

@pichfl
Copy link
Contributor Author

pichfl commented Feb 11, 2020

No idea, I haven't worked on ember-cli in some time and I do not have it set up for development yet. I just remember using something like that in an internal tool I made years ago.

pichfl added a commit to pichfl/console-ui that referenced this issue Feb 11, 2020
I'm pretty sure this is the wrong way of solving this, but it *does* solve ember-cli/ember-cli#8969 to some extend.
@pichfl
Copy link
Contributor Author

pichfl commented Feb 11, 2020

Did some digging, made a PR for a possible fix. It's most likely that this is the wrong way of fixing the issue, but I wanted to get it out there so someone can find the correct place.

@stefanpenner
Copy link
Contributor

stefanpenner commented Feb 28, 2020

If you run serve and wait until the build has completed, this can be triggered when using yarn.

  1. works fine: ember s, build completes, control-c returns control to shell
  2. works fine: npm start, build completes, control-c returns control to shell
  3. funky behavior: yarn start, build completes, control-c` returns control to shell

Interesting, when trying to see if this is just a yarn start thing, it doesn't appear to be, as the following appears to work fine.

"scripts": {
  "start": "node -e 'while(true) { }'",
}

It may be worth trying a minimal script, that starts of console-ui and kicks of progress on ctrl-c, and ends exists 1s later. Such an isolated example would be useful.

@pichfl
Copy link
Contributor Author

pichfl commented Mar 1, 2020

Can confirm observations by @stefanpenner in a fresh project I started today (ember-cli 3.16.0).

@chrism
Copy link
Contributor

chrism commented Apr 4, 2020

Same, just had the same experience with a brand new install.

ember s cleans up correctly, whereas yarn start hangs on cleaning up and I have to ctrl+c again.

One thing to add — I only used yarn start because the install prompt ended with

🎉  Successfully created project my-app.
👉   Get started by typing:

  $ cd my-app
  $ yarn start

But leads to a slightly disappointing first experience. Maybe just changing the wording from yarn start to ember serve could be enough until it's resolved?!

@stefanpenner
Copy link
Contributor

stefanpenner commented Apr 15, 2020

Debugging the same issue again today, this is almost certainly a yarn issue. I don't believe we can do anything from our side here, at-least to address the general case of the parent process not waiting for the child to exit correctly.

Copy link
Member

rwjblue commented Apr 15, 2020

Ya. 😭

I think at this point we should remove the suggestion to use yarn start. 🤔

@chrism
Copy link
Contributor

chrism commented Aug 5, 2020

Just to give an update on this issue.

I’ve just updated everything to the latest versions...

  • node [v12.18.3]
  • npm [6.14.6]
  • yarn [1.22.4]
  • ember-cli [3.20.0]

os: darwin x64

And am still getting the same hang when cleaning up

cleaning up...
⠋ cleaning up

chrism added a commit to chrism/ember-cli that referenced this issue Aug 5, 2020
This is a simple fix to solve the issue outlined here:
ember-cli#8969

@rwjblue recommended this.
@chrism chrism mentioned this issue Aug 5, 2020
@dexter-dz
Copy link

Oof this issue is still going on.

I have nothing to add. WHenever you invoke any amber CLI commands even ember s or ember --help and then press ctrl+c it fails to kill it and return to shell.

screenshot attached below.
image

locks pushed a commit to chrism/ember-cli that referenced this issue Jan 10, 2022
This is a simple fix to solve the issue outlined here:
ember-cli#8969

@rwjblue recommended this.
@locks locks added this to Needs Contributor in Triaging Jan 19, 2022
@locks locks moved this from Needs Contributor to INBOX in Triaging Jan 20, 2022
@bertdeblock
Copy link
Contributor

bertdeblock commented Jun 27, 2022

The same thing happens when using pnpm v7.1.9 (pnpm start). Either something's wrong with both yarn and pnpm or the issue is with ember-cli itself.

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

No branches or pull requests

9 participants