You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@httpd.apache.org by jean-frederic clere <jf...@gmail.com> on 2007/09/07 10:30:13 UTC

Re: svn commit: r573264 - /httpd/httpd/trunk/include/scoreboard.h

That is going to break:
In mod_proxy.h:
int ap_proxy_lb_workers(void);
In server/scoreboard.c:
+++
static APR_OPTIONAL_FN_TYPE(ap_proxy_lb_workers)
                                *proxy_lb_workers;
+++

Cheers

Jean-Frederic

jim@apache.org wrote:
> Author: jim
> Date: Thu Sep  6 06:46:46 2007
> New Revision: 573264
> 
> URL: http://svn.apache.org/viewvc?rev=573264&view=rev
> Log:
> lb_score *is* proxy_worker_stat... no need to "mask" that
> or use wasted space.
> 
> Modified:
>     httpd/httpd/trunk/include/scoreboard.h
> 
> Modified: httpd/httpd/trunk/include/scoreboard.h
> URL: http://svn.apache.org/viewvc/httpd/httpd/trunk/include/scoreboard.h?rev=573264&r1=573263&r2=573264&view=diff
> ==============================================================================
> --- httpd/httpd/trunk/include/scoreboard.h (original)
> +++ httpd/httpd/trunk/include/scoreboard.h Thu Sep  6 06:46:46 2007
> @@ -40,6 +40,9 @@
>  #include "apr_shm.h"
>  #include "apr_optional.h"
>  
> +/* for lb_score */
> +#include "../modules/proxy/mod_proxy.h"
> +
>  /* Scoreboard file, if there is one */
>  #ifndef DEFAULT_SCOREBOARD
>  #define DEFAULT_SCOREBOARD "logs/apache_runtime_status"
> @@ -142,11 +145,7 @@
>  };
>  
>  /* stuff which is lb specific */
> -typedef struct lb_score lb_score;
> -struct lb_score {
> -    /* TODO: make a real stuct from this */
> -    unsigned char data[1024];
> -};
> +typedef struct proxy_worker_stat lb_score;
>  
>  /* Scoreboard is now in 'local' memory, since it isn't updated once created,
>   * even in forked architectures.  Child created-processes (non-fork) will
> 
> 
> 


Re: svn commit: r573264 - /httpd/httpd/trunk/include/scoreboard.h

Posted by jean-frederic clere <jf...@gmail.com>.
William A. Rowe, Jr. wrote:
> jean-frederic clere wrote:
>> That is going to break:
>> In mod_proxy.h:
>> int ap_proxy_lb_workers(void);
>> In server/scoreboard.c:
>> +++
>> static APR_OPTIONAL_FN_TYPE(ap_proxy_lb_workers)
>>                                 *proxy_lb_workers;
>> +++
> 
> which is fine - this is trunk.
> 
> Heaven forbid we backport it ;_)
> 

Sure but I have:
+++
/home/jfclere/TMP/dev01.qa.atl2.redhat.com/APR/build-1/libtool --silent
--mode=compile gcc -g -O2 -pthread    -DLINUX=2 -D_REENTRANT
-D_GNU_SOURCE -D_LARGEFILE64_SOURCE -DAP_DEBUG
-I/qa/home/jfclere/TMP/dev01.qa.atl2.redhat.com/httpd-trunk/srclib/pcre
-I. -I/qa/home/jfclere/TMP/dev01.qa.atl2.redhat.com/httpd-trunk/os/unix
-I/qa/home/jfclere/TMP/dev01.qa.atl2.redhat.com/httpd-trunk/server/mpm/prefork
-I/qa/home/jfclere/TMP/dev01.qa.atl2.redhat.com/httpd-trunk/modules/http
-I/qa/home/jfclere/TMP/dev01.qa.atl2.redhat.com/httpd-trunk/modules/filters
-I/qa/home/jfclere/TMP/dev01.qa.atl2.redhat.com/httpd-trunk/modules/proxy
-I/qa/home/jfclere/TMP/dev01.qa.atl2.redhat.com/httpd-trunk/include
-I/qa/home/jfclere/TMP/dev01.qa.atl2.redhat.com/httpd-trunk/modules/generators
-I/qa/home/jfclere/TMP/dev01.qa.atl2.redhat.com/httpd-trunk/modules/mappers
-I/qa/home/jfclere/TMP/dev01.qa.atl2.redhat.com/httpd-trunk/modules/database
-I/home/jfclere/TMP/dev01.qa.atl2.redhat.com/APR/include/apr!
 -1 -I/home/jfclere/TMP/dev01.qa.atl2.redhat.com/APU/include/apr-1
-I/qa/home/jfclere/TMP/dev01.qa.atl2.redhat.com/httpd-trunk/modules/proxy/../generators
-I/usr/kerberos/include
-I/qa/home/jfclere/TMP/dev01.qa.atl2.redhat.com/httpd-trunk/modules/ssl
-I/qa/home/jfclere/TMP/dev01.qa.atl2.redhat.com/httpd-trunk/modules/dav/main
 -prefer-non-pic -static -c scoreboard.c && touch scoreboard.lo
scoreboard.c:64: conflicting types for `proxy_lb_workers'
/qa/home/jfclere/TMP/dev01.qa.atl2.redhat.com/httpd-trunk/modules/proxy/mod_proxy.h:742:
previous declaration of `proxy_lb_workers'
scoreboard.c: In function `ap_calc_scoreboard_size':
scoreboard.c:108: sizeof applied to an incomplete type
scoreboard.c: In function `ap_init_scoreboard':
scoreboard.c:134: sizeof applied to an incomplete type
scoreboard.c: In function `ap_create_scoreboard':
scoreboard.c:286: sizeof applied to an incomplete type
scoreboard.c:286: sizeof applied to an incomplete type
scoreboard.c:286: sizeof applied to an incomplete type
scoreboard.c:286: sizeof applied to an incomplete type
scoreboard.c:286: sizeof applied to an incomplete type
scoreboard.c:286: sizeof applied to an incomplete type
scoreboard.c: In function `ap_get_scoreboard_lb':
scoreboard.c:496: invalid use of undefined type `struct proxy_worker_stat'
scoreboard.c:496: dereferencing pointer to incomplete type
make[2]: *** [scoreboard.lo] Error 1
make[2]: Leaving directory
`/qa/home/jfclere/TMP/dev01.qa.atl2.redhat.com/httpd-trunk/server'
make[1]: *** [install-recursive] Error 1
make[1]: Leaving directory
`/qa/home/jfclere/TMP/dev01.qa.atl2.redhat.com/httpd-trunk/server'
make: *** [install-recursive] Error 1
Build FAILED
+++

Re: svn commit: r573264 - /httpd/httpd/trunk/include/scoreboard.h

Posted by "William A. Rowe, Jr." <wr...@rowe-clan.net>.
jean-frederic clere wrote:
> That is going to break:
> In mod_proxy.h:
> int ap_proxy_lb_workers(void);
> In server/scoreboard.c:
> +++
> static APR_OPTIONAL_FN_TYPE(ap_proxy_lb_workers)
>                                 *proxy_lb_workers;
> +++

which is fine - this is trunk.

Heaven forbid we backport it ;_)

Re: svn commit: r573264 - /httpd/httpd/trunk/include/scoreboard.h

Posted by Jim Jagielski <ji...@jaguNET.com>.
Grrr... I tested with a compile and it worked fine, but
I forgot to do a make distclean 1st.

Yep.

Problem is that we're leaking info in mod_proxy.h
that we shouldn't :/

I'll revert until we figure out a better way to do
this...

On Sep 7, 2007, at 4:30 AM, jean-frederic clere wrote:

> That is going to break:
> In mod_proxy.h:
> int ap_proxy_lb_workers(void);
> In server/scoreboard.c:
> +++
> static APR_OPTIONAL_FN_TYPE(ap_proxy_lb_workers)
>                                 *proxy_lb_workers;
> +++
>
> Cheers
>
> Jean-Frederic
>
> jim@apache.org wrote:
>> Author: jim
>> Date: Thu Sep  6 06:46:46 2007
>> New Revision: 573264
>>
>> URL: http://svn.apache.org/viewvc?rev=573264&view=rev
>> Log:
>> lb_score *is* proxy_worker_stat... no need to "mask" that
>> or use wasted space.
>>
>> Modified:
>>     httpd/httpd/trunk/include/scoreboard.h
>>
>> Modified: httpd/httpd/trunk/include/scoreboard.h
>> URL: http://svn.apache.org/viewvc/httpd/httpd/trunk/include/ 
>> scoreboard.h?rev=573264&r1=573263&r2=573264&view=diff
>> ===================================================================== 
>> =========
>> --- httpd/httpd/trunk/include/scoreboard.h (original)
>> +++ httpd/httpd/trunk/include/scoreboard.h Thu Sep  6 06:46:46 2007
>> @@ -40,6 +40,9 @@
>>  #include "apr_shm.h"
>>  #include "apr_optional.h"
>>
>> +/* for lb_score */
>> +#include "../modules/proxy/mod_proxy.h"
>> +
>>  /* Scoreboard file, if there is one */
>>  #ifndef DEFAULT_SCOREBOARD
>>  #define DEFAULT_SCOREBOARD "logs/apache_runtime_status"
>> @@ -142,11 +145,7 @@
>>  };
>>
>>  /* stuff which is lb specific */
>> -typedef struct lb_score lb_score;
>> -struct lb_score {
>> -    /* TODO: make a real stuct from this */
>> -    unsigned char data[1024];
>> -};
>> +typedef struct proxy_worker_stat lb_score;
>>
>>  /* Scoreboard is now in 'local' memory, since it isn't updated  
>> once created,
>>   * even in forked architectures.  Child created-processes (non- 
>> fork) will
>>
>>
>>
>


Re: svn commit: r573264 - /httpd/httpd/trunk/include/scoreboard.h

Posted by jean-frederic clere <jf...@gmail.com>.
Martin Kraemer wrote:
> On Fri, Sep 07, 2007 at 10:30:13AM +0200, jean-frederic clere wrote:
>> That is going to break:
>> In mod_proxy.h:
>> int ap_proxy_lb_workers(void);
>> In server/scoreboard.c:
>> +++
>> static APR_OPTIONAL_FN_TYPE(ap_proxy_lb_workers)
>>                                 *proxy_lb_workers;
>> +++
> 
> Yes, it breaks:
> 
> scoreboard.c: In function `ap_calc_scoreboard_size':
> scoreboard.c:108: sizeof applied to an incomplete type
> scoreboard.c: In function `ap_init_scoreboard':
> scoreboard.c:134: sizeof applied to an incomplete type
> scoreboard.c: In function `ap_create_scoreboard':
> scoreboard.c:286: sizeof applied to an incomplete type
> scoreboard.c: In function `ap_get_scoreboard_lb':
> scoreboard.c:496: arithmetic on pointer to an incomplete type
> scoreboard.c:496: dereferencing pointer to incomplete type

I am trying to arrange it... Not easy.

Cheers

Jean-Frederic

> 
>   Martin


Re: svn commit: r573264 - /httpd/httpd/trunk/include/scoreboard.h

Posted by Jim Jagielski <ji...@jaguNET.com>.
On Sep 7, 2007, at 5:37 AM, Martin Kraemer wrote:

> On Fri, Sep 07, 2007 at 10:30:13AM +0200, jean-frederic clere wrote:
>> That is going to break:
>> In mod_proxy.h:
>> int ap_proxy_lb_workers(void);
>> In server/scoreboard.c:
>> +++
>> static APR_OPTIONAL_FN_TYPE(ap_proxy_lb_workers)
>>                                 *proxy_lb_workers;
>> +++
>
> Yes, it breaks:
>
> scoreboard.c: In function `ap_calc_scoreboard_size':
> scoreboard.c:108: sizeof applied to an incomplete type
> scoreboard.c: In function `ap_init_scoreboard':
> scoreboard.c:134: sizeof applied to an incomplete type
> scoreboard.c: In function `ap_create_scoreboard':
> scoreboard.c:286: sizeof applied to an incomplete type
> scoreboard.c: In function `ap_get_scoreboard_lb':
> scoreboard.c:496: arithmetic on pointer to an incomplete type
> scoreboard.c:496: dereferencing pointer to incomplete type
>

I reverted the patch. I will likely create a proxy_common.h
(or some other name) that includes the various struct defines,
etc which allows scoreboard.h to include that, but also allows
mod_proxy.h to include it as well (so include mod_proxy.h
will work as before).


Re: svn commit: r573264 - /httpd/httpd/trunk/include/scoreboard.h

Posted by Martin Kraemer <Ma...@Fujitsu-Siemens.com>.
On Fri, Sep 07, 2007 at 12:29:05PM +0200, jean-frederic clere wrote:
> 
> I think I have patched it. Could you try it?
> 

> Index: modules/proxy/proxy_util.c
> ===================================================================
...

Yep, thanks, that fixes it for me too.

+1 from me.

  Martin
-- 
<Ma...@Fujitsu-Siemens.com>        |     Fujitsu Siemens
http://www.fujitsu-siemens.com/imprint.html | 81730  Munich,  Germany

Re: svn commit: r573264 - /httpd/httpd/trunk/include/scoreboard.h

Posted by Jim Jagielski <ji...@jaguNET.com>.
Of course, the *real* fix is to make the scoreboard and
its entire allocation something which is more callable/usable
by modules, which is something we talked about several
times and is like a major aspect of 3.0.

But the current discussion tries to somehow say
that lb_score shouldn't "know" that it is really
proxy_worker_stat which is totally bogus. It is.
How big we need to make the scoreboard to account
for all the workers (and whether they exist or not)
does nothing to take away from the fact that
the struct used by the scoreboard must define itself
correctly before it even gets to say how many
there are. In other words, that element of the
struct *is* proxy_worker_stat, whether we build with
mod_proxy or not. Until we allow more dynamic allocation
of the scoreboard, I don't see why we just don't make
that as clear as possible, use the known-at-compile time
definition of proxy_worker_stat and stop trying to make
the element opaque for no good reason (and gobbling
up 1k when we need nothing close to that).

All that being said, I'm fine with going back
to the way it was before as long as we stop making
lb_score a 1k array and reduce it to something
much more realistic.

Re: svn commit: r573264 - /httpd/httpd/trunk/include/scoreboard.h

Posted by jean-frederic clere <jf...@gmail.com>.
Plüm wrote:
> 
>> -----Ursprüngliche Nachricht-----
>> Von: jean-frederic clere [mailto:jfclere@gmail.com] 
>> Gesendet: Montag, 10. September 2007 13:23
>> An: dev@httpd.apache.org
>> Cc: Jim Jagielski
>> Betreff: Re: svn commit: r573264 - 
>> /httpd/httpd/trunk/include/scoreboard.h
>>
>>
>> Plüm wrote:
>>>> -----Ursprüngliche Nachricht-----
>>>> Von: jean-frederic clere 
>>>> Gesendet: Montag, 10. September 2007 12:01
>>>> An: dev@httpd.apache.org
>>>> Betreff: Re: svn commit: r573264 - 
>>>> /httpd/httpd/trunk/include/scoreboard.h
>>>>
>>>>
>>>> Jim Jagielski wrote:
>>>>> Ruediger Pluem wrote:
>>>>>> Because it was
>>>>>>
>>>>>> int ap_proxy_lb_workers(void);
>>>>>>
>>>>>> and not
>>>>>>
>>>>>> PROXY_DECLARE(int)ap_proxy_lb_workers(void);
>>>>>>
>>>>> Yep. Ideally, of course, a design like mod_ssl with the
>>>>> ssl_private.h usage is nice, because there you can
>>>>> expose functions that need to be shared amoung files
>>>>> (without each one having lines and lines of 'extern foo'
>>>>> sillyness) without "leaking" them out anyplace
>>>>> else.
>>>>>
>>>> For example what about adding:
>>>> static APR_OPTIONAL_FN_TYPE(ap_proxy_lb_worker_size) 
>>>> *proxy_lb_worker_size;
>>>> and use a void * in scoreboard and an int for the size?
>>> For me this sounds fine, but I would guess that Jim doesn't like
>>> the void * idea in the scoreboard.
>> The scoreboard doesn't need to know what it stores ;-).
> 
> I agree with this.
> The void * solution (in fact we should not use a pointer there. We should
> use a non pointer type like an incomplete type or a char)

Well a char * makes things like ap_get_scoreboard_lb() more easy.

Cheers

Jean-Frederic


 also
> avoids wasting memory like we currently do with the fixed char array.
> 
> 
> Regards
> 
> Rüdiger
> 
> 


Re: svn commit: r573264 - /httpd/httpd/trunk/include/scoreboard.h

Posted by Plüm, Rüdiger, VF-Group <ru...@vodafone.com>.

> -----Ursprüngliche Nachricht-----
> Von: jean-frederic clere [mailto:jfclere@gmail.com] 
> Gesendet: Montag, 10. September 2007 13:23
> An: dev@httpd.apache.org
> Cc: Jim Jagielski
> Betreff: Re: svn commit: r573264 - 
> /httpd/httpd/trunk/include/scoreboard.h
> 
> 
> Plüm wrote:
> > 
> >> -----Ursprüngliche Nachricht-----
> >> Von: jean-frederic clere 
> >> Gesendet: Montag, 10. September 2007 12:01
> >> An: dev@httpd.apache.org
> >> Betreff: Re: svn commit: r573264 - 
> >> /httpd/httpd/trunk/include/scoreboard.h
> >>
> >>
> >> Jim Jagielski wrote:
> >>> Ruediger Pluem wrote:
> >>>> Because it was
> >>>>
> >>>> int ap_proxy_lb_workers(void);
> >>>>
> >>>> and not
> >>>>
> >>>> PROXY_DECLARE(int)ap_proxy_lb_workers(void);
> >>>>
> >>> Yep. Ideally, of course, a design like mod_ssl with the
> >>> ssl_private.h usage is nice, because there you can
> >>> expose functions that need to be shared amoung files
> >>> (without each one having lines and lines of 'extern foo'
> >>> sillyness) without "leaking" them out anyplace
> >>> else.
> >>>
> >> For example what about adding:
> >> static APR_OPTIONAL_FN_TYPE(ap_proxy_lb_worker_size) 
> >> *proxy_lb_worker_size;
> >> and use a void * in scoreboard and an int for the size?
> > 
> > For me this sounds fine, but I would guess that Jim doesn't like
> > the void * idea in the scoreboard.
> 
> The scoreboard doesn't need to know what it stores ;-).

I agree with this.
The void * solution (in fact we should not use a pointer there. We should
use a non pointer type like an incomplete type or a char) also
avoids wasting memory like we currently do with the fixed char array.


Regards

Rüdiger


Re: svn commit: r573264 - /httpd/httpd/trunk/include/scoreboard.h

Posted by jean-frederic clere <jf...@gmail.com>.
Plüm wrote:
> 
>> -----Ursprüngliche Nachricht-----
>> Von: jean-frederic clere 
>> Gesendet: Montag, 10. September 2007 12:01
>> An: dev@httpd.apache.org
>> Betreff: Re: svn commit: r573264 - 
>> /httpd/httpd/trunk/include/scoreboard.h
>>
>>
>> Jim Jagielski wrote:
>>> Ruediger Pluem wrote:
>>>> Because it was
>>>>
>>>> int ap_proxy_lb_workers(void);
>>>>
>>>> and not
>>>>
>>>> PROXY_DECLARE(int)ap_proxy_lb_workers(void);
>>>>
>>> Yep. Ideally, of course, a design like mod_ssl with the
>>> ssl_private.h usage is nice, because there you can
>>> expose functions that need to be shared amoung files
>>> (without each one having lines and lines of 'extern foo'
>>> sillyness) without "leaking" them out anyplace
>>> else.
>>>
>> For example what about adding:
>> static APR_OPTIONAL_FN_TYPE(ap_proxy_lb_worker_size) 
>> *proxy_lb_worker_size;
>> and use a void * in scoreboard and an int for the size?
> 
> For me this sounds fine, but I would guess that Jim doesn't like
> the void * idea in the scoreboard.

The scoreboard doesn't need to know what it stores ;-).
In fact that information could go in any "shared" memory, the scoreboard
is just the easiest way to handle it.

Cheers

Jean-Frederic

> 
> Regards
> 
> Rüdiger
> 
> 


Re: svn commit: r573264 - /httpd/httpd/trunk/include/scoreboard.h

Posted by Ruediger Pluem <rp...@apache.org>.

On 09/10/2007 05:39 PM, Martin Kraemer wrote:
> On Mon, Sep 10, 2007 at 05:02:52PM +0200, Plüm, Rüdiger, VF-Group wrote:
>> 1. IMHO requires a minor bump.
>> 2. Why messing around with lb_score any longer? Instead of
> ...
> 
> Sorry for stepping in on the discussion -- but Jim has tried to clean
> the code, JFC has helped providing alternative patches, and all they
> got was vetoes.
> 
> Isn't it time that, instead of a veto, a patch was posted?

Sorry for being confused, but what veto are you talking about?
All I have seen have been proposals, commits, comments on those and
a discussion that seems to be very long and extensive for the issue
we are talking about.

> 
> I may sound harsh, but it's sad to see so much time wasted by
> formalities...

No it does not sound harsh to me, but I agree that we are wasting too much
time with this.

Regards

Rüdiger



Re: svn commit: r573264 - /httpd/httpd/trunk/include/scoreboard.h

Posted by Martin Kraemer <ma...@apache.org>.
On Mon, Sep 10, 2007 at 05:02:52PM +0200, Plüm, Rüdiger, VF-Group wrote:
> 
> 1. IMHO requires a minor bump.
> 2. Why messing around with lb_score any longer? Instead of
...

Sorry for stepping in on the discussion -- but Jim has tried to clean
the code, JFC has helped providing alternative patches, and all they
got was vetoes.

Isn't it time that, instead of a veto, a patch was posted?

I may sound harsh, but it's sad to see so much time wasted by
formalities...

   Martin
-- 
<Ma...@Fujitsu-Siemens.com>        |     Fujitsu Siemens
http://www.fujitsu-siemens.com/imprint.html | 81730  Munich,  Germany

Re: svn commit: r573264 - /httpd/httpd/trunk/include/scoreboard.h

Posted by Jim Jagielski <ji...@jaguNET.com>.
On Sep 10, 2007, at 11:08 AM, Plüm, Rüdiger, VF-Group wrote:

>
> Sorry for being a pain in the neck with this topic :-)
>

:)

It just seems that we're spending so much time on something
which was envisioned as a quick, logical fix to trunk
which could then be backported to 2.2. But it's getting
bogged down in aspects which, admittedly, need to be
fixed but, by the fact that to do it correctly, precludes
the fact that 2.2 will ever see any benefit from it (due
to the required API changes)... and all this because we
want to maintain the illusion that lb_score isn't "really"
proxy_worker_stat for some real nebulous reasons...
It's almost like saying that some weird MPM may
want their own worker_score struct instead of what
we have, so we should really pretend that
worker_score isn't worker_score. After all, we
have this comment:

    /* stuff which is worker specific */

which means it can be used for any type of worker
known to mankind.

Re: svn commit: r573264 - /httpd/httpd/trunk/include/scoreboard.h

Posted by Plüm, Rüdiger, VF-Group <ru...@vodafone.com>.

> -----Ursprüngliche Nachricht-----
> Von: Jim Jagielski 
> Gesendet: Montag, 10. September 2007 16:51
> An: dev@httpd.apache.org
> Betreff: Re: svn commit: r573264 - 
> /httpd/httpd/trunk/include/scoreboard.h
> 
> 
> 
> On Sep 10, 2007, at 10:37 AM, jean-frederic clere wrote:
> 
> >
> >  typedef struct ap_sb_handle_t ap_sb_handle_t;
> > @@ -181,7 +175,7 @@
> >  AP_DECLARE(worker_score *) ap_get_scoreboard_worker(int x, int y);
> >  AP_DECLARE(process_score *) ap_get_scoreboard_process(int x);
> >  AP_DECLARE(global_score *) ap_get_scoreboard_global(void);
> > -AP_DECLARE(lb_score *) ap_get_scoreboard_lb(int lb_num);
> > +AP_DECLARE(void *) ap_get_scoreboard_lb(int lb_num);
> >
> >  AP_DECLARE_DATA extern scoreboard *ap_scoreboard_image;
> >  AP_DECLARE_DATA extern const char *ap_scoreboard_fname;
> > @@ -205,6 +199,12 @@
> >    */
> >  APR_DECLARE_OPTIONAL_FN(int, ap_proxy_lb_workers,
> >                          (void));
> > +/**
> > +  * proxy load balancer
> > +  * @return the size of lb_workers.
> > +  */
> > +APR_DECLARE_OPTIONAL_FN(int, ap_proxy_lb_worker_size,
> > +                        (void));
> >
> >  /* for time_process_request() in http_main.c */
> >  #define START_PREQUEST 1
> 
> Changes API. As such, this cannot be backported
> to 2.2.

Yep. So it would be even a major bump. OTOH changing the
typedef of lb_score would also require a major bump in this case,
as in both cases (typedef change / patch above) the return type
remains a pointer, but the type of the pointer would change in both
cases which could be seen as an API breakage.

Sorry for being a pain in the neck with this topic :-)

Regards

Rüdiger



Re: svn commit: r573264 - /httpd/httpd/trunk/include/scoreboard.h

Posted by Jim Jagielski <ji...@jaguNET.com>.
On Sep 10, 2007, at 10:37 AM, jean-frederic clere wrote:

>
>  typedef struct ap_sb_handle_t ap_sb_handle_t;
> @@ -181,7 +175,7 @@
>  AP_DECLARE(worker_score *) ap_get_scoreboard_worker(int x, int y);
>  AP_DECLARE(process_score *) ap_get_scoreboard_process(int x);
>  AP_DECLARE(global_score *) ap_get_scoreboard_global(void);
> -AP_DECLARE(lb_score *) ap_get_scoreboard_lb(int lb_num);
> +AP_DECLARE(void *) ap_get_scoreboard_lb(int lb_num);
>
>  AP_DECLARE_DATA extern scoreboard *ap_scoreboard_image;
>  AP_DECLARE_DATA extern const char *ap_scoreboard_fname;
> @@ -205,6 +199,12 @@
>    */
>  APR_DECLARE_OPTIONAL_FN(int, ap_proxy_lb_workers,
>                          (void));
> +/**
> +  * proxy load balancer
> +  * @return the size of lb_workers.
> +  */
> +APR_DECLARE_OPTIONAL_FN(int, ap_proxy_lb_worker_size,
> +                        (void));
>
>  /* for time_process_request() in http_main.c */
>  #define START_PREQUEST 1

Changes API. As such, this cannot be backported
to 2.2.

Re: svn commit: r573264 - /httpd/httpd/trunk/include/scoreboard.h

Posted by jean-frederic clere <jf...@gmail.com>.
Ruediger Pluem wrote:
> 
> On 09/11/2007 06:09 PM, jean-frederic clere wrote:
>> Plüm wrote:
>>>> -----Ursprüngliche Nachricht-----
>>>> Von: jean-frederic clere
>>>> Gesendet: Montag, 10. September 2007 16:38
>>>> An: dev@httpd.apache.org
>>>> Betreff: Re: svn commit: r573264 - 
>>>> /httpd/httpd/trunk/include/scoreboard.h
>>>>
>>>>
>>>> Jim Jagielski wrote:
>>>>> On Sep 10, 2007, at 6:37 AM, Plüm, Rüdiger, VF-Group wrote:
>>>>>
>>>>>>> For example what about adding:
>>>>>>> static APR_OPTIONAL_FN_TYPE(ap_proxy_lb_worker_size)
>>>>>>> *proxy_lb_worker_size;
>>>>>>> and use a void * in scoreboard and an int for the size?
>>>>>> For me this sounds fine, but I would guess that Jim doesn't like
>>>>>> the void * idea in the scoreboard.
>>>>>>
>>>>> I don't mind it at all, if we use it because we don't know
>>>>> what will be stored away or because we may use the storage
>>>>> differently at different times. But this is never the
>>>>> case. lb_score always is proxy_worker_stat.
>>>>>
>>>>>
>>>> The attached patch remove "lb_score" from scoreboard.c.
>>>>
>>>> Comments?
>>> 1. IMHO requires a minor bump.
>> Find a patch that covers all the points you raised below.
>>
>> More comments?
> 
> Index: server/scoreboard.c
> ===================================================================
> --- server/scoreboard.c»(revision 574500)
> +++ server/scoreboard.c»(working copy)
> @@ -490,8 +499,10 @@
> ·
>  AP_DECLARE(lb_score *) ap_get_scoreboard_lb(int lb_num)
>  {
> -    if (((lb_num < 0) || (lb_limit < lb_num))) {
> +    char *ptr;
> +    if (((lb_num < 0) || (lb_limit < lb_num)) || worker_size==0) {
> 
> I do not understand the setting of the brackets here. I suppose this should be:
> 
> if ((lb_num < 0) || (lb_limit < lb_num) || (worker_size == 0)) {
> 
> instead.

Yep.

> 
> 
> Index: modules/proxy/mod_proxy_balancer.c
> ===================================================================
> --- modules/proxy/mod_proxy_balancer.c»·(revision 574500)
> +++ modules/proxy/mod_proxy_balancer.c»·(working copy)
> @@ -19,7 +19,6 @@
>  #define CORE_PRIVATE
> ·
>  #include "mod_proxy.h"
> -#include "scoreboard.h"
> 
> Due to r574485 scoreboard.h is needed by mod_proxy_balancer to access
> ap_get_scoreboard_lb. So this patch to mod_proxy_balancer.c should be
> removed from your patch.
> 
> 

Yes, there is:
            slot = (proxy_worker_stat *) ap_get_scoreboard_lb(workers->id);

Cheers

Jean-Frederic
> 
> Regards
> 
> Rüdiger
> 


Re: svn commit: r573264 - /httpd/httpd/trunk/include/scoreboard.h

Posted by Jim Jagielski <ji...@jaguNET.com>.
Why doesn't j-f go ahead and commit the revised patch
to trunk and we can address our concerns in the code
instead of email :)


Re: svn commit: r573264 - /httpd/httpd/trunk/include/scoreboard.h

Posted by Ruediger Pluem <rp...@apache.org>.

On 09/11/2007 06:09 PM, jean-frederic clere wrote:
> Plüm wrote:
>>> -----Ursprüngliche Nachricht-----
>>> Von: jean-frederic clere
>>> Gesendet: Montag, 10. September 2007 16:38
>>> An: dev@httpd.apache.org
>>> Betreff: Re: svn commit: r573264 - 
>>> /httpd/httpd/trunk/include/scoreboard.h
>>>
>>>
>>> Jim Jagielski wrote:
>>>> On Sep 10, 2007, at 6:37 AM, Plüm, Rüdiger, VF-Group wrote:
>>>>
>>>>>> For example what about adding:
>>>>>> static APR_OPTIONAL_FN_TYPE(ap_proxy_lb_worker_size)
>>>>>> *proxy_lb_worker_size;
>>>>>> and use a void * in scoreboard and an int for the size?
>>>>> For me this sounds fine, but I would guess that Jim doesn't like
>>>>> the void * idea in the scoreboard.
>>>>>
>>>> I don't mind it at all, if we use it because we don't know
>>>> what will be stored away or because we may use the storage
>>>> differently at different times. But this is never the
>>>> case. lb_score always is proxy_worker_stat.
>>>>
>>>>
>>> The attached patch remove "lb_score" from scoreboard.c.
>>>
>>> Comments?
>> 1. IMHO requires a minor bump.
> 
> Find a patch that covers all the points you raised below.
> 
> More comments?

Index: server/scoreboard.c
===================================================================
--- server/scoreboard.c»(revision 574500)
+++ server/scoreboard.c»(working copy)
@@ -490,8 +499,10 @@
·
 AP_DECLARE(lb_score *) ap_get_scoreboard_lb(int lb_num)
 {
-    if (((lb_num < 0) || (lb_limit < lb_num))) {
+    char *ptr;
+    if (((lb_num < 0) || (lb_limit < lb_num)) || worker_size==0) {

I do not understand the setting of the brackets here. I suppose this should be:

if ((lb_num < 0) || (lb_limit < lb_num) || (worker_size == 0)) {

instead.


Index: modules/proxy/mod_proxy_balancer.c
===================================================================
--- modules/proxy/mod_proxy_balancer.c»·(revision 574500)
+++ modules/proxy/mod_proxy_balancer.c»·(working copy)
@@ -19,7 +19,6 @@
 #define CORE_PRIVATE
·
 #include "mod_proxy.h"
-#include "scoreboard.h"

Due to r574485 scoreboard.h is needed by mod_proxy_balancer to access
ap_get_scoreboard_lb. So this patch to mod_proxy_balancer.c should be
removed from your patch.



Regards

Rüdiger

Re: svn commit: r573264 - /httpd/httpd/trunk/include/scoreboard.h

Posted by jean-frederic clere <jf...@gmail.com>.
Jim Jagielski wrote:
> 
> On Sep 11, 2007, at 12:44 PM, jean-frederic clere wrote:
> 
>> Jim Jagielski wrote:
>>>
>>> On Sep 11, 2007, at 12:09 PM, jean-frederic clere wrote:
>>>
>>>>>
>>>>> 1. IMHO requires a minor bump.
>>>>
>>>> Find a patch that covers all the points you raised below.
>>>>
>>>> More comments?
>>>>
>>>
>>> Requires a major bump. Also destroys all those mystical
>>> other "balancers" from working as-is, since they
>>> must now be not only recompiled but also re-coded to
>>> implement ap_proxy_lb_worker_size() so that the
>>> old "lb_score" entry exists and has some size associated
>>> with it...
>>
>> ap_proxy_lb_worker_size is in mod_proxy as Rüdiger suggested it.
> 
> My point is that this function must be defined by any "other"
> balancer that wants to use this scoreboard space. You had
> mentioned concern that we can't be monkeying all that
> much with lb_score and stuff because "other" balancers
> may be wanting to use it. This patch does nothing to
> help that really... once the API breaks, well, we
> can do whatever we want :)
> 
>>
>> I agree it can't be backported to 2.2 but why can't it by in trunk?
>>
> 
> Never said it couldn't. Just made a comment that this
> patch isn't suitable for backporting. If I didn't care
> about a backportable patch, I would have originally created
> something quite different than what I did. 2.2 *still* has
> the problem. Instead, we're fixing something that doesn't
> have a problem... :/
> 
> Of course, all this assumes that the present usage of
> a general scoreboard is still the right design choice.
> Personally, as was discussed awhile ago, we need
> a better abstraction as well as moving *away* from
> a general purpose-shove-everything-in-here scoreboard.

I tried something in that direction in
httpd/branches/httpd-proxy-scoreboard. The goal was to offer another
storage for the proxy_worker_stat of mod_proxy.
What do you want to do?

Cheers

Jean-Frederic

Re: svn commit: r573264 - /httpd/httpd/trunk/include/scoreboard.h

Posted by Jim Jagielski <ji...@jaguNET.com>.
On Sep 11, 2007, at 12:44 PM, jean-frederic clere wrote:

> Jim Jagielski wrote:
>>
>> On Sep 11, 2007, at 12:09 PM, jean-frederic clere wrote:
>>
>>>>
>>>> 1. IMHO requires a minor bump.
>>>
>>> Find a patch that covers all the points you raised below.
>>>
>>> More comments?
>>>
>>
>> Requires a major bump. Also destroys all those mystical
>> other "balancers" from working as-is, since they
>> must now be not only recompiled but also re-coded to
>> implement ap_proxy_lb_worker_size() so that the
>> old "lb_score" entry exists and has some size associated
>> with it...
>
> ap_proxy_lb_worker_size is in mod_proxy as Rüdiger suggested it.

My point is that this function must be defined by any "other"
balancer that wants to use this scoreboard space. You had
mentioned concern that we can't be monkeying all that
much with lb_score and stuff because "other" balancers
may be wanting to use it. This patch does nothing to
help that really... once the API breaks, well, we
can do whatever we want :)

>
> I agree it can't be backported to 2.2 but why can't it by in trunk?
>

Never said it couldn't. Just made a comment that this
patch isn't suitable for backporting. If I didn't care
about a backportable patch, I would have originally created
something quite different than what I did. 2.2 *still* has
the problem. Instead, we're fixing something that doesn't
have a problem... :/

Of course, all this assumes that the present usage of
a general scoreboard is still the right design choice.
Personally, as was discussed awhile ago, we need
a better abstraction as well as moving *away* from
a general purpose-shove-everything-in-here scoreboard.

Re: svn commit: r573264 - /httpd/httpd/trunk/include/scoreboard.h

Posted by jean-frederic clere <jf...@gmail.com>.
Jim Jagielski wrote:
> 
> On Sep 11, 2007, at 12:09 PM, jean-frederic clere wrote:
> 
>>>
>>> 1. IMHO requires a minor bump.
>>
>> Find a patch that covers all the points you raised below.
>>
>> More comments?
>>
> 
> Requires a major bump. Also destroys all those mystical
> other "balancers" from working as-is, since they
> must now be not only recompiled but also re-coded to
> implement ap_proxy_lb_worker_size() so that the
> old "lb_score" entry exists and has some size associated
> with it...

ap_proxy_lb_worker_size is in mod_proxy as Rüdiger suggested it.
I agree it can't be backported to 2.2 but why can't it by in trunk?

> Didn't try applying or compiling but
> I'm not sure it will even build cleanly since
> it appears we've lost lb_score now.
> 

Compiling (make clean; make; make install; $HOME/APACHE/bin/apachectl
start; curl -v http://localhost/mytests) is something I try before
submitting a patch.

Cheers

Jean-Frederic


Re: svn commit: r573264 - /httpd/httpd/trunk/include/scoreboard.h

Posted by Jim Jagielski <ji...@jaguNET.com>.
On Sep 11, 2007, at 5:01 PM, Ruediger Pluem wrote:

>
>
> On 09/11/2007 10:51 PM, Jim Jagielski wrote:
>
>>
>> I would also suggest that we keep ap_proxy_lb_workers
>> in proxy_util.c (as it currently is), since even
>> though its not part of the API, other proxy module
>> make have a need for it (and again, keeping the
>> number of changes to a minimum).
>
> +1. That means also to keep it in mod_proxy.h.
> But we shouldn't do the same mistake with ap_proxy_lb_worker_size().
> So keep it static in mod_proxy.c.
>

+1. I prefer opt functions being static anyway, but
it's too late for ap_proxy_lb_workers() :)



Re: svn commit: r573264 - /httpd/httpd/trunk/include/scoreboard.h

Posted by Plüm, Rüdiger, VF-Group <ru...@vodafone.com>.

> -----Ursprüngliche Nachricht-----
> Von: jean-frederic clere 
> Gesendet: Mittwoch, 12. September 2007 12:15
> An: dev@httpd.apache.org
> Betreff: Re: svn commit: r573264 - 
> /httpd/httpd/trunk/include/scoreboard.h
> 
> 

> > The check for worker_size is not needed as worker_size is 
> never zero.
> 
> Except if pfn_proxy_lb_worker_size() returns 0. But that means a
> modified mod_proxy. Should we support than?

Good point. So lets keep the checks.

Regards

Rüdiger


Re: svn commit: r573264 - /httpd/httpd/trunk/include/scoreboard.h

Posted by jean-frederic clere <jf...@gmail.com>.
Plüm wrote:
> 
>> -----Ursprüngliche Nachricht-----
>> Von: jean-frederic clere 
>> Gesendet: Mittwoch, 12. September 2007 10:34
>> An: dev@httpd.apache.org
>> Betreff: Re: svn commit: r573264 - 
>> /httpd/httpd/trunk/include/scoreboard.h
>>
>>
>> Ruediger Pluem wrote:
>>> On 09/11/2007 10:51 PM, Jim Jagielski wrote:
>>>
>>>> I would also suggest that we keep ap_proxy_lb_workers
>>>> in proxy_util.c (as it currently is), since even
>>>> though its not part of the API, other proxy module
>>>> make have a need for it (and again, keeping the
>>>> number of changes to a minimum).
>>> +1. That means also to keep it in mod_proxy.h.
>>> But we shouldn't do the same mistake with ap_proxy_lb_worker_size().
>>> So keep it static in mod_proxy.c.
>> Ok I have committed the patch taking in account all the comments.
> 
> Sorry, but I have still some comments :-).
> 
> Modified: httpd/httpd/trunk/modules/proxy/mod_proxy.c
> URL: http://svn.apache.org/viewvc/httpd/httpd/trunk/modules/proxy/mod_proxy.c?rev=574843&r1=574842&r2=574843&view=diff
> ==============================================================================
> --- httpd/httpd/trunk/modules/proxy/mod_proxy.c (original)
> +++ httpd/httpd/trunk/modules/proxy/mod_proxy.c Wed Sep 12 01:34:40 2007
> @@ -37,6 +37,17 @@
>  #define MAX(x,y) ((x) >= (y) ? (x) : (y))
>  #endif
>  
> +/* Global balancer counter */
> +static int lb_workers_limit = 0;
> 
> Why having it here again? It is not used in mod_proxy.c and we have it in proxy_util.c

Oops fixed. Thanks.

> 
> Modified: httpd/httpd/trunk/server/scoreboard.c
> URL: http://svn.apache.org/viewvc/httpd/httpd/trunk/server/scoreboard.c?rev=574843&r1=574842&r2=574843&view=diff
> ==============================================================================
> --- httpd/httpd/trunk/server/scoreboard.c (original)
> +++ httpd/httpd/trunk/server/scoreboard.c Wed Sep 12 01:34:40 2007
> @@ -101,11 +103,18 @@
>      else
>          lb_limit = 0;
>  
> +    if (!pfn_proxy_lb_worker_size)
> +        pfn_proxy_lb_worker_size = APR_RETRIEVE_OPTIONAL_FN(ap_proxy_lb_worker_size);
> +    if (pfn_proxy_lb_worker_size)
> +        worker_size = pfn_proxy_lb_worker_size();
> +    else
> +        worker_size = sizeof(lb_score);
> +
>      scoreboard_size = sizeof(global_score);
>      scoreboard_size += sizeof(process_score) * server_limit;
>      scoreboard_size += sizeof(worker_score) * server_limit * thread_limit;
> -    if (lb_limit)
> -        scoreboard_size += sizeof(lb_score) * lb_limit;
> +    if (lb_limit && worker_size)
> 
> The check for worker_size is not needed as worker_size is never zero.

Except if pfn_proxy_lb_worker_size() returns 0. But that means a
modified mod_proxy. Should we support than?

Cheers

Jean-Frederic

> 
> +        scoreboard_size += worker_size * lb_limit;
>  
>      return scoreboard_size;
>  }
> @@ -129,9 +138,9 @@
>          ap_scoreboard_image->servers[i] = (worker_score *)more_storage;
>          more_storage += thread_limit * sizeof(worker_score);
>      }
> -    if (lb_limit) {
> -        ap_scoreboard_image->balancers = (lb_score *)more_storage;
> -        more_storage += lb_limit * sizeof(lb_score);
> +    if (lb_limit && worker_size) {
> 
> The check for worker_size is not needed as worker_size is never zero.
> 
> +        ap_scoreboard_image->balancers = (void *)more_storage;
> +        more_storage += lb_limit * worker_size;
>      }
>      ap_assert(more_storage == (char*)shared_score + scoreboard_size);
>      ap_scoreboard_image->global->server_limit = server_limit;
> @@ -281,9 +290,9 @@
>                     sizeof(worker_score) * thread_limit);
>          }
>          /* Clean up the lb workers data */
> -        if (lb_limit) {
> +        if (lb_limit && worker_size) {
> 
> The check for worker_size is not needed as worker_size is never zero.
> 
>              memset(ap_scoreboard_image->balancers, 0,
> -                   sizeof(lb_score) * lb_limit);
> +                   worker_size * lb_limit);
>          }
>          return OK;
>      }
> @@ -490,8 +499,10 @@
>  
>  AP_DECLARE(lb_score *) ap_get_scoreboard_lb(int lb_num)
>  {
> -    if (((lb_num < 0) || (lb_limit < lb_num))) {
> +    char *ptr;
> +    if (((lb_num < 0) || (lb_limit < lb_num)) || (worker_size==0)) {
> 
> The check for worker_size is not needed as worker_size is never zero.
> 
>          return(NULL); /* Out of range */
>      }
> -    return &ap_scoreboard_image->balancers[lb_num];
> +    ptr = (char *) ap_scoreboard_image->balancers + lb_num*worker_size;
> +    return (lb_score *) ptr;
>  }
> 
> 
> Regards
> 
> Rüdiger
> 
> 


Re: svn commit: r573264 - /httpd/httpd/trunk/include/scoreboard.h

Posted by Plüm, Rüdiger, VF-Group <ru...@vodafone.com>.

> -----Ursprüngliche Nachricht-----
> Von: jean-frederic clere 
> Gesendet: Mittwoch, 12. September 2007 10:34
> An: dev@httpd.apache.org
> Betreff: Re: svn commit: r573264 - 
> /httpd/httpd/trunk/include/scoreboard.h
> 
> 
> Ruediger Pluem wrote:
> > 
> > On 09/11/2007 10:51 PM, Jim Jagielski wrote:
> > 
> >> I would also suggest that we keep ap_proxy_lb_workers
> >> in proxy_util.c (as it currently is), since even
> >> though its not part of the API, other proxy module
> >> make have a need for it (and again, keeping the
> >> number of changes to a minimum).
> > 
> > +1. That means also to keep it in mod_proxy.h.
> > But we shouldn't do the same mistake with ap_proxy_lb_worker_size().
> > So keep it static in mod_proxy.c.
> 
> Ok I have committed the patch taking in account all the comments.

Sorry, but I have still some comments :-).

Modified: httpd/httpd/trunk/modules/proxy/mod_proxy.c
URL: http://svn.apache.org/viewvc/httpd/httpd/trunk/modules/proxy/mod_proxy.c?rev=574843&r1=574842&r2=574843&view=diff
==============================================================================
--- httpd/httpd/trunk/modules/proxy/mod_proxy.c (original)
+++ httpd/httpd/trunk/modules/proxy/mod_proxy.c Wed Sep 12 01:34:40 2007
@@ -37,6 +37,17 @@
 #define MAX(x,y) ((x) >= (y) ? (x) : (y))
 #endif
 
+/* Global balancer counter */
+static int lb_workers_limit = 0;

Why having it here again? It is not used in mod_proxy.c and we have it in proxy_util.c

Modified: httpd/httpd/trunk/server/scoreboard.c
URL: http://svn.apache.org/viewvc/httpd/httpd/trunk/server/scoreboard.c?rev=574843&r1=574842&r2=574843&view=diff
==============================================================================
--- httpd/httpd/trunk/server/scoreboard.c (original)
+++ httpd/httpd/trunk/server/scoreboard.c Wed Sep 12 01:34:40 2007
@@ -101,11 +103,18 @@
     else
         lb_limit = 0;
 
+    if (!pfn_proxy_lb_worker_size)
+        pfn_proxy_lb_worker_size = APR_RETRIEVE_OPTIONAL_FN(ap_proxy_lb_worker_size);
+    if (pfn_proxy_lb_worker_size)
+        worker_size = pfn_proxy_lb_worker_size();
+    else
+        worker_size = sizeof(lb_score);
+
     scoreboard_size = sizeof(global_score);
     scoreboard_size += sizeof(process_score) * server_limit;
     scoreboard_size += sizeof(worker_score) * server_limit * thread_limit;
-    if (lb_limit)
-        scoreboard_size += sizeof(lb_score) * lb_limit;
+    if (lb_limit && worker_size)

The check for worker_size is not needed as worker_size is never zero.

+        scoreboard_size += worker_size * lb_limit;
 
     return scoreboard_size;
 }
@@ -129,9 +138,9 @@
         ap_scoreboard_image->servers[i] = (worker_score *)more_storage;
         more_storage += thread_limit * sizeof(worker_score);
     }
-    if (lb_limit) {
-        ap_scoreboard_image->balancers = (lb_score *)more_storage;
-        more_storage += lb_limit * sizeof(lb_score);
+    if (lb_limit && worker_size) {

The check for worker_size is not needed as worker_size is never zero.

+        ap_scoreboard_image->balancers = (void *)more_storage;
+        more_storage += lb_limit * worker_size;
     }
     ap_assert(more_storage == (char*)shared_score + scoreboard_size);
     ap_scoreboard_image->global->server_limit = server_limit;
@@ -281,9 +290,9 @@
                    sizeof(worker_score) * thread_limit);
         }
         /* Clean up the lb workers data */
-        if (lb_limit) {
+        if (lb_limit && worker_size) {

The check for worker_size is not needed as worker_size is never zero.

             memset(ap_scoreboard_image->balancers, 0,
-                   sizeof(lb_score) * lb_limit);
+                   worker_size * lb_limit);
         }
         return OK;
     }
@@ -490,8 +499,10 @@
 
 AP_DECLARE(lb_score *) ap_get_scoreboard_lb(int lb_num)
 {
-    if (((lb_num < 0) || (lb_limit < lb_num))) {
+    char *ptr;
+    if (((lb_num < 0) || (lb_limit < lb_num)) || (worker_size==0)) {

The check for worker_size is not needed as worker_size is never zero.

         return(NULL); /* Out of range */
     }
-    return &ap_scoreboard_image->balancers[lb_num];
+    ptr = (char *) ap_scoreboard_image->balancers + lb_num*worker_size;
+    return (lb_score *) ptr;
 }


Regards

Rüdiger


Re: svn commit: r573264 - /httpd/httpd/trunk/include/scoreboard.h

Posted by jean-frederic clere <jf...@gmail.com>.
Ruediger Pluem wrote:
> 
> On 09/11/2007 10:51 PM, Jim Jagielski wrote:
> 
>> I would also suggest that we keep ap_proxy_lb_workers
>> in proxy_util.c (as it currently is), since even
>> though its not part of the API, other proxy module
>> make have a need for it (and again, keeping the
>> number of changes to a minimum).
> 
> +1. That means also to keep it in mod_proxy.h.
> But we shouldn't do the same mistake with ap_proxy_lb_worker_size().
> So keep it static in mod_proxy.c.

Ok I have committed the patch taking in account all the comments.

Thanks

Jean-Frederic

> 
> Regards
> 
> Rüdiger
> 
> 


Re: svn commit: r573264 - /httpd/httpd/trunk/include/scoreboard.h

Posted by Ruediger Pluem <rp...@apache.org>.

On 09/11/2007 10:51 PM, Jim Jagielski wrote:

> 
> I would also suggest that we keep ap_proxy_lb_workers
> in proxy_util.c (as it currently is), since even
> though its not part of the API, other proxy module
> make have a need for it (and again, keeping the
> number of changes to a minimum).

+1. That means also to keep it in mod_proxy.h.
But we shouldn't do the same mistake with ap_proxy_lb_worker_size().
So keep it static in mod_proxy.c.

Regards

Rüdiger


Re: svn commit: r573264 - /httpd/httpd/trunk/include/scoreboard.h

Posted by Jim Jagielski <ji...@jaguNET.com>.
On Sep 11, 2007, at 4:39 PM, Ruediger Pluem wrote:

>
> it will fail to compile after the patch, because lb_score is now an
> incomplete type. So I guess in order to keep it backportable we
> need to stick with
>
> typedef struct lb_score lb_score;
> struct lb_score {
>     unsigned char data[1024];
> };
>

This is a good point that I completely missed...

I would also suggest that we keep ap_proxy_lb_workers
in proxy_util.c (as it currently is), since even
though its not part of the API, other proxy module
make have a need for it (and again, keeping the
number of changes to a minimum).



Re: svn commit: r573264 - /httpd/httpd/trunk/include/scoreboard.h

Posted by Ruediger Pluem <rp...@apache.org>.

On 09/11/2007 10:18 PM, Jim Jagielski wrote:
> 
> On Sep 11, 2007, at 4:04 PM, Ruediger Pluem wrote:
> 
>>
>>
>> On 09/11/2007 06:23 PM, Jim Jagielski wrote:
>>>
>>> On Sep 11, 2007, at 12:09 PM, jean-frederic clere wrote:
>>>
>>>>>
>>>>> 1. IMHO requires a minor bump.
>>>>
>>>> Find a patch that covers all the points you raised below.
>>>>
>>>> More comments?
>>>>
>>>
>>> Requires a major bump. Also destroys all those mystical
>>
>> Curious again. Why a major bump? Because lb_score is being converted from
>> a complete type to an incomplete type?
>>
> 
> That is one reason. Another is that any module, including
> mod_proxy, which needs to create the "old" lb_score needs
> to implement ap_proxy_lb_worker_size(). If that function
> doesn't exist, then even if they implement ap_proxy_lb_workers(),
> the lb score slot will be 0 size...

Just thinking. If some module did a

sizeof(lb_score)

it will fail to compile after the patch, because lb_score is now an
incomplete type. So I guess in order to keep it backportable we
need to stick with

typedef struct lb_score lb_score;
struct lb_score {
    unsigned char data[1024];
};

The improvement would be that we do not waste space any longer
if ap_proxy_lb_worker_size() is present and that we can be sure
that enough space is present if ap_proxy_lb_worker_size() is present
and returns more than 1024.

> 
> I would say that if the code was adjusted so if
> the function did not exist, and the worker_size
> defaulted to 1024, then they would be no regressions
> for 3rd party modules, which would remove the bump and
> make it a viable 2.2 backport.

Sounds reasonable to me.  So +1 from me adjusting the patch
in a way that it defaults to 1024 if ap_proxy_lb_worker_size()
is missing.

Regards

Rüdiger

Re: svn commit: r573264 - /httpd/httpd/trunk/include/scoreboard.h

Posted by Jim Jagielski <ji...@jaguNET.com>.
On Sep 11, 2007, at 4:04 PM, Ruediger Pluem wrote:

>
>
> On 09/11/2007 06:23 PM, Jim Jagielski wrote:
>>
>> On Sep 11, 2007, at 12:09 PM, jean-frederic clere wrote:
>>
>>>>
>>>> 1. IMHO requires a minor bump.
>>>
>>> Find a patch that covers all the points you raised below.
>>>
>>> More comments?
>>>
>>
>> Requires a major bump. Also destroys all those mystical
>
> Curious again. Why a major bump? Because lb_score is being  
> converted from
> a complete type to an incomplete type?
>

That is one reason. Another is that any module, including
mod_proxy, which needs to create the "old" lb_score needs
to implement ap_proxy_lb_worker_size(). If that function
doesn't exist, then even if they implement ap_proxy_lb_workers(),
the lb score slot will be 0 size...

I would say that if the code was adjusted so if
the function did not exist, and the worker_size
defaulted to 1024, then they would be no regressions
for 3rd party modules, which would remove the bump and
make it a viable 2.2 backport.

I'd +1 that.

Re: svn commit: r573264 - /httpd/httpd/trunk/include/scoreboard.h

Posted by Ruediger Pluem <rp...@apache.org>.

On 09/11/2007 06:23 PM, Jim Jagielski wrote:
> 
> On Sep 11, 2007, at 12:09 PM, jean-frederic clere wrote:
> 
>>>
>>> 1. IMHO requires a minor bump.
>>
>> Find a patch that covers all the points you raised below.
>>
>> More comments?
>>
> 
> Requires a major bump. Also destroys all those mystical

Curious again. Why a major bump? Because lb_score is being converted from
a complete type to an incomplete type?

Regards

Rüdiger


Re: svn commit: r573264 - /httpd/httpd/trunk/include/scoreboard.h

Posted by Jim Jagielski <ji...@jaguNET.com>.
On Sep 11, 2007, at 12:09 PM, jean-frederic clere wrote:

>>
>> 1. IMHO requires a minor bump.
>
> Find a patch that covers all the points you raised below.
>
> More comments?
>

Requires a major bump. Also destroys all those mystical
other "balancers" from working as-is, since they
must now be not only recompiled but also re-coded to
implement ap_proxy_lb_worker_size() so that the
old "lb_score" entry exists and has some size associated
with it... Didn't try applying or compiling but
I'm not sure it will even build cleanly since
it appears we've lost lb_score now.

Re: svn commit: r573264 - /httpd/httpd/trunk/include/scoreboard.h

Posted by Jim Jagielski <ji...@jaguNET.com>.
On Sep 11, 2007, at 12:09 PM, jean-frederic clere wrote:

>
>  AP_DECLARE(lb_score *) ap_get_scoreboard_lb(int lb_num)
>  {
> -    if (((lb_num < 0) || (lb_limit < lb_num))) {
> +    char *ptr;
> +    if (((lb_num < 0) || (lb_limit < lb_num)) || worker_size==0) {
>          return(NULL); /* Out of range */
>      }
> -    return &ap_scoreboard_image->balancers[lb_num];
> +    ptr = (char *) ap_scoreboard_image->balancers +  
> lb_num*worker_size;
> +    return (lb_score *) ptr;

Ideally, of course, lb_score should just go away
and use void *... (and remove that (char *) stuff
as well).


Re: svn commit: r573264 - /httpd/httpd/trunk/include/scoreboard.h

Posted by jean-frederic clere <jf...@gmail.com>.
Plüm wrote:
> 
>> -----Ursprüngliche Nachricht-----
>> Von: jean-frederic clere
>> Gesendet: Montag, 10. September 2007 16:38
>> An: dev@httpd.apache.org
>> Betreff: Re: svn commit: r573264 - 
>> /httpd/httpd/trunk/include/scoreboard.h
>>
>>
>> Jim Jagielski wrote:
>>> On Sep 10, 2007, at 6:37 AM, Plüm, Rüdiger, VF-Group wrote:
>>>
>>>>> For example what about adding:
>>>>> static APR_OPTIONAL_FN_TYPE(ap_proxy_lb_worker_size)
>>>>> *proxy_lb_worker_size;
>>>>> and use a void * in scoreboard and an int for the size?
>>>> For me this sounds fine, but I would guess that Jim doesn't like
>>>> the void * idea in the scoreboard.
>>>>
>>> I don't mind it at all, if we use it because we don't know
>>> what will be stored away or because we may use the storage
>>> differently at different times. But this is never the
>>> case. lb_score always is proxy_worker_stat.
>>>
>>>
>> The attached patch remove "lb_score" from scoreboard.c.
>>
>> Comments?
> 
> 1. IMHO requires a minor bump.

Find a patch that covers all the points you raised below.

More comments?

Cheers

Jean-Frederic

> 2. Why messing around with lb_score any longer? Instead of
> 
>     return sizeof(lb_score);
>    
>    we could do
> 
>     return sizeof(proxy_worker_stat);
> 
> 3. We should register the optional functions ap_proxy_lb_workers and
>    ap_proxy_lb_worker_size in the same place and should keep the code
>    of them next to each other. With your patch they are distributed over
>    mod_proxy.c and mod_proxy_balancer.c. IMHO they belong to mod_proxy.c
>    as we call ap_proxy_initialize_worker_share from mod_proxy's child init
>    (so even if we do not load mod_proxy_balancer we need the scoreboard entries).
> 4. All
>      if (lb_limit)
>    in scoreboard.c should be extended to
>      if (lb_limit && worker_size)
> 
> 
> Regards
> 
> Rüdiger
> 
> 


Re: svn commit: r573264 - /httpd/httpd/trunk/include/scoreboard.h

Posted by Jim Jagielski <ji...@jaguNET.com>.
On Sep 10, 2007, at 12:51 PM, jean-frederic clere wrote:

> Jim Jagielski wrote:
>>
>> On Sep 10, 2007, at 12:19 PM, jean-frederic clere wrote:
>>
>>>
>>> Well that just because I am thinking that the size of  
>>> proxy_worker_stat
>>> could be "changed" by a balancer, like adding extra bytes to
>>> proxy_worker_stat.
>>>
>>
>> That is what 'void *context' is designed to do. Be a place
>> where "unique" data can be stored.
>>
>
> Well now context can't be pointing after proxy_worker_stat and  
> using few
> bytes of the 1K buffer. Someone having his own balancer could add the
> bytes he needs in his balancer code if the size is set in the  
> balancer code.
>

??

The idea of the context element is, if a balancer needs
additional data other than what is defined in proxy_worker_stat,
the 'content' element allows them to create a struct/union/whatever
of that "extra" data, allocate it as needed and tuck away a pointer
to that in context, which required no change to the size or
definition of proxy_worker_stat at all.


Re: svn commit: r573264 - /httpd/httpd/trunk/include/scoreboard.h

Posted by jean-frederic clere <jf...@gmail.com>.
Jim Jagielski wrote:
> 
> On Sep 10, 2007, at 12:19 PM, jean-frederic clere wrote:
> 
>>
>> Well that just because I am thinking that the size of proxy_worker_stat
>> could be "changed" by a balancer, like adding extra bytes to
>> proxy_worker_stat.
>>
> 
> That is what 'void *context' is designed to do. Be a place
> where "unique" data can be stored.
> 

Well now context can't be pointing after proxy_worker_stat and using few
bytes of the 1K buffer. Someone having his own balancer could add the
bytes he needs in his balancer code if the size is set in the balancer code.

Cheers

Jean-Frederic

Re: svn commit: r573264 - /httpd/httpd/trunk/include/scoreboard.h

Posted by Jim Jagielski <ji...@jaguNET.com>.
On Sep 10, 2007, at 12:19 PM, jean-frederic clere wrote:

>
> Well that just because I am thinking that the size of  
> proxy_worker_stat
> could be "changed" by a balancer, like adding extra bytes to
> proxy_worker_stat.
>

That is what 'void *context' is designed to do. Be a place
where "unique" data can be stored.

Re: svn commit: r573264 - /httpd/httpd/trunk/include/scoreboard.h

Posted by jean-frederic clere <jf...@gmail.com>.
Plüm wrote:
> 
>> -----Ursprüngliche Nachricht-----
>> Von: jean-frederic clere
>> Gesendet: Montag, 10. September 2007 16:38
>> An: dev@httpd.apache.org
>> Betreff: Re: svn commit: r573264 - 
>> /httpd/httpd/trunk/include/scoreboard.h
>>
>>
>> Jim Jagielski wrote:
>>> On Sep 10, 2007, at 6:37 AM, Plüm, Rüdiger, VF-Group wrote:
>>>
>>>>> For example what about adding:
>>>>> static APR_OPTIONAL_FN_TYPE(ap_proxy_lb_worker_size)
>>>>> *proxy_lb_worker_size;
>>>>> and use a void * in scoreboard and an int for the size?
>>>> For me this sounds fine, but I would guess that Jim doesn't like
>>>> the void * idea in the scoreboard.
>>>>
>>> I don't mind it at all, if we use it because we don't know
>>> what will be stored away or because we may use the storage
>>> differently at different times. But this is never the
>>> case. lb_score always is proxy_worker_stat.
>>>
>>>
>> The attached patch remove "lb_score" from scoreboard.c.
>>
>> Comments?
> 
> 1. IMHO requires a minor bump.

Yes.

> 2. Why messing around with lb_score any longer? Instead of
> 
>     return sizeof(lb_score);
>    
>    we could do
> 
>     return sizeof(proxy_worker_stat);

Sure.
> 
> 3. We should register the optional functions ap_proxy_lb_workers and
>    ap_proxy_lb_worker_size in the same place and should keep the code
>    of them next to each other. With your patch they are distributed over
>    mod_proxy.c and mod_proxy_balancer.c.

Well that just because I am thinking that the size of proxy_worker_stat
could be "changed" by a balancer, like adding extra bytes to
proxy_worker_stat.

> IMHO they belong to mod_proxy.c
>    as we call ap_proxy_initialize_worker_share from mod_proxy's child init
>    (so even if we do not load mod_proxy_balancer we need the scoreboard entries).
> 4. All
>      if (lb_limit)
>    in scoreboard.c should be extended to
>      if (lb_limit && worker_size)

Right.

Cheers

Jean-Frederic

> 
> 
> Regards
> 
> Rüdiger
> 
> 


Re: svn commit: r573264 - /httpd/httpd/trunk/include/scoreboard.h

Posted by Plüm, Rüdiger, VF-Group <ru...@vodafone.com>.

> -----Ursprüngliche Nachricht-----
> Von: jean-frederic clere
> Gesendet: Montag, 10. September 2007 16:38
> An: dev@httpd.apache.org
> Betreff: Re: svn commit: r573264 - 
> /httpd/httpd/trunk/include/scoreboard.h
> 
> 
> Jim Jagielski wrote:
> > 
> > On Sep 10, 2007, at 6:37 AM, Plüm, Rüdiger, VF-Group wrote:
> > 
> >>>
> >>> For example what about adding:
> >>> static APR_OPTIONAL_FN_TYPE(ap_proxy_lb_worker_size)
> >>> *proxy_lb_worker_size;
> >>> and use a void * in scoreboard and an int for the size?
> >>
> >> For me this sounds fine, but I would guess that Jim doesn't like
> >> the void * idea in the scoreboard.
> >>
> > 
> > I don't mind it at all, if we use it because we don't know
> > what will be stored away or because we may use the storage
> > differently at different times. But this is never the
> > case. lb_score always is proxy_worker_stat.
> > 
> > 
> 
> The attached patch remove "lb_score" from scoreboard.c.
> 
> Comments?

1. IMHO requires a minor bump.
2. Why messing around with lb_score any longer? Instead of

    return sizeof(lb_score);
   
   we could do

    return sizeof(proxy_worker_stat);

3. We should register the optional functions ap_proxy_lb_workers and
   ap_proxy_lb_worker_size in the same place and should keep the code
   of them next to each other. With your patch they are distributed over
   mod_proxy.c and mod_proxy_balancer.c. IMHO they belong to mod_proxy.c
   as we call ap_proxy_initialize_worker_share from mod_proxy's child init
   (so even if we do not load mod_proxy_balancer we need the scoreboard entries).
4. All
     if (lb_limit)
   in scoreboard.c should be extended to
     if (lb_limit && worker_size)


Regards

Rüdiger


Re: svn commit: r573264 - /httpd/httpd/trunk/include/scoreboard.h

Posted by jean-frederic clere <jf...@gmail.com>.
Jim Jagielski wrote:
> 
> On Sep 10, 2007, at 6:37 AM, Plüm, Rüdiger, VF-Group wrote:
> 
>>>
>>> For example what about adding:
>>> static APR_OPTIONAL_FN_TYPE(ap_proxy_lb_worker_size)
>>> *proxy_lb_worker_size;
>>> and use a void * in scoreboard and an int for the size?
>>
>> For me this sounds fine, but I would guess that Jim doesn't like
>> the void * idea in the scoreboard.
>>
> 
> I don't mind it at all, if we use it because we don't know
> what will be stored away or because we may use the storage
> differently at different times. But this is never the
> case. lb_score always is proxy_worker_stat.
> 
> 

The attached patch remove "lb_score" from scoreboard.c.

Comments?

Cheers

Jean-Frederic

Re: svn commit: r573264 - /httpd/httpd/trunk/include/scoreboard.h

Posted by Jim Jagielski <ji...@jaguNET.com>.
On Sep 10, 2007, at 10:13 AM, jean-frederic clere wrote:

> Jim Jagielski wrote:
>>
>>
>> I'm not sure what you mean. mod_proxy does, in child_init,
>> the calls to create those scoreboard entries. It does
>> so via ap_proxy_initialize_worker_share(). No matter
>> what, the ->s is set to:
>>
>>    worker->s = (proxy_worker_stat *)score;
>
> Well below that, the lines:
>        if (worker->route) {
>         strcpy(worker->s->route, worker->route);
>     }
> shows cleary the problem.
>

Well, not that clearly because I have no idea how
it does so.

>
>>
>> Or are you suggesting that some other "balancer"
>> which completely bypasses mod_proxy (and, in fact,
>> replaces mod_proxy) could be using that scoreboard
>> entry?
>
> Well such a tool could use its own shared memory but yes making  
> lb_score
> opaque in scoreboard.c will allow to write such modules.
>

Agreed. But I would guess that anyone who would do
so would create their own shared-memory allocation
outside of the scoreboard anyway... and see below
about another point.

>>
>> And once again, the *real* fix is changing our usage
>> and allocation of the scoreboard, something set for
>> 3.0. If people want that for 2.4, then cool.
>
> One thing is what we store another thing is where we store it.
> We are discussing what we store ;-)
>

What we store in that location is proxy_worker_stat. Nothing
else. AFAIK, no one else uses it for any other purpose.
If they do then it is clearly a storage location that
Apache's mod_proxy uses for proxy_worker_stat and the
balancer code.

I can't see wasting all this time saying "OK, right
now it's not really opaque enough so let's do all
this moving and hacking to make it so" when (1)
we can't say it's a generic scoreboard storage
space because it can be used only by one module
exclusively... making it opaque and therefore "usable
by anyone" also implies some sort of "but only one
person can use it at a time"... Can't do the 1st
without bothering with the 2nd and (2) this is hardly
specific to mod_proxy; Whatever the solution is needs
to be generic enough for anyone and everyone to use
which, for sure, will change the API in which case
what we do for *this* API is no longer applicable.

Holy moley... let's just change it back to the way
it was and get *on* with it... geez.

Re: svn commit: r573264 - /httpd/httpd/trunk/include/scoreboard.h

Posted by jean-frederic clere <jf...@gmail.com>.
Jim Jagielski wrote:
> 
> On Sep 10, 2007, at 8:24 AM, jean-frederic clere wrote:
> 
>> Jim Jagielski wrote:
>>>
>>> On Sep 10, 2007, at 6:37 AM, Plüm, Rüdiger, VF-Group wrote:
>>>
>>>>>
>>>>> For example what about adding:
>>>>> static APR_OPTIONAL_FN_TYPE(ap_proxy_lb_worker_size)
>>>>> *proxy_lb_worker_size;
>>>>> and use a void * in scoreboard and an int for the size?
>>>>
>>>> For me this sounds fine, but I would guess that Jim doesn't like
>>>> the void * idea in the scoreboard.
>>>>
>>>
>>> I don't mind it at all, if we use it because we don't know
>>> what will be stored away or because we may use the storage
>>> differently at different times. But this is never the
>>> case. lb_score always is proxy_worker_stat.
>>>
>>>
>>
>> My point goes with the comment in the code:
>> +++
>> /* stuff which is lb specific */
>> typedef proxy_worker_stat lb_score;
>> +++
>> A custom balancer may have a different proxy_worker_stat, so in fact
>> only modules/proxy/mod_proxy_balancer.c should know what the
>> proxy_worker_stat structure contains.
>>
> 
> I'm not sure what you mean. mod_proxy does, in child_init,
> the calls to create those scoreboard entries. It does
> so via ap_proxy_initialize_worker_share(). No matter
> what, the ->s is set to:
> 
>    worker->s = (proxy_worker_stat *)score;

Well below that, the lines:
       if (worker->route) {
        strcpy(worker->s->route, worker->route);
    }
shows cleary the problem.

> 
> If some other struct is used then lots and lots of
> other code needs to be changed to make lb_score and
> mod_proxy *really* opaque to each other.

Not so much because some routines in proxy_util could be moved to
mod_proxy_balancer.c (They are used only there) for the others adding a
provider may be the way to go.

> 
> Or are you suggesting that some other "balancer"
> which completely bypasses mod_proxy (and, in fact,
> replaces mod_proxy) could be using that scoreboard
> entry?

Well such a tool could use its own shared memory but yes making lb_score
opaque in scoreboard.c will allow to write such modules.

> 
> Again, as I said, my main issues were that (1) we
> were trying to pretend that lb_score != proxy_worker_stat
> when, in fact, they are and, if anyone tried to use
> it otherwise, things would break nastily. So why the
> weird indirection? Not elegant at all :) 

Agreed I had problem with that while experimenting in
httpd-proxy-scoreboard. It is "hard" to do that in mod_proxy but easy to
 do between mod_proxy and the scoreboard so why not doing it?

> and (2)
> I can't see creating 1k chunks for each entry when
> each one really only needs ~160-200 bytes (depending
> on int and other sizes) and (3) if, for some reason,
> proxy_worker_stat does increase, we need to always
> make sure that things sync up enough with the entry
> in scoreboard.h that we really have enough space.
> 
> And once again, the *real* fix is changing our usage
> and allocation of the scoreboard, something set for
> 3.0. If people want that for 2.4, then cool.

One thing is what we store another thing is where we store it.
We are discussing what we store ;-)

Cheers

Jean-Frederic

> 
> 


Re: svn commit: r573264 - /httpd/httpd/trunk/include/scoreboard.h

Posted by Jim Jagielski <ji...@jaguNET.com>.
On Sep 10, 2007, at 8:24 AM, jean-frederic clere wrote:

> Jim Jagielski wrote:
>>
>> On Sep 10, 2007, at 6:37 AM, Plüm, Rüdiger, VF-Group wrote:
>>
>>>>
>>>> For example what about adding:
>>>> static APR_OPTIONAL_FN_TYPE(ap_proxy_lb_worker_size)
>>>> *proxy_lb_worker_size;
>>>> and use a void * in scoreboard and an int for the size?
>>>
>>> For me this sounds fine, but I would guess that Jim doesn't like
>>> the void * idea in the scoreboard.
>>>
>>
>> I don't mind it at all, if we use it because we don't know
>> what will be stored away or because we may use the storage
>> differently at different times. But this is never the
>> case. lb_score always is proxy_worker_stat.
>>
>>
>
> My point goes with the comment in the code:
> +++
> /* stuff which is lb specific */
> typedef proxy_worker_stat lb_score;
> +++
> A custom balancer may have a different proxy_worker_stat, so in fact
> only modules/proxy/mod_proxy_balancer.c should know what the
> proxy_worker_stat structure contains.
>

