Apache leaks semaphores when mod_mono starts

I am running an ASP.NET MVC2 application in mod_mono with mono 2.8.1 and currently have to periodically clean up semaphore arrays that apache seems to leak.

I started with mono rpm over 2.6.7 a ago, but had some problems like leaking semaphore arrays (i.e. more and more accumulated in ipcs ) and some incompatibility with ASP.NET MVC2, so I built 2.8 from the source. The leak continued, so I just built 2.8.1 from the source, and the same thing is still happening. This is on Amazon AMA (I think it's centos under the hood). Symptoms are that semaphore arrays continue to grow, and if I do not delete them manually using ipcrm , then after a while requests to ASP.NET pages return content without error in the logs. I also reproduced the same problem in centos 5.4 AMI.

Does anyone successfully run ASP.NET under apache / mod_mono and am I just running into some kind of extreme case? Since I cannot find any mention of this, I believe that this is not a common ASP.NET error. Any ideas how I can fix this problem further?

+4
source share
3 answers

I finally figured it out, and while the solution reveals my own mistake, not following the other warning I received, I believe this should be useful for someone else running into it.

By default, apache configuration has the following configuration order:

Include conf.d/*.conf User apache Group apache 

those. all conf files (usually where vhosts are defined) are loaded before the user and the httpd group are installed. This will result in a warning below:

 [Mon Jan 24 00:12:50 2011] [crit] The unix daemon module not initialized yet. Please make sure that your mod_mono module is loaded after the User/Group directives have been parsed. Not initializing the dashboard. 

While everything seems to be working anyway, this is causing the semaphore to leak. If you move Include after User/Group , the warning disappears, and mod_mono no longer loses semaphores.

+8
source

I saw this with shared memory used by cross processes.

My fix was to set MONO_DISABLE_SHM = 1, however, I'm not sure if this is your problem, since cross process descriptor support has been disabled since 2.8.

Perhaps you can still try MONO_DISABLE_SHM to see if it matters.

+1
source

Try using the new sgen garbage collector instead of Boehm.

To use the new garbage collector, you just need to call Mono using the --gc = sgen command line option or set the MONO_ENV_OPTIONS environment variable containing the "--gc = sgen" option. By default, Mono continues to use the Boehm collector.

0
source

Source: https://habr.com/ru/post/1334170/


All Articles