You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@trafficserver.apache.org by zw...@apache.org on 2010/08/23 04:35:30 UTC

svn commit: r987979 - /trafficserver/traffic/trunk/proxy/InkAPI.cc

Author: zwoop
Date: Mon Aug 23 02:35:30 2010
New Revision: 987979

URL: http://svn.apache.org/viewvc?rev=987979&view=rev
Log:
TS-419: Segmentation fault in INKError when error output is made both in error log and as debug messages

Author: Yakov Markovitch
Review and minor changes: Leif

Modified:
    trafficserver/traffic/trunk/proxy/InkAPI.cc

Modified: trafficserver/traffic/trunk/proxy/InkAPI.cc
URL: http://svn.apache.org/viewvc/trafficserver/traffic/trunk/proxy/InkAPI.cc?rev=987979&r1=987978&r2=987979&view=diff
==============================================================================
--- trafficserver/traffic/trunk/proxy/InkAPI.cc (original)
+++ trafficserver/traffic/trunk/proxy/InkAPI.cc Mon Aug 23 02:35:30 2010
@@ -393,10 +393,13 @@ void
 INKError(const char *fmt, ...)
 {
   va_list args;
-  va_start(args, fmt);
+
   if (is_action_tag_set("deft") || is_action_tag_set("sdk_vbos_errors")) {
+    va_start(args, fmt);
     diags->print_va(NULL, DL_Error, NULL, NULL, fmt, args);
+    va_end(args);
   }
+  va_start(args, fmt);
   Log::va_error((char *) fmt, args);
   va_end(args);
 }



Re: svn commit: r987979 - /trafficserver/traffic/trunk/proxy/InkAPI.cc

Posted by Leif Hedstrom <zw...@apache.org>.
  On 08/22/2010 11:37 PM, Mladen Turk wrote:
> On 08/23/2010 04:35 AM, zwoop@apache.org wrote:
>> Author: zwoop
>> Author: Yakov Markovitch
>> Review and minor changes: Leif
>>
>>     if (is_action_tag_set("deft") || 
>> is_action_tag_set("sdk_vbos_errors")) {
>
> If va_start/va_end is used multiple times within a function,
> va_copy should be used thought.

Is that really worth it? This case is an extremely verbose debug mode 
anyways, so performance can't be an issue. And the man-page clearly 
indicates that it's OK to call va_start() / va_end() multiple times:

     "Multiple traversals of the list, each bracketed by va_start() and 
va_end() are possible."


But, if the consensus is that we ought to use va_copy(), I have no 
problems fixing this patch.

-- leif


Re: svn commit: r987979 - /trafficserver/traffic/trunk/proxy/InkAPI.cc

Posted by Leif Hedstrom <zw...@apache.org>.
  On 08/22/2010 11:37 PM, Mladen Turk wrote:
> On 08/23/2010 04:35 AM, zwoop@apache.org wrote:
>> Author: zwoop
>> Author: Yakov Markovitch
>> Review and minor changes: Leif
>>
>>     if (is_action_tag_set("deft") || 
>> is_action_tag_set("sdk_vbos_errors")) {
>
> If va_start/va_end is used multiple times within a function,
> va_copy should be used thought.

Is that really worth it? This case is an extremely verbose debug mode 
anyways, so performance can't be an issue. And the man-page clearly 
indicates that it's OK to call va_start() / va_end() multiple times:

     "Multiple traversals of the list, each bracketed by va_start() and 
va_end() are possible."


But, if the consensus is that we ought to use va_copy(), I have no 
problems fixing this patch.

-- leif


Re: svn commit: r987979 - /trafficserver/traffic/trunk/proxy/InkAPI.cc

Posted by Mladen Turk <mt...@apache.org>.
On 08/23/2010 04:35 AM, zwoop@apache.org wrote:
> Author: zwoop
> Author: Yakov Markovitch
> Review and minor changes: Leif
>
>     if (is_action_tag_set("deft") || is_action_tag_set("sdk_vbos_errors")) {

If va_start/va_end is used multiple times within a function,
va_copy should be used thought.


> +    va_start(args, fmt);
>       diags->print_va(NULL, DL_Error, NULL, NULL, fmt, args);
> +    va_end(args);
>     }
> +  va_start(args, fmt);
>     Log::va_error((char *) fmt, args);
>     va_end(args);
>   }
>
>
>
>

Regards
-- 
^TM