I'm not sure what you mean. mod_proxy does, in child_init,
the calls to create those scoreboard entries. It does
so via ap_proxy_initialize_worker_share(). No matter
what, the ->s is set to:

    worker->s = (proxy_worker_stat *)score;

If some other struct is used then lots and lots of
other code needs to be changed to make lb_score and
mod_proxy *really* opaque to each other.

Or are you suggesting that some other "balancer"
which completely bypasses mod_proxy (and, in fact,
replaces mod_proxy) could be using that scoreboard
entry?

Again, as I said, my main issues were that (1) we
were trying to pretend that lb_score != proxy_worker_stat
when, in fact, they are and, if anyone tried to use
it otherwise, things would break nastily. So why the
weird indirection? Not elegant at all :) and (2)
I can't see creating 1k chunks for each entry when
each one really only needs ~160-200 bytes (depending
on int and other sizes) and (3) if, for some reason,
proxy_worker_stat does increase, we need to always
make sure that things sync up enough with the entry
in scoreboard.h that we really have enough space.

And once again, the *real* fix is changing our usage
and allocation of the scoreboard, something set for
3.0. If people want that for 2.4, then cool.


Re: svn commit: r573264 - /httpd/httpd/trunk/include/scoreboard.h

Posted by jean-frederic clere <jf...@gmail.com>.
Jim Jagielski wrote:
> 
> On Sep 10, 2007, at 6:37 AM, Plüm, Rüdiger, VF-Group wrote:
> 
>>>
>>> For example what about adding:
>>> static APR_OPTIONAL_FN_TYPE(ap_proxy_lb_worker_size)
>>> *proxy_lb_worker_size;
>>> and use a void * in scoreboard and an int for the size?
>>
>> For me this sounds fine, but I would guess that Jim doesn't like
>> the void * idea in the scoreboard.
>>
> 
> I don't mind it at all, if we use it because we don't know
> what will be stored away or because we may use the storage
> differently at different times. But this is never the
> case. lb_score always is proxy_worker_stat.
> 
> 

My point goes with the comment in the code:
+++
/* stuff which is lb specific */
typedef proxy_worker_stat lb_score;
+++
A custom balancer may have a different proxy_worker_stat, so in fact
only modules/proxy/mod_proxy_balancer.c should know what the
proxy_worker_stat structure contains.

Cheers

Jean-Frederic


Re: svn commit: r573264 - /httpd/httpd/trunk/include/scoreboard.h

Posted by Jim Jagielski <ji...@jaguNET.com>.
On Sep 10, 2007, at 6:37 AM, Plüm, Rüdiger, VF-Group wrote:

