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

Race of OplogFetcher access in TenantMigrationRecipientServiceTest.OplogApplierFails

    • Type: Icon: Bug Bug
    • Resolution: Fixed
    • Priority: Icon: Major - P3 Major - P3
    • 4.9.0
    • Affects Version/s: None
    • Component/s: None
    • Fully Compatible
    • ALL
    • Repl 2021-01-25
    • 0

      In this OplogApplierFails test, we use an OplogFetcherMock to feed an oplog entry that doesn't belong to the tenant to test that TenantOplogApplier fails the migration. When failing the migration, the main chain would call _cleanupOnDataSyncCompletion which would clean up and free the _donorOplogFetcher. But this could race with the test thread that calls oplogFetcher->receiveBatch which could end up accessing freed memory if the _donorOplogFetcher object is freed before the receiveBatch returns.

      To fix this, we could use the hangBeforeTaskCompletion failpoint to hang the main chain before _cleanupOnDataSyncCompletion is run.

            Assignee:
            lingzhi.deng@mongodb.com Lingzhi Deng
            Reporter:
            lingzhi.deng@mongodb.com Lingzhi Deng
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated:
              Resolved: