naemon / naemon-livestatus

Naemon - Livestatus Eventbroker Module
GNU General Public License v2.0
27 stars 30 forks source link

Use recursive mutex on downtime/comment table #63

Closed jacobbaungard closed 5 years ago

jacobbaungard commented 5 years ago

The downtime/comment table also contains the related host and service object, which in turn, contains all the comment/downtimes for the object. Due to this, when for example doing the following request: GET comments\nColumns: host_comments we would do a recursive call to DownCommColumn::output. This would lead to a deadlock as the mutex lock is called twice, without unlocking.

To fix this issue we use a recursive mutex, which allows one thread to run multiple locks on a single mutex.

Also add a simple small testcase.

Signed-off-by: Jacob Hansen jhansen@op5.com