Bug 56667

Summary: "commit_all_members" logs wrong "to" activation state
Product: Tomcat Connectors Reporter: Martin Knoblauch <knobi>
Component: mod_jkAssignee: Tomcat Developers Mailing List <dev>
Status: RESOLVED FIXED    
Severity: normal    
Priority: P2    
Version: 1.2.40   
Target Milestone: ---   
Hardware: PC   
OS: Linux   
Attachments: modify output of activation change logging

Description Martin Knoblauch 2014-06-24 15:01:08 UTC
When changing the activation state using "Edit all members", instead of logging the new state, the old state is logged. This is massively confusing.

To solve this problem, the code changing the state needs to be moved before the logging statement:

--- common/jk_status.c-orig	2014-06-24 16:54:51.000000000 +0200
+++ common/jk_status.c	2014-06-24 16:55:19.000000000 +0200
@@ -3601,10 +3601,10 @@
                     if (rv == JK_TRUE) {
                         i = jk_lb_get_activation_code(arg);
                         if (i != wr->activation && i >= 0 && i <= JK_LB_ACTIVATION_MAX) {
+                            wr->activation = i;
                             jk_log(l, JK_LOG_INFO,
                                    "Status worker '%s' setting 'activation' for sub worker '%s' of lb worker '%s' to '%s'",
                                    w->name, wr->name, name, jk_lb_get_activation(wr, l));
-                            wr->activation = i;
                             rc = 1;
                             sync_needed = JK_TRUE;
                         }

While working on this, I found that logging both old and new state would be much more useful, like in:

[Tue Jun 24 16:49:55.412 2014] [28769:140012450096896] [info] commit_all_members::jk_status.c (3607): Status worker 'jkmanager' setting 'activation' for sub worker 'censored' of lb worker 'secret' from 'ACT' to 'DIS'

A patch for this format change is appended.
Comment 1 Martin Knoblauch 2014-06-24 15:15:50 UTC
Created attachment 31749 [details]
modify output of activation change logging
Comment 2 Rainer Jung 2014-07-10 21:42:51 UTC
Thanks for the report. I fixed the wrong log message in r1609574, but also took the opportunity to add logging of old and new values to all 22 log statements in status worker that trigger on attribute changes.

Those are the changes r1609566, r1609575 and r1609576.

It would be nice, if you could give it a try.

Regards,

Rainer
Comment 3 Martin Knoblauch 2014-07-24 09:30:25 UTC
Hi Rainer,

 thanks. Sorry for the stupid question: how can I check out the current source for mod_jk? Likely a FAQ, I know ...

Martin
Comment 4 Rainer Jung 2014-07-24 09:49:56 UTC
The sources are in subversion, so it would be

svn checkout http://svn.apache.org/repos/asf/tomcat/jk/trunk

The mod_jk sources are in the sub directory "native".

Now since this is native code, autotools are needed to generate the configure script. You can either run the script buildconf.sh in the native directory if you have the tools installed.

Or you can use

http://people.apache.org/~rjung/mod_jk-dev/tomcat-connectors-1.2.41-dev-1613051-src.tar.gz

which was created by myself a few minutes ago using the script tools/jkrelease.sh (tools is directly under trunk) and can be build just like a release - but it is a dev snapshot, not a release! Under http://people.apache.org/~rjung/mod_jk-dev/ you will also find checksum and signature files.

Regards,

Rainer
Comment 5 Martin Knoblauch 2014-07-24 09:56:12 UTC
Hi Rainer,

 just found out myself. Should have asked earlier :-)

Sure, I am aware that this is a development snapshot. I will use it with utmost care.

Thanks
Martin