1

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!

user125756
  • 183
  • 6

1 Answers1

2

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% ;)

user125756
  • 183
  • 6