Hello again, I can finally come up with a patch (attached) that solves the issue for me. Anyone mind to point out potential concerns regarding the patch?
Explanation: After some debugging-mess with printing the memory addresses, I noticed that the workers grab a slot even if they did that before in the iteration for the first virtual host - reassigning and thus wasting the old value of worker->s. I thus wanted to check whether worker->s is the unshared initial memory subject to be replaced or a SHM already. As I did not find any suitable flag, I managed it using storage->dptr() and the index (which is 0 for the initial, private memory). It is now the first time that I can use httpd > 2.3.16 with balancers and more than one virtual host. Kind regards, Florian Schröder Am Donnerstag, den 23.02.2012, 19:23 +0100 schrieb f_los_ch: > Hi together, > > I'm trying to get my reverse-proxy running with the new httpd 2.4.1, > that aborts now with "worker slotmem_grab failed". > > When looking at mod_proxy_balancer: > > It looks like each balancer creates the SHM for its number of workers (1 > in my case) using its unique ->sname. After that, each worker grabs a > slot from this. > > I have several virtual hosts pointing to the same balancer (by rewrite > [P]). So, the second time, the balancer calls shm's slotmem_create again > with its name, that already exists -> kind-of noop. > > Now, the SHM under the balancer's name has still only 1 slot (that is > already occupied). > > When the worker now wants to (re-)grab its slot, I get: > > [slotmem_shm:debug] mod_slotmem_shm.c(575): AH02293: slotmem(...) grab > failed. Num 1/num_free 0 [proxy_balancer:emerg] (22)Invalid argument: > AH01186: worker slotmem_grab failed > Please note that my explanation should only be considered as an educated > guess for the reason of the error - there might be other obvious causes > that I have overseen. > > Has anyone similar issues? Any suggestions? > > Thanks in advance, > Florian > > > $ httpd -V Server version: Apache/2.4.1 (Unix) Server built: Feb 23 > 2012 18:21:48 Server's Module Magic Number: 20120211:0 Server loaded: > APR 1.4.5, APR-UTIL 1.4.1 Compiled using: APR 1.4.5, APR-UTIL 1.4.1 > Architecture: 32-bit Server MPM: event threaded: yes (fixed > thread count) forked: yes (variable process count) >
--- modules/proxy/mod_proxy_balancer.c 2012-03-31 17:40:36.000000000 +0200 +++ ../httpd-2.4.2_new/modules/proxy/mod_proxy_balancer.c 2012-04-07 20:53:56.896961481 +0200 @@ -825,6 +828,16 @@ static int balancer_post_config(apr_pool proxy_worker_shared *shm; worker = *workers; + + /* Ckeck if we grabbed already */ + if (storage->dptr(balancer->wslot, worker->s->index, (void *)&shm) == APR_SUCCESS) { + if (shm == worker->s) { + /* worker->s pointed to some shm before */ + ap_log_error(APLOG_MARK, APLOG_DEBUG, 0, s, APLOGNO(05561) "won't grab worker-SHM %lu with index %d twice", (unsigned long int)(worker->s), worker->s->index); + continue; + } + } + if ((rv = storage->grab(balancer->wslot, &index)) != APR_SUCCESS) { ap_log_error(APLOG_MARK, APLOG_EMERG, rv, s, APLOGNO(01186) "worker slotmem_grab failed"); return !OK;