Re: svn commit: r1725523 - in /httpd/httpd/trunk/modules/proxy: mod_proxy.h mod_proxy_hcheck.c

2016-01-19 Thread Ruediger Pluem


On 01/19/2016 03:14 PM, j...@apache.org wrote:
> Author: jim
> Date: Tue Jan 19 14:14:27 2016
> New Revision: 1725523
> 
> URL: http://svn.apache.org/viewvc?rev=1725523&view=rev
> Log:
> For OPTIONS and HEAD, only 2xx and 3xx are considered "passing"
> (until I implement the conditions expr testing)... honor
> the pass/fail count and LOG_INFO when the health check enables
> or disables a backend worker.
> 
> Modified:
> httpd/httpd/trunk/modules/proxy/mod_proxy.h
> httpd/httpd/trunk/modules/proxy/mod_proxy_hcheck.c
> 

> 
> Modified: httpd/httpd/trunk/modules/proxy/mod_proxy_hcheck.c
> URL: 
> http://svn.apache.org/viewvc/httpd/httpd/trunk/modules/proxy/mod_proxy_hcheck.c?rev=1725523&r1=1725522&r2=1725523&view=diff
> ==
> --- httpd/httpd/trunk/modules/proxy/mod_proxy_hcheck.c (original)
> +++ httpd/httpd/trunk/modules/proxy/mod_proxy_hcheck.c Tue Jan 19 14:14:27 
> 2016

> @@ -647,10 +662,29 @@ static void hc_check(sctx_t *ctx, apr_po
>   "Somehow tried to use unimplemented hcheck method: 
> %d", (int)worker->s->method);
>  return;
>  }
> -/* TODO Honor fails and passes */
> -ap_proxy_set_wstatus('#', (rv == APR_SUCCESS ? 0 : 1), worker);
> -if (rv != APR_SUCCESS) {
> -worker->s->error_time = now;
> +/* what state are we in ? */
> +if (PROXY_WORKER_IS_HCFAILED(worker)) {
> +if (rv == APR_SUCCESS) {
> +worker->s->pcount += 1;
> +if (worker->s->pcount >= worker->s->passes) {
> +ap_proxy_set_wstatus('#', 0, worker);
> +worker->s->pcount = 0;
> +ap_log_error(APLOG_MARK, APLOG_INFO, 0, s, APLOGNO()
> + "Health check re-enabling %s", worker->s->name);
> +
> +}
> +}
> +} else {
> +if (rv != APR_SUCCESS) {
> +worker->s->error_time = now;
> +worker->s->fcount += 1;
> +if (worker->s->fcount >= worker->s->fails) {
> +ap_proxy_set_wstatus('#', 1, worker);

Wouldn't it be better to use the define from mod_proxy.h instead of the literal?

> +worker->s->fcount = 0;
> +ap_log_error(APLOG_MARK, APLOG_INFO, 0, s, APLOGNO()
> + "Health check disabling %s", worker->s->name);
> +}
> +}
>  }
>  worker->s->updated = now;
>  }
> 
> 
> 


Regards

Rüdiger


Re: svn commit: r1725523 - in /httpd/httpd/trunk/modules/proxy: mod_proxy.h mod_proxy_hcheck.c

2016-01-19 Thread Jim Jagielski

