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

Race setting max_entries during eviction

    • Type: Icon: Bug Bug
    • Resolution: Done
    • Priority: Icon: Major - P3 Major - P3
    • WT2.9.0, 3.2.11, 3.4.0-rc2
    • Affects Version/s: None
    • Component/s: None
    • None
    • Storage 2016-10-31

      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.

            Assignee:
            michael.cahill@mongodb.com Michael Cahill (Inactive)
            Reporter:
            michael.cahill@mongodb.com Michael Cahill (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated:
              Resolved: