Uploaded image for project: 'Core Server'
  1. Core Server
  2. SERVER-68154

Race in destruction of Resharding metrics can lead to calling pure virtual function

    XMLWordPrintableJSON

Details

    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: Major - P3 Major - P3
    • 6.1.0-rc0
    • None
    • None
    • None
    • Fully Compatible
    • ALL
    • Hide

      Apply repro.diff and run the cpp test

      Show
      Apply repro.diff and run the cpp test
    • Sharding 2022-07-11, Sharding 2022-07-25, Sharding 2022-08-08
    • 135

    Description

      Whenever ShardingDataTransformInstanceMetrics destructor is called, it will remove the observer to itself (here) from the ShardingDataTransformCumulativeMetrics. The issue is that ShardingDataTransformInstanceMetrics::getRecipientHighEstimateRemainingTimeMillis is a pure virtual function and by the time the destructor for ShardingDataTransformInstanceMetrics is being run, the child class is already destroyed (In production server, this is the ReshardingMetrics class). So there is a small window where the observer instance is still accessible and trying to call getRecipientHighEstimateRemaining on it will result in terminating the server.

      Attachments

        Activity

          People

            randolph@mongodb.com Randolph Tan
            randolph@mongodb.com Randolph Tan
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: