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

Fix invalid memory access of session->pf.prefetch_prev_ref

    • Type: Icon: Bug Bug
    • Resolution: Fixed
    • Priority: Icon: Major - P3 Major - P3
    • WT11.3.0, 8.0.0-rc0, 7.3.0-rc2
    • Affects Version/s: None
    • Component/s: None
    • None
    • Storage Engines
    • 8
    • StorEng - 2024-01-23, 2024-02-06 tapioooooooooooooca

      While conducting performance benchmarking of introducing the pre-fetch functionality into WiredTiger, a specific scenario leading to a segmentation fault was encountered. It happens when spawning many threads in the pre-fetch utility (e.g. 16 threads will consistently reproduce the failure), and then doing a verify operation on a database in a slow disk scenario.

      A segmentation fault occurs when trying to access the session->pf.prefetch_prev_ref variable in the following check:

      if (session->pf.prefetch_prev_ref->page == ref->home &&
            session->pf.prefetch_skipped_with_parent < WT_PREFETCH_QUEUE_PER_TRIGGER)
      

      The strange thing is that directly above this conditional check, we are already checking that session->pf.prefetch_prev_ref is not NULL. Therefore, it seems that either one of the following scenarios is happening:

      • A pre-fetch thread is racing with another pre-fetch thread, implying that the multithreading of the pre-fetch utility was not properly implemented.
      • We wrongly assume the lifecycle of the session->pf.prefetch_prev_ref variable and try to access it when it is not guaranteed to be valid.

            Assignee:
            clarisse.cheah@mongodb.com Clarisse Cheah
            Reporter:
            monica.ng@mongodb.com Monica Ng
            Monica Ng
            Votes:
            0 Vote for this issue
            Watchers:
            6 Start watching this issue

              Created:
              Updated:
              Resolved: