Uploaded image for project: 'WiredTiger'
  1. WiredTiger
  2. WT-2963

Race setting max_entries during eviction

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Major - P3
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: WT2.9.0, 3.2.11, 3.4.0-rc2
    • Labels:
      None
    • Sprint:
      Storage 2016-10-31

      Description

      lint flagged this code:

              /*
               * Another pathological case: if there are only a tiny number of
               * candidate pages in cache, don't put all of them on one queue.
               */
              if (F_ISSET(cache, WT_CACHE_EVICT_CLEAN))
                      max_entries = WT_MIN(max_entries,
                          1 + (uint32_t)(__wt_cache_pages_inuse(cache) / 2));
              else
                      max_entries = WT_MIN(max_entries,
                          1 + (uint32_t)(cache->pages_dirty_leaf / 2));
      

      Because WT_MIN() evaluates its arguments twice, lint notes __wt_cache_pages_inuse() could test less than max_entries, change, and then be greater than max_entries when assigned.

        Attachments

          Activity

            People

            • Assignee:
              michael.cahill Michael Cahill
              Reporter:
              michael.cahill Michael Cahill
            • Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: