Fix undefined behavior in verbose output

XMLWordPrintableJSON

    • Type: Bug
    • Resolution: Fixed
    • Priority: Minor - P4
    • 3.6.3, 3.7.1, WT3.1.0
    • Affects Version/s: None
    • Component/s: None
    • None
    • Storage 2017-12-18
    • None

      This code to dump the cache state in evict_lru.c has undefined behavior:

              WT_RET(__wt_msg(session, "cache clean check: %s (%u%%)",
                  __wt_eviction_clean_needed(session, &pct) ? "yes" : "no", pct));
      

      In particular, it expects that the function setting pct completes before the value of pct is passed to __wt_msg.

      It would be better as:

              needed = __wt_eviction_clean_needed(session, &pct);
              WT_RET(__wt_msg(session, "cache clean check: %s (%u%%)",
                  needed ? "yes" : "no", pct));
      

      Review the code for similar issues.

            Assignee:
            Keith Bostic (Inactive)
            Reporter:
            Michael Cahill (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

              Created:
              Updated:
              Resolved: