This 100% CPU issue has been lingering for a very long time now. I'm getting close to identifying the problem. At first I had MONO taking 100% CPU on a Ubuntu server. I re-installed a fresh new server on Debian and had the same problem. Tried many different versions of MONO; problem somehow went away in v5.0 and came back in a later version.
I created a server clone and disabled all websites but one. The issue ONLY happens if the website is configured for MONO and has a sub-folder configured for PHP!
To reproduce the problem
Running Debian 8, MONO 5.4.1.7 (latest, tried many versions)
Running a single website under apache with this config
<VirtualHost *:80>
ServerName www.spiritualselftransformation.com
ServerAlias spiritualselftransformation.com
DocumentRoot /var/www/spiritualselftransformation
Redirect permanent / https://www.spiritualselftransformation.com/
</VirtualHost>
<VirtualHost *:443>
ServerName spiritualselftransformation.com
ServerAlias www.spiritualselftransformation.com
DocumentRoot /var/www/spiritualselftransformation
DirectoryIndex default.aspx index.aspx index.php index.html
<IfModule mod_mono.c>
MonoServerPath spiritualselftransformation.com "/usr/bin/mod-mono-server4"
MonoApplications spiritualselftransformation.com "/:/var/www/spiritualselftransformation"
</IfModule>
<Location "/">
Allow from all
Order allow,deny
<IfModule mod_mono.c>
MonoSetServerAlias spiritualselftransformation.com
SetHandler mono
</IfModule>
SetOutputFilter DEFLATE
SetEnvIfNoCase Request_URI "\.(?:gif|jpe?g|png)$" no-gzip dont-vary
</Location>
# Problem disappears if you comment this section!
<Location "/blog">
SetHandler None
AddHandler application/x-httpd-php .php
</Location>
SSLEngine on
SSLCertificateFile /etc/apache2/SSL-KEYS/www.spiritualselftransformation.com/www_spiritualselftransformation_com.2016-2019.crt
SSLCertificateKeyFile /etc/apache2/SSL-KEYS/www.spiritualselftransformation.com/privateKey.key
SSLCertificateChainFile /etc/ssl/certs/comodo.bundle
</VirtualHost>
Then simply type "sudo service apache2 reload" and "htop". Repeat a few times and the CPU will stick at 100% when sub-folder is configured for PHP. Note that the website code hasn't even run nor compiled yet.
If I comment the PHP sub-folder section, I am unable to reproduce the issue. When reloading apache2, sometimes MONO starts and ends instantly, sometimes it takes 10 second, and sometimes it stays at 100% CPU for up to 2 minutes (??) but it always ends eventually. With the PHP sub-folder section, sooner or later, the CPU will peak at 100% and remain there until the process is killed.
This is definitely a bug in MONO... it's surprising not more people have reported it, and that it remained for so many versions.
Now how can I fix or work-around the issue?
EDIT: next morning, the server with only 1 website active and with the blog subsection commented went into 100% CPU as well. Now that's a basic single website on a fresh OS. How come not everybody is getting that issue?