[CDRIVER-2182] Coverity analysis defect 101219: Waiting while holding a lock Created: 09/Jun/17  Updated: 27/Oct/23  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: Works as Designed Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Issue Links:
Duplicate
is duplicated by CDRIVER-2183 Coverity analysis defect 101220: Wait... Closed
is duplicated by CDRIVER-2184 Coverity analysis defect 101221: Wait... Closed
is duplicated by CDRIVER-2210 Coverity analysis defect 101713: Wait... Closed

 Description   

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

Defect 101219 (STATIC_C)
Checker SLEEP (subcategory none)
File: /src/mongoc/mongoc-topology.c
Function _mongoc_topology_scanner_cb
/src/mongoc/mongoc-topology.c, line: 159
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.