Uploaded image for project: 'C Driver'
  1. C Driver
  2. CDRIVER-3624

handle_not_master_error calls _mongoc_topology_request_scan without locking topology mutex

    • Type: Icon: Bug Bug
    • Resolution: Fixed
    • Priority: Icon: Major - P3 Major - P3
    • 1.17.0-beta2, 1.17.0
    • Affects Version/s: None
    • Component/s: libmongoc
    • Labels:
      None

      Caught by TSAN:

      WARNING: ThreadSanitizer: data race (pid=44697)
        Read of size 1 at 0x7b640000407c by thread T3 (mutexes: write M83452262533316560):
          #0 _mongoc_topology_run_background mongoc-topology.c:1268 (test-libmongoc:x86_64+0x100308420)
      
        Previous write of size 1 at 0x7b640000407c by thread T23:
          #0 _mongoc_topology_request_scan mongoc-topology.c:1055 (test-libmongoc:x86_64+0x100307939)
          #1 handle_not_master_error mongoc-cluster.c:495 (test-libmongoc:x86_64+0x10028515d)
          #2 mongoc_cluster_run_command_monitored mongoc-cluster.c:655 (test-libmongoc:x86_64+0x100281697)
          #3 _mongoc_client_command_with_stream mongoc-client.c:1778 (test-libmongoc:x86_64+0x10027816a)
          #4 mongoc_client_command_simple mongoc-client.c:1820 (test-libmongoc:x86_64+0x100277f3e)
          #5 background_mongoc_client_command_simple future-functions.c:147 (test-libmongoc:x86_64+0x10008ebaf)
      
        Location is heap block of size 1280 at 0x7b6400003c00 allocated by main thread:
          #0 calloc <null>:1600560 (libclang_rt.tsan_osx_dynamic.dylib:x86_64h+0x50122)
          #1 bson_malloc0 bson-memory.c:108 (test-libmongoc:x86_64+0x10038e5cf)
          #2 mongoc_topology_new mongoc-topology.c:225 (test-libmongoc:x86_64+0x100305589)
          #3 mongoc_client_pool_new mongoc-client-pool.c:125 (test-libmongoc:x86_64+0x10027da2d)
          #4 _test_not_master test-mongoc-cluster.c:1052 (test-libmongoc:x86_64+0x100132ba0)
          #5 test_not_master_pooled_op_query test-mongoc-cluster.c:1134 (test-libmongoc:x86_64+0x10012e966)
          #6 TestSuite_RunTest TestSuite.c:586 (test-libmongoc:x86_64+0x10025b30a)
          #7 TestSuite_RunSerial TestSuite.c:857 (test-libmongoc:x86_64+0x10025a17d)
          #8 TestSuite_Run TestSuite.c:959 (test-libmongoc:x86_64+0x10025962d)
          #9 main test-libmongoc.c:2507 (test-libmongoc:x86_64+0x1000b9b3b)
      

            Assignee:
            kevin.albertson@mongodb.com Kevin Albertson
            Reporter:
            kevin.albertson@mongodb.com Kevin Albertson
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated:
              Resolved: