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" <j...@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.lia...@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" <j...@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
>> 
> 

Reply via email to