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

XMLWordPrintableJSON

    • Type: Bug
    • Resolution: Fixed
    • Priority: Major - P3
    • 6.1.0-rc0
    • Affects Version/s: None
    • Component/s: 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
    • None
    • None
    • None
    • None
    • None
    • None
    • None

      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.

            Assignee:
            Randolph Tan
            Reporter:
            Randolph Tan
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated:
              Resolved: