httpd-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Zisis Lianas <Zisis.Lia...@consol.de>
Subject Re: httpd 2.4.2 - mod_proxy id name not unique
Date Wed, 12 Sep 2012 14:03:00 GMT
Ok, got it. So I will have to change the solution for 2.4 as
Jim described it (/var/shared/logs/system1, /var/shared/logs/system2, ...).

Jeff, Jim, thanks for your feedback.


----- Original Message -----
From: "Jeff Trawick" <trawick@gmail.com>
To: dev@httpd.apache.org
Sent: Wednesday, September 12, 2012 3:45:44 PM
Subject: Re: httpd 2.4.2 - mod_proxy id name not unique

On Wed, Sep 12, 2012 at 9:31 AM, Zisis Lianas <Zisis.Lianas@consol.de> wrote:
> That's right, Jeff, that's exactly what I want.
>
> For other directives we never had collisions with a shared
> runtime directory (2.0 and 2.2), since we could differ by hostname:
>  PidFile ${project_home}/logs/apache/${hostname}.httpd.pid
>  CustomLog ${project_home}/logs/apache/${hostname}.access_log combined env=!dontlog
>  ErrorLog ${project_home}/logs/apache/${hostname}.error_log

I don't think that exact pattern is going to be possible with all
run-time files.  It should be easy enough to make ${hostname} refer to
a directory, at which point DefaultRuntimeDir fits in.

There's an ever-growing set of run-time files, and traditionally these
were inconsistent in their default location (/tmp?
DEFAULT_RUNTIME_DIR?  logs?), configurability (related directive or
not), and instance-specific naming (including pid in the filename or
not).  It isn't practical for us to continue with the endless
configuration of each individual item, and DefaultRuntimeDir should be
the way these are configured* when a single compiled-in directory
isn't appropriate.

Run-time files are special in that they often need to be moved as a
group to a different filesystem because of the filesystem
implementation (e.g., move way from some shared filesystem that
doesn't implement locking or Unix sockets, move to a RAM-based
filesystem for speed and automatic cleanup on reboot, whatever).
DefaultRuntimeDir makes that easy.

*Unfortunately, DefaultRuntimeDir isn't respected throughout 2.4.x.
There are even a few run-time files in trunk that don't respect it.