> On Jan 19, 2016, at 11:09 AM, Ruediger Pluem  wrote:
> 
>> +} else {
>> +if (rv != APR_SUCCESS) {
>> +worker->s->error_time = now;
>> +worker->s->fcount += 1;
>> +if (worker->s->fcount >= worker->s->fails) {
>> +ap_proxy_set_wstatus('#', 1, worker);
> 
> Wouldn't it be better to use the define from mod_proxy.h instead of the 
> literal?
> 

??

Using ap_proxy_set_wstatus() is the standard method for setting
or clearing the bits in the worker status.

Re: svn commit: r1725523 - in /httpd/httpd/trunk/modules/proxy: mod_proxy.h mod_proxy_hcheck.c

2016-01-19 Thread Ruediger Pluem


On 01/19/2016 06:45 PM, Jim Jagielski wrote:
> 
>> On Jan 19, 2016, at 11:09 AM, Ruediger Pluem  wrote:
>>
>>> +} else {
>>> +if (rv != APR_SUCCESS) {
>>> +worker->s->error_time = now;
>>> +worker->s->fcount += 1;
>>> +if (worker->s->fcount >= worker->s->fails) {
>>> +ap_proxy_set_wstatus('#', 1, worker);
>>
>> Wouldn't it be better to use the define from mod_proxy.h instead of the 
>> literal?
>>
> 
> ??
> 
> Using ap_proxy_set_wstatus() is the standard method for setting
> or clearing the bits in the worker status.
> 

Sorry for being confusing I meant using PROXY_WORKER_HC_FAIL_FLAG instead of 
'#'.

Regards

Rüdiger


Re: svn commit: r1725523 - in /httpd/httpd/trunk/modules/proxy: mod_proxy.h mod_proxy_hcheck.c

2016-01-19 Thread Jim Jagielski
Ahhh... yeah, I guess updating all the usages to do
that makes sense.

thx!

> On Jan 19, 2016, at 1:59 PM, Ruediger Pluem  wrote:
> 
> 
> 
> On 01/19/2016 06:45 PM, Jim Jagielski wrote:
>> 
>>> On Jan 19, 2016, at 11:09 AM, Ruediger Pluem  wrote:
>>> 
 +} else {
 +if (rv != APR_SUCCESS) {
 +worker->s->error_time = now;
 +worker->s->fcount += 1;
 +if (worker->s->fcount >= worker->s->fails) {
 +ap_proxy_set_wstatus('#', 1, worker);
>>> 
>>> Wouldn't it be better to use the define from mod_proxy.h instead of the 
>>> literal?
>>> 
>> 
>> ??
>> 
>> Using ap_proxy_set_wstatus() is the standard method for setting
>> or clearing the bits in the worker status.
>> 
> 
> Sorry for being confusing I meant using PROXY_WORKER_HC_FAIL_FLAG instead of 
> '#'.
> 
> Regards
> 
> Rüdiger



Re: svn commit: r1725523 - in /httpd/httpd/trunk/modules/proxy: mod_proxy.h mod_proxy_hcheck.c

2016-01-19 Thread Rainer Jung

Am 19.01.2016 um 20:02 schrieb Jim Jagielski:

Ahhh... yeah, I guess updating all the usages to do
that makes sense.


Done in r1725602.


On Jan 19, 2016, at 1:59 PM, Ruediger Pluem  wrote:



On 01/19/2016 06:45 PM, Jim Jagielski wrote:



On Jan 19, 2016, at 11:09 AM, Ruediger Pluem  wrote:


+} else {
+if (rv != APR_SUCCESS) {
+worker->s->error_time = now;
+worker->s->fcount += 1;
+if (worker->s->fcount >= worker->s->fails) {
+ap_proxy_set_wstatus('#', 1, worker);


Wouldn't it be better to use the define from mod_proxy.h instead of the literal?



??

Using ap_proxy_set_wstatus() is the standard method for setting
or clearing the bits in the worker status.



Sorry for being confusing I meant using PROXY_WORKER_HC_FAIL_FLAG instead of 
'#'.

Regards

Rüdiger


Re: svn commit: r1725523 - in /httpd/httpd/trunk/modules/proxy: mod_proxy.h mod_proxy_hcheck.c

2016-01-21 Thread Jim Jagielski
Thx!

BTW, do you have pointers on how to use your "new" Coccinelle/spatch
script to assign AH log numbers?

> On Jan 19, 2016, at 2:44 PM, Rainer Jung  wrote:
> 
> Am 19.01.2016 um 20:02 schrieb Jim Jagielski:
>> Ahhh... yeah, I guess updating all the usages to do
>> that makes sense.
> 
> Done in r1725602.
> 
>>> On Jan 19, 2016, at 1:59 PM, Ruediger Pluem  wrote:
>>> 
>>> 
>>> 
>>> On 01/19/2016 06:45 PM, Jim Jagielski wrote:
 
> On Jan 19, 2016, at 11:09 AM, Ruediger Pluem  wrote:
> 
>> +} else {
>> +if (rv != APR_SUCCESS) {
>> +worker->s->error_time = now;
>> +worker->s->fcount += 1;
>> +if (worker->s->fcount >= worker->s->fails) {
>> +ap_proxy_set_wstatus('#', 1, worker);
> 
> Wouldn't it be better to use the define from mod_proxy.h instead of the 
> literal?
> 
 
 ??
 
 Using ap_proxy_set_wstatus() is the standard method for setting
 or clearing the bits in the worker status.
 
>>> 
>>> Sorry for being confusing I meant using PROXY_WORKER_HC_FAIL_FLAG instead 
>>> of '#'.
>>> 
>>> Regards
>>> 
>>> Rüdiger



Re: svn commit: r1725523 - in /httpd/httpd/trunk/modules/proxy: mod_proxy.h mod_proxy_hcheck.c

2016-01-21 Thread Rainer Jung

Hi Jim,

Am 21.01.2016 um 15:35 schrieb Jim Jagielski:

BTW, do you have pointers on how to use your "new" Coccinelle/spatch
script to assign AH log numbers?


first I had to build OCAML and coccinelle (which provides spatch) on 
Solaris. As usual not much fun. I assume, you can find ready-to-go 
packages for those in your favorite Linux package repos. So I spare you 
those details.


Then I followed the simple description in docs/log-message-tags/README, 
especially running


DIR=docs/log-message-tags
spatch -sp_file $DIR/find-messages.cocci \
-in_place \
-macro_file $DIR/macros.h FILESTOCHECK

where FILESTOCHECK is the list of C files you want spatch to work on.

The spatch patch (the cocci file) adds "APLOGNO()," to all eligible log 
statements it identifies. To finally replace the empty "APLOGNO()," with 
a real number, I ran


perl docs/log-message-tags/update-log-msg-tags FILESTOFIX

It will put real numbers in and update docs/log-message-tags/next-number.

There's also a make task, which I didn't use.

If your version of spatch (coccinelle) isn't build with pcre support 
(mine on Solaris wasn't) you need to fix the 
docs/log-message-tags/find-messages.cocci file. In all lines defining a 
regexp (look for "=~") replace all "|" by "\|" and all "(" resp. ")" 
with "\(" and "\)" because that is the default regexp style in ocaml.


HTH!

Regards,

Rainer



Re: svn commit: r1725523 - in /httpd/httpd/trunk/modules/proxy: mod_proxy.h mod_proxy_hcheck.c

2016-01-21 Thread Jim Jagielski
THX!

> On Jan 21, 2016, at 10:12 AM, Rainer Jung  wrote:
> 
> Hi Jim,
> 
> Am 21.01.2016 um 15:35 schrieb Jim Jagielski:
>> BTW, do you have pointers on how to use your "new" Coccinelle/spatch
>> script to assign AH log numbers?
> 
> first I had to build OCAML and coccinelle (which provides spatch) on Solaris. 
> As usual not much fun. I assume, you can find ready-to-go packages for those 
> in your favorite Linux package repos. So I spare you those details.
> 
> Then I followed the simple description in docs/log-message-tags/README, 
> especially running
> 
> DIR=docs/log-message-tags
> spatch -sp_file $DIR/find-messages.cocci \
> -in_place \
> -macro_file $DIR/macros.h FILESTOCHECK
> 
> where FILESTOCHECK is the list of C files you want spatch to work on.
> 
> The spatch patch (the cocci file) adds "APLOGNO()," to all eligible log 
> statements it identifies. To finally replace the empty "APLOGNO()," with a 
> real number, I ran
> 
> perl docs/log-message-tags/update-log-msg-tags FILESTOFIX
> 
> It will put real numbers in and update docs/log-message-tags/next-number.
> 
> There's also a make task, which I didn't use.
> 
> If your version of spatch (coccinelle) isn't build with pcre support (mine on 
> Solaris wasn't) you need to fix the docs/log-message-tags/find-messages.cocci 
> file. In all lines defining a regexp (look for "=~") replace all "|" by "\|" 
> and all "(" resp. ")" with "\(" and "\)" because that is the default regexp 
> style in ocaml.
> 
> HTH!
> 
> Regards,
> 
> Rainer
>