apr-bugs mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From bugzi...@apache.org
Subject DO NOT REPLY [Bug 44587] New: apr_memcache. c not correctly parsing rusage times, always returns zero
Date Tue, 11 Mar 2008 22:12:45 GMT

           Summary: apr_memcache.c not correctly parsing rusage times,
                    always returns zero
           Product: APR
           Version: HEAD
          Platform: PC
        OS/Version: Linux
            Status: NEW
          Severity: normal
          Priority: P3
         Component: APR-util
        AssignedTo: bugs@apr.apache.org
        ReportedBy: bryantscott@gmail.com

Created an attachment (id=21655)
 --> (https://issues.apache.org/bugzilla/attachment.cgi?id=21655)
apr_memcache.c patch for correctly parsing rusage in stats data

The stat_read_rtime in file apr_memcache.c isn't correctly parsing the rusage
times returned by memcached.  The times are returned as secs.usecs.  The code
attempts to handle this, but fails because the return value from apr_strtok
returns the full secs.usecs string rather than NULL when trying to parse the
time string with the default colon separator.  Thus the code within the
subsequent if block to try to parse with the dot separator never gets executed.
 The end result is to always return zero rusage times.

I simply added dot to the separator list.  I also removed the if block since it
is no longer needed.  Patch file generated with diff -u against revision 587284
of apr_util.c is attached and also included below.

--- apr_memcache_old.c
+++ apr_memcache.c
@@ -1517,15 +1517,11 @@
     char *tok;
     char *secs;
     char *usecs;
-    const char *sep = ":";
+    const char *sep = ":.";

     buf[len-2] = '\0';

     secs = apr_strtok(buf, sep, &tok);
-    if (secs == NULL) {
-        sep = ".";
-        secs = apr_strtok(buf, sep, &tok);
-    }
     usecs = apr_strtok(NULL, sep, &tok);
     if (secs && usecs) {
         return apr_time_make(atoi(secs), atoi(usecs));

Configure bugmail: https://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.

To unsubscribe, e-mail: bugs-unsubscribe@apr.apache.org
For additional commands, e-mail: bugs-help@apr.apache.org

View raw message