[CDRIVER-1518] Crash in mongoc_topology_description_invalidate_server Created: 02/Sep/16  Updated: 19/Oct/16  Resolved: 07/Sep/16

Status: Closed
Project: C Driver
Component/s: libmongoc
Affects Version/s: 1.2.0
Fix Version/s: 1.5.0

Type: Bug Priority: Major - P3
Reporter: A. Jesse Jiryu Davis Assignee: A. Jesse Jiryu Davis
Resolution: Done Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified


 Description   

Seen once in the ""/Topology/invalidate_server/pooled" test: if an application thread fails to open a new socket in _mongoc_cluster_stream_for_server_description, it calls mongoc_topology_invalidate_server, which locks the topology and calls mongoc_topology_description_invalidate_server.

However, the topology scanner thread might have detected the down server and removed its server description before the application thread got the topology lock. In that case we get a NULL server description and pass it to mongoc_topology_description_invalidate_server:

void
mongoc_topology_description_invalidate_server (mongoc_topology_description_t *topology,
                                               uint32_t                       id,
                                               const bson_error_t            *error)
{
   mongoc_server_description_t *sd;
 
   sd = mongoc_topology_description_server_by_id (topology, id, NULL);
   mongoc_topology_description_handle_ismaster (topology, sd, NULL, 0, NULL);
}



 Comments   
Comment by Githook User [ 07/Sep/16 ]

Author:

{u'username': u'ajdavis', u'name': u'A. Jesse Jiryu Davis', u'email': u'jesse@mongodb.com'}

Message: CDRIVER-1518 crash in mongoc_topology_invalidate_server
Branch: master
https://github.com/mongodb/mongo-c-driver/commit/d0b62e18ed59fa5ea6d3126959fadf3479316abd

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