[CDRIVER-2183] Coverity analysis defect 101220: Waiting while holding a lock Created: 09/Jun/17  Updated: 03/Aug/17  Resolved: 03/Aug/17

Status: Closed
Project: C Driver
Component/s: None
Affects Version/s: None
Fix Version/s: 1.8.0

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

Issue Links:
Duplicate
duplicates CDRIVER-2182 Coverity analysis defect 101219: Wait... Closed

 Description   

A lock is held while waiting for a long running or blocking operation to complete

Defect 101220 (STATIC_C)
Checker SLEEP (subcategory none)
File: /src/mongoc/mongoc-topology.c
Function mongoc_topology_select_server_id
/src/mongoc/mongoc-topology.c, line: 623
Calling function "pthread_mutex_lock" acquires lock "topology->mutex".

          mongoc_mutex_lock (&topology->mutex);



 Comments   
Comment by A. Jesse Jiryu Davis [ 03/Aug/17 ]

Coverity complained about deliberately slow test code, slow_initiator(), that sleeps while the driver is holding the topology lock. The fact that a slow stream initiator can make the driver hang while holding the lock is a design flaw, it's one of several reasons we deprecated stream initiators and the PHP driver no longer uses one.

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