I have been looking at this for quite a while. We run a server that has multiple Docker containers, one of them has a Mono server application written in c#.

The base image is phusion base (http://phusion.github.io/baseimage-docker/)

This is working well up until now, this evening, we suddenly started seeying huge CPU spikes, slowing down our entire website, even making it completely inaccesible.

I haven't changed anything whatsoever since a week or so. I highly doubt this issue came because of a source code error. Also the same app (as in exactly the same executable) works fine on the same server outside docker or on my mac. Things I have tried:

  • Running app on my local computer (worked, no cpu spikes)
  • Running app outside docker (but on the same server) (worked with no cpu spikes)
  • Rebuilding image without cache (didnt work)

See Screenshot of our process tree: enter image description here

If anyone can help us that would be awesome! I'm more than willing to give any more details ;) Thanks a lot in advance!


Ok I found it! Appearantly the process was stuck in a while loop because it as listening for commands in stdin.

The CPU spikes were always there, but we never noticed (up until we did a bigger test with more people on the site) so after searching, I found you can do this to 'close' the stdin to make sure it wont keep reading for data in the background:

read x < /dev/fd/1 | <command>

Where command is your command that is spiking the cpu.

For me the complete command was:

cd /opt/SteamBot && read x < /dev/fd/1 | mono --debug SteamBot.exe

CPU now went down to 7% ;)

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.