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

Stop one off Dyno with custom Type #57

Open
AaronCowan opened this issue Jan 31, 2017 · 5 comments
Open

Stop one off Dyno with custom Type #57

AaronCowan opened this issue Jan 31, 2017 · 5 comments
Labels

Comments

@AaronCowan
Copy link

AaronCowan commented Jan 31, 2017

Potential Bug
Start a one-off dyno with this command

heroku.dyno.create(heroku_app, {command: "while :; do echo 'hit ctrl-c'; sleep 1; done", type: "test"})

Heroku logs this:

app[api]: Starting process with command 'while :; do echo 'hit ctrl-c'; sleep 1; done' by user

But this Dyno is not killed with the command

heroku.dyno.restart(heroku_app, "test.1234") # assuming the Dyno name is test.1234 Returned is an empty hash {}

Stopping with heroku ps:stop test.1234 works

This does not occur if you do not specify the "type" during the create call. For example, you can kill a one-off Dyno that is named something like run.1234

@geemus
Copy link
Contributor

geemus commented Feb 3, 2017

Thanks for the detailed report. It looks like, underneath the covers there is special branching behavior for restart which is based on the type string (so if it is run, it does something different). Which I think is likely to explain the problem you are seeing.

The most direct way to avoid this, as you might imagine, is to simply omit the type so that it will be set to run (or explicitly set it that way).

Alternatively, there is a way in the API to explicitly initiate a stop, which would utilize POST /apps/{app-identifier}/dynos/{dyno-identifier}/actions/stop. This is documented in the API docs here, but for reasons that are not totally clear to me doesn't automatically get added to this client.

There may be worth further/deeper investigation, but for now hopefully that clears up your confusion and gives you some clearer workaround.

@AaronCowan
Copy link
Author

@geemus Thanks for the response. I appreciate it.

@geemus geemus added the bug label May 1, 2017
@glorkio
Copy link

glorkio commented Feb 14, 2018

POST /apps/{app-identifier}/dynos/{dyno-identifier}/actions/stop will idle a dyno. How do I actually delete the dyno using the platform API (ie., the equivalent of "heroku ps:scale web=0")?

@mikehale
Copy link
Contributor

@glorkio you update the formation. BTW a great way to explore what the CLI is doing is to use HEROKU_DEBUG=1, so HEROKU_DEBUG=1 heroku ps:scale web=0

@glorkio
Copy link

glorkio commented Feb 14, 2018

Thank you for your doubly helpful reply!

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

No branches or pull requests

4 participants