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

Have consistent way to terminate server across platforms #59

Closed
ahmetb opened this Issue Jul 1, 2014 · 7 comments

Comments

Projects
None yet
8 participants
@ahmetb

ahmetb commented Jul 1, 2014

I was trying to run ASP.NET web servers inside Docker containers using “k web” command, I realized that Microsoft.AspNet.Hosting waits for console input to terminate web server. (see this line https://github.com/aspnet/Hosting/blob/dev/src/Microsoft.AspNet.Hosting/Program.cs#L90 )

This is preventing the process inside Docker container to terminate when no stdin is attached. (workaround: if I run the container with -i, it works fine since it attaches a stdin).

I suggest removing this behavior, it doesn’t make sense to terminate upon stdin input, users always have Ctrl+C option to terminate and by convention, server applications are designed to be daemons and should not be interacting with STDIN.

@chriseldredge

This comment has been minimized.

Show comment
Hide comment
@chriseldredge

chriseldredge Jul 10, 2014

As a work-around, I created a shell script that behaves as a daemon and uses a fifo to cleanly shutdown the k process when it traps a SIGTERM and waits for k to exit.

https://gist.github.com/chriseldredge/37d41925fdddecea8517

Tested on OS X but haven't tried wiring it into Docker.

As a work-around, I created a shell script that behaves as a daemon and uses a fifo to cleanly shutdown the k process when it traps a SIGTERM and waits for k to exit.

https://gist.github.com/chriseldredge/37d41925fdddecea8517

Tested on OS X but haven't tried wiring it into Docker.

@ahmetb

This comment has been minimized.

Show comment
Hide comment
@ahmetb

ahmetb Jul 10, 2014

@chriseldredge awesome workaround!

ahmetb commented Jul 10, 2014

@chriseldredge awesome workaround!

@glennc glennc added the enhancement label Sep 12, 2014

@glennc glennc added this to the 1.0.0-beta1 milestone Sep 12, 2014

@glennc glennc added bug and removed enhancement labels Sep 12, 2014

@glennc glennc changed the title from Do not terminate server process with standard input to Have consistent way to terminate server across platforms Sep 12, 2014

@glennc

This comment has been minimized.

Show comment
Hide comment
@glennc

glennc Sep 12, 2014

Member

This will involve having a consistent way to handle ctrl + c across platforms

Member

glennc commented Sep 12, 2014

This will involve having a consistent way to handle ctrl + c across platforms

@borgdylan

This comment has been minimized.

Show comment
Hide comment
@borgdylan

borgdylan Oct 8, 2014

It can be done using pure managed code if I am not wrong.

It can be done using pure managed code if I am not wrong.

@Eilon

This comment has been minimized.

Show comment
Hide comment
@Eilon

Eilon Oct 20, 2014

Member

Beta2

Member

Eilon commented Oct 20, 2014

Beta2

@Eilon Eilon modified the milestones: 1.0.0-beta1, 1.0.0-beta2 Oct 20, 2014

@directhex

This comment has been minimized.

Show comment
Hide comment
@directhex

directhex Jan 12, 2015

@chriseldredge your daemon works in Docker, though it requires the "ps" command be installed, which it may not be (e.g. it isn't in the Microsoft ASP.NET vNext Docker image - RUN apt-get install procps)

@chriseldredge your daemon works in Docker, though it requires the "ps" command be installed, which it may not be (e.g. it isn't in the Microsoft ASP.NET vNext Docker image - RUN apt-get install procps)

@davidfowl

This comment has been minimized.

Show comment
Hide comment
@davidfowl

davidfowl May 12, 2015

Member

This is finally done e19289f. We now rely on ctrl + c across the board (SIGINT on mono and likely on coreclr xplat).

Member

davidfowl commented May 12, 2015

This is finally done e19289f. We now rely on ctrl + c across the board (SIGINT on mono and likely on coreclr xplat).

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