>
>
> ----- Original Message -----
> From: "Jeff Trawick" <trawick@gmail.com>
> To: dev@httpd.apache.org
> Sent: Wednesday, September 12, 2012 2:53:38 PM
> Subject: Re: httpd 2.4.2 - mod_proxy id name not unique
>
> On Wed, Sep 12, 2012 at 8:40 AM, Zisis Lianas <Zisis.Lianas@consol.de> wrote:
>> That's right, but on shared filesystems, "DefaultRuntimeDir"
>> (logs/) and the non-unique shm-filenames state a problem.
>
> Clarification: Do you want multiple web server instances to share the
> same runtime directory without collisions of individual files in that
> directory?
>
>> So what do you think about a shm-file-target-directory directive?
>>
>>
>> ----- Original Message -----
>> From: "Jim Jagielski" <jim@jaguNET.com>
>> To: dev@httpd.apache.org
>> Sent: Wednesday, September 12, 2012 2:28:07 PM
>> Subject: Re: httpd 2.4.2 - mod_proxy id name not unique
>>
>> Yes, that's the reason why the location of the file can be
>> user selectable. There's no need to adjust the name when you
>> can adjust the location/path.
>>
>> On Sep 12, 2012, at 7:00 AM, Zisis Lianas <Zisis.Lianas@consol.de> wrote:
>>
>>> Currently the default location of the slotmem file
>>> is the "DefaultRuntimeDir", since on slotmem creation
>>> only the "conf->id" is defined as filename:
>>> modules/proxy/mod_proxy_balancer.c, 762:
>>> rv = storage->create(&new, conf->id,
>>>                     ALIGNED_PROXY_BALANCER_SHARED_SIZE,
>>>                     conf->max_balancers, AP_SLOTMEM_TYPE_PREGRAB, pconf);
>>>
>>> modules/slotmem/mod_slotmem_shm.c, 275:
>>> fname = slotmem_filename(pool, name);
>>>
>>> modules/slotmem/mod_slotmem_shm.c, 137:
>>> const char *filenm = apr_pstrcat(pool, DEFAULT_SLOTMEM_PREFIX,
>>>                                 slotmemname, DEFAULT_SLOTMEM_SUFFIX, NULL);
>>>
>>>
>>> There is no possibility to customize the shm-filename
>>> resp. the shm-target-directory. Thats a big issue when
>>> working with shared filesystems.
>>>
>>> So my idea was to define some shm-target-directory and
>>> slotmemname-prefix in httpd.conf. So e.g. when shm-target-directory
>>> is /shared-fs/logs/shm/ and slotmemname-prefix is `hostname`
>>> (exported as shell variable), the final shm file would be
>>> /shared-fs/logs/shm/slotmem-shm-myhostname-sbf751527.shm.
>>>
>>>
>>>
>>> ----- Original Message -----
>>> From: "Jim Jagielski" <jim@jaguNET.com>
>>> To: dev@httpd.apache.org
>>> Sent: Tuesday, September 11, 2012 6:16:08 PM
>>> Subject: Re: httpd 2.4.2 - mod_proxy id name not unique
>>>
>>> I have to admit, I never really considered that case, but can't
>>> you simply change the default location of the slotmem on one?
>>>
>>> On Sep 11, 2012, at 10:01 AM, Zisis Lianas <Zisis.Lianas@consol.de> wrote:
>>>
>>>> Hi Jim,
>>>>
>>>> what do you think about the suggested directives of
>>>> "ProxyConfigIdPrefix" and "BalancerSlotmemDir"?
>>>> (any other way to solve this problem is also welcome)
>>>>
>>>>
>>>> Today I just ran into the same problem with httpd-2.4.3.
>>>> The apache config/logs directory is shared (NFS) on two
>>>> servers - when trying to restart both apache instances
>>>> at same time, the last one throws an error:
>>>> [proxy_balancer:debug] mod_proxy_balancer.c(760): AH01178: Doing balancers
create: 544,1 (6)
>>>> [slotmem_shm:debug] mod_slotmem_shm.c(300): AH02300: create /apache/logs/slotmem-shm-sbf751527.shm:
544/6
>>>> [proxy_balancer:emerg] (17)File exists: AH01179: balancer slotmem_create
failed
>>>>
>>>> When I restart this instance when the first one is up,
>>>> the restart is successful.
>>>>
>>>>
>>>> regards,
>>>> Zisis
>>>>
>>>> ----- Original Message -----
>>>> From: "Jim Jagielski" <jim@jaguNET.com>
>>>> To: dev@httpd.apache.org
>>>> Sent: Tuesday, May 1, 2012 8:43:46 PM
>>>> Subject: Re: httpd 2.4.2 - mod_proxy id name not unique
>>>>
>>>> Let me look into that... iirc, it was due to us wanting to
>>>> be able to persist data between restarts and using the time
>>>> as part of the id prevented that. But I could be mis-remembering.
>>>>
>>>> On Apr 30, 2012, at 7:50 AM, Zisis Lianas wrote:
>>>>
>>>>> hi,
>>>>>
>>>>> when mod_proxy currently is generating his "id", the name
>>>>> of this id is not very unique. So if you have a shared config/
>>>>> logs dir for more instances, the slotmem-shm files generated in
>>>>> DefaultRuntimeDir are the same. Bit unlucky if working with shared
>>>>> file systems.
>>>>>
>>>>> In httpd-2.4.2/modules/proxy/mod_proxy.c line 1146 I can see
>>>>> the following code:
>>>>> #if 0
>>>>>  id = ap_proxy_hashfunc(apr_psprintf(p, "%pp-%" APR_TIME_T_FMT, ps, apr_time_now()),
PROXY_HASHFUNC_DEFAULT);
>>>>> #else
>>>>>  id = ap_proxy_hashfunc(apr_psprintf(p, "%pp", ps), PROXY_HASHFUNC_DEFAULT);
>>>>> #endif
>>>>>
>>>>> Primarily checked in with
>>>>> http://svn.apache.org/viewvc/httpd/httpd/trunk/modules/proxy/mod_proxy.c?r1=1065749&r2=1065748&pathrev=1065749
>>>>>
>>>>>
>>>>> If activating the first ap_proxy_hashfunc call, the generated names
>>>>> seem to be unique. Is there any reason this code is not used? Maybe
>>>>> we can set the "timed" version as default?
>>>>>
>>>>>
>>>>>
>>>>> best regards,
>>>>> Zisis
>>>>>
>>>>
>>>
>>
>
>
>
> --
> Born in Roswell... married an alien...
> http://emptyhammock.com/



-- 
Born in Roswell... married an alien...
http://emptyhammock.com/

Mime
View raw message