[CDRIVER-3624] handle_not_master_error calls _mongoc_topology_request_scan without locking topology mutex Created: 15/Apr/20  Updated: 28/Oct/23  Resolved: 20/Apr/20

Status: Closed
Project: C Driver
Component/s: libmongoc
Affects Version/s: None
Fix Version/s: 1.17.0-beta2, 1.17.0

Type: Bug Priority: Major - P3
Reporter: Kevin Albertson Assignee: Kevin Albertson
Resolution: Fixed Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified


 Description   

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)



 Comments   
Comment by Githook User [ 25/May/20 ]

Author:

{'name': 'Kevin Albertson', 'email': 'kevin.albertson@mongodb.com', 'username': 'kevinAlbs'}

Message: CDRIVER-3624 grab topology mutex on not master errs
Branch: r1.17
https://github.com/mongodb/mongo-c-driver/commit/ffca822e86d65162d0408d80d413f5c8d7663f7a

Comment by Githook User [ 20/Apr/20 ]

Author:

{'name': 'Kevin Albertson', 'email': 'kevin.albertson@mongodb.com', 'username': 'kevinAlbs'}

Message: CDRIVER-3624 grab topology mutex on not master errs
Branch: master
https://github.com/mongodb/mongo-c-driver/commit/fd88d530a4ada2fc6b5735f9f0e456b20a90e764

Generated at Wed Feb 07 21:18:35 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.