Skip to content
This repository has been archived by the owner on Dec 19, 2018. It is now read-only.

Have consistent way to terminate server across platforms #59

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

Have consistent way to terminate server across platforms #59

ahmetb opened this issue Jul 1, 2014 · 7 comments
Assignees
Milestone

Comments

@ahmetb
Copy link

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
Copy link

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
Copy link
Author

ahmetb commented Jul 10, 2014

@chriseldredge awesome workaround!

@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 Do not terminate server process with standard input Have consistent way to terminate server across platforms Sep 12, 2014
@glennc
Copy link
Member

glennc commented Sep 12, 2014

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

@borgdylan
Copy link

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

@Eilon
Copy link
Member

Eilon commented Oct 20, 2014

Beta2

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

@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
Copy link
Member

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 subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

8 participants