httpd-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Hemant Chaudhary <hemantdude.chaudh...@gmail.com>
Subject Re: [users@httpd] Apache creates Semaphore
Date Thu, 02 Nov 2017 16:49:28 GMT
Hi Luca,

If I choose to go with MPM and to spawn single process then it will create
parent process and then child process where parent process monitor the
server and child process serve the request. But I need only one process
which works for both as parent and child which is achieved in httpd -X.
httpd -X creates one process which monitor apache as well as serves the
request.

Is it possible to disable mutex while configuring apache, so that it will
not create semaphores ?

Thanks
Hemant

On Thu, Nov 2, 2017 at 5:09 PM, Luca Toscano <toscano.luca@gmail.com> wrote:

> Hi Hemant,
>
> as indicated in https://httpd.apache.org/docs/2.4/mod/core.html#mutex you
> can use different kind of mutex implementations and experiment with them.
> From your description though it seems to me that your approach of killing
> httpd leads to semaphore leaking, something that would be avoided with a
> graceful shutdown. I would encourage you to not use httpd -X but to
> configure your mpm to spawn one process only (note that you might need
> svn.apache.org/r1748336 or httpd >= 2.4.21).
>
> Hope that helps,
>
> Luca
>
>
> 2017-11-02 12:08 GMT+01:00 Hemant Chaudhary <hemantdude.chaudhary@gmail.
> com>:
>
>> Hi Yann,
>>
>> For my product I need to run apache as single process. As httpd -X works
>> for me. But the issue is to stop httpd -X, we need to kill process. While
>> killing the process, semaphore exists in kernel directory.
>> If I repeat for 10-15 times, then it will give error like no space
>> available on device.
>> To solve this error, either I need to explicitly kill each semaphore id
>> and then start. So I thought not to create semaphore itself.
>> Therefore I commented following lines in worker.c
>>
>> if ((rv = SAFE_ACCEPT((apr_snprintf(id, sizeof id, "%i",
>> i),ap_proc_mutex_create(&all_buckets[i].mutex,NULL,
>> AP_ACCEPT_MUTEX_TYPE,  id, s, pconf, 0))))) {
>>            ap_log_error(APLOG_MARK, APLOG_CRIT | level_flags, rv,
>> (startup ? NULL : s),  "could not create accept mutex");
>>                  return !OK;
>>
>>  After commenting above line, when I am starting httpd -X, it is giving
>> signal 31 error. When starting with httpd, its only starting parent and
>> killing child processes with signal 31 error.
>>
>> What should I change if I want to start apache in debug mode and not to
>> create semaphore ?
>>
>> Thanks
>> Hemant
>>
>>
>>
>> On Thu, Nov 2, 2017 at 4:01 PM, Yann Ylavic <ylavic.dev@gmail.com> wrote:
>>
>>> Hi Hemant,
>>>
>>> On Thu, Nov 2, 2017 at 5:47 AM, Hemant Chaudhary
>>> <hemantdude.chaudhary@gmail.com> wrote:
>>> >
>>> > Semaphore is used in multi process environment to share resources
>>> within
>>> > processes. But when I am starting apache in debug mode i:e single
>>> process
>>> > then still it creates semaphore. May I know the reason why it is
>>> creating
>>> > semaphore in debug mode also.
>>>
>>> The debug mode has no particular code optimization or walkout,
>>> precisely because we want to be able to diagnose potential bugs for
>>> the non-debug case.
>>>
>>> Regards,
>>> Yann.
>>>
>>> ---------------------------------------------------------------------
>>> To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
>>> For additional commands, e-mail: users-help@httpd.apache.org
>>>
>>>
>>
>

Mime
View raw message