>>
>> For example what about adding:
>> static APR_OPTIONAL_FN_TYPE(ap_proxy_lb_worker_size)
>> *proxy_lb_worker_size;
>> and use a void * in scoreboard and an int for the size?
>
> For me this sounds fine, but I would guess that Jim doesn't like
> the void * idea in the scoreboard.
>

I don't mind it at all, if we use it because we don't know
what will be stored away or because we may use the storage
differently at different times. But this is never the
case. lb_score always is proxy_worker_stat.


Re: svn commit: r573264 - /httpd/httpd/trunk/include/scoreboard.h

Posted by Plüm, Rüdiger, VF-Group <ru...@vodafone.com>.

> -----Ursprüngliche Nachricht-----
> Von: jean-frederic clere 
> Gesendet: Montag, 10. September 2007 12:01
> An: dev@httpd.apache.org
> Betreff: Re: svn commit: r573264 - 
> /httpd/httpd/trunk/include/scoreboard.h
> 
> 
> Jim Jagielski wrote:
> > Ruediger Pluem wrote:
> >>
> >> Because it was
> >>
> >> int ap_proxy_lb_workers(void);
> >>
> >> and not
> >>
> >> PROXY_DECLARE(int)ap_proxy_lb_workers(void);
> >>
> > 
> > Yep. Ideally, of course, a design like mod_ssl with the
> > ssl_private.h usage is nice, because there you can
> > expose functions that need to be shared amoung files
> > (without each one having lines and lines of 'extern foo'
> > sillyness) without "leaking" them out anyplace
> > else.
> > 
> 
> For example what about adding:
> static APR_OPTIONAL_FN_TYPE(ap_proxy_lb_worker_size) 
> *proxy_lb_worker_size;
> and use a void * in scoreboard and an int for the size?

For me this sounds fine, but I would guess that Jim doesn't like
the void * idea in the scoreboard.

Regards

Rüdiger


Re: svn commit: r573264 - /httpd/httpd/trunk/include/scoreboard.h

Posted by jean-frederic clere <jf...@gmail.com>.
Jim Jagielski wrote:
> Ruediger Pluem wrote:
>>
>> Because it was
>>
>> int ap_proxy_lb_workers(void);
>>
>> and not
>>
>> PROXY_DECLARE(int)ap_proxy_lb_workers(void);
>>
> 
> Yep. Ideally, of course, a design like mod_ssl with the
> ssl_private.h usage is nice, because there you can
> expose functions that need to be shared amoung files
> (without each one having lines and lines of 'extern foo'
> sillyness) without "leaking" them out anyplace
> else.
> 

For example what about adding:
static APR_OPTIONAL_FN_TYPE(ap_proxy_lb_worker_size) *proxy_lb_worker_size;
and use a void * in scoreboard and an int for the size?

Cheers

Jean-Frederic


Re: svn commit: r573264 - /httpd/httpd/trunk/include/scoreboard.h

Posted by Jim Jagielski <ji...@jaguNET.com>.
Ruediger Pluem wrote:
> 
> 
> Because it was
> 
> int ap_proxy_lb_workers(void);
> 
> and not
> 
> PROXY_DECLARE(int)ap_proxy_lb_workers(void);
> 

Yep. Ideally, of course, a design like mod_ssl with the
ssl_private.h usage is nice, because there you can
expose functions that need to be shared amoung files
(without each one having lines and lines of 'extern foo'
sillyness) without "leaking" them out anyplace
else.

-- 
===========================================================================
   Jim Jagielski   [|]   jim@jaguNET.com   [|]   http://www.jaguNET.com/
	    "If you can dodge a wrench, you can dodge a ball."

Re: svn commit: r573264 - /httpd/httpd/trunk/include/scoreboard.h

Posted by Ruediger Pluem <rp...@apache.org>.

On 09/09/2007 07:24 PM, Jim Jagielski wrote:
> 
> On Sep 7, 2007, at 6:20 PM, Ruediger Pluem wrote:
> 
>>
>>
>> On 09/07/2007 03:03 PM, Jim Jagielski wrote:
>>>
>>> On Sep 7, 2007, at 6:29 AM, jean-frederic clere wrote:
>>>
>>>>
>>>> I think I have patched it. Could you try it?
>>>>
>>>
>>> Ahh... this is much nicer that my idea of breaking out
>>> the data struct defs from the rest of mod_proxy.h
>>
>> I do not share this view and think that we should do this
>> differently (haven't worked out a patch so far).
>>
>> 1. IMHO we change the public API with jean-frederic's patch
>>    (we remove ap_proxy_lb_workers from mod_proxy.h so a major
>>     bump would be due IMHO).
>>
> 
> FWIW, I don't agree with that. ap_proxy_lb_workers() was
> not and is not part of the public API for mod_proxy.
> It was never declared as such. From what I can see, it

Just out of curiosity: Why?

Because it was

int ap_proxy_lb_workers(void);

and not

PROXY_DECLARE(int)ap_proxy_lb_workers(void);

?

Regards

Rüdiger


Re: svn commit: r573264 - /httpd/httpd/trunk/include/scoreboard.h

Posted by Jim Jagielski <ji...@jaguNET.com>.
On Sep 7, 2007, at 6:20 PM, Ruediger Pluem wrote:

>
>
> On 09/07/2007 03:03 PM, Jim Jagielski wrote:
>>
>> On Sep 7, 2007, at 6:29 AM, jean-frederic clere wrote:
>>
>>>
>>> I think I have patched it. Could you try it?
>>>
>>
>> Ahh... this is much nicer that my idea of breaking out
>> the data struct defs from the rest of mod_proxy.h
>
> I do not share this view and think that we should do this
> differently (haven't worked out a patch so far).
>
> 1. IMHO we change the public API with jean-frederic's patch
>    (we remove ap_proxy_lb_workers from mod_proxy.h so a major
>     bump would be due IMHO).
>

FWIW, I don't agree with that. ap_proxy_lb_workers() was
not and is not part of the public API for mod_proxy.
It was never declared as such. From what I can see, it
was added in mod_proxy.h simply because the original
patch wanted it defined in proxy_util.c but used in
mod_proxy.c and so added it to mod_proxy.h.

A case could be made for extern int PROXY_DECLARE_DATA proxy_lb_workers
which, upon 2nd and 3rd glance, should be re-added
and can be by simply renaming the confusingly-name
proxy_lb_workers pointer in scoreboard.c. I will do this
later on today.


Re: svn commit: r573264 - /httpd/httpd/trunk/include/scoreboard.h

Posted by Ruediger Pluem <rp...@apache.org>.

On 09/07/2007 03:03 PM, Jim Jagielski wrote:
> 
> On Sep 7, 2007, at 6:29 AM, jean-frederic clere wrote:
> 
>>
>> I think I have patched it. Could you try it?
>>
> 
> Ahh... this is much nicer that my idea of breaking out
> the data struct defs from the rest of mod_proxy.h

I do not share this view and think that we should do this
differently (haven't worked out a patch so far).

1. IMHO we change the public API with jean-frederic's patch
   (we remove ap_proxy_lb_workers from mod_proxy.h so a major
    bump would be due IMHO).

2. I do not like the very close coupling of scoreboard.h and mod_proxy via
   the inclusion of mod_proxy.h.
   By having ap_proxy_lb_workers as an optional function we decoupled both
   as far as possible. The only reasons I see why we define a more or less
   useful type for lb_score is that

   1. We need the size of the struct for the calculation of the scoreboard
      size.
   2. We need the size of the struct in ap_get_scoreboard_lb to get
      the correct worker slot.

   Why don't we do this with another optional function that just delivers
   the size of proxy_worker_stat and use an incomplete type for lb_score
   that hides all the details like we do in APR?
   Then we could do something like
        typedef struct proxy_worker_stat lb_score
   in scoreboard.h.

   and do something like

   return (lb_score *) (&((char *) (ap_scoreboard_image->balancers))[lb_size * lb_num]);

   in ap_get_scoreboard_lb
   where lb_size is the size of the struct (saved in a static var like we do with
   lb_limit) or we do something like
       typedef char lb_score
   in scoreboard.h.

   and do something like

   return &ap_scoreboard_image->balancers[lb_size * lb_num];

Regards

Rüdiger


Re: svn commit: r573264 - /httpd/httpd/trunk/include/scoreboard.h

Posted by Jim Jagielski <ji...@jaguNET.com>.
On Sep 7, 2007, at 6:29 AM, jean-frederic clere wrote:

>
> I think I have patched it. Could you try it?
>

Ahh... this is much nicer that my idea of breaking out
the data struct defs from the rest of mod_proxy.h

And its more logical this way as well...

Compiles clean... testing now.

Too burned out from all this RM madness :)

Re: svn commit: r573264 - /httpd/httpd/trunk/include/scoreboard.h

Posted by jean-frederic clere <jf...@gmail.com>.
Martin Kraemer wrote:
> On Fri, Sep 07, 2007 at 10:30:13AM +0200, jean-frederic clere wrote:
>> That is going to break:
>> In mod_proxy.h:
>> int ap_proxy_lb_workers(void);
>> In server/scoreboard.c:
>> +++
>> static APR_OPTIONAL_FN_TYPE(ap_proxy_lb_workers)
>>                                 *proxy_lb_workers;
>> +++
> 
> Yes, it breaks:
> 
> scoreboard.c: In function `ap_calc_scoreboard_size':
> scoreboard.c:108: sizeof applied to an incomplete type
> scoreboard.c: In function `ap_init_scoreboard':
> scoreboard.c:134: sizeof applied to an incomplete type
> scoreboard.c: In function `ap_create_scoreboard':
> scoreboard.c:286: sizeof applied to an incomplete type
> scoreboard.c: In function `ap_get_scoreboard_lb':
> scoreboard.c:496: arithmetic on pointer to an incomplete type
> scoreboard.c:496: dereferencing pointer to incomplete type

I think I have patched it. Could you try it?

Cheers

Jean-Frederic

> 
>   Martin


Re: svn commit: r573264 - /httpd/httpd/trunk/include/scoreboard.h

Posted by Martin Kraemer <ma...@apache.org>.
On Fri, Sep 07, 2007 at 10:30:13AM +0200, jean-frederic clere wrote:
> That is going to break:
> In mod_proxy.h:
> int ap_proxy_lb_workers(void);
> In server/scoreboard.c:
> +++
> static APR_OPTIONAL_FN_TYPE(ap_proxy_lb_workers)
>                                 *proxy_lb_workers;
> +++

Yes, it breaks:

scoreboard.c: In function `ap_calc_scoreboard_size':
scoreboard.c:108: sizeof applied to an incomplete type
scoreboard.c: In function `ap_init_scoreboard':
scoreboard.c:134: sizeof applied to an incomplete type
scoreboard.c: In function `ap_create_scoreboard':
scoreboard.c:286: sizeof applied to an incomplete type
scoreboard.c: In function `ap_get_scoreboard_lb':
scoreboard.c:496: arithmetic on pointer to an incomplete type
scoreboard.c:496: dereferencing pointer to incomplete type

  Martin
-- 
<Ma...@Fujitsu-Siemens.com>        |     Fujitsu Siemens
http://www.fujitsu-siemens.com/imprint.html | 81730  Munich,  Germany