/
74f0c66.bug
72 lines (72 loc) · 2.75 KB
/
74f0c66.bug
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
%YAML 1.1
---
id: 74f0c66
title: Callbacks using locks deadlock, when callback processing happens in the critical
section.
description: >
This is a deadlock problem in the tf2 package of geometry2 between callbacks
and lock protection. The deadlock happens when the following two things
happen: 1) One function (MessageFilter) attempts to remove a message from a
queue. To this end it locks the relevant sempahore (messages_mutex_) then
calls BufferCore::cancelTransformableRequest where it needs the
transformable_requests_mutex_ 2) BufferCore upon receiving a TF callback,
locks the transformable_requests_mutex_ in testTransformableRequests and goes
through the list of requests where one of the callback it calls is
MessageFilter::Transformable that attempts to acquire a unique_lock on
message_mutex_. We have mutual locking problem. This has been fixed in
BufferCore::testTransformableRequests by delaying call back processing.
Callbacks to be processed are pushed into a queue, instead of being triggered
on the fly, and then the queue is discharged after the lock is freed. A
stronger lock is used in MessageFilter as well, presumably because there is
no longer need for sharing locks after the call back processing has been
moved out of the critical section. This is a general issue that could appear
in any multithreaded software using locks and callbacks.
classification: "CWE-764: Multiple Locks of a Critical Resource"
keywords: ['deadlock', 'tf2', 'callback', 'lock']
system: null
severity: error
links: ['http://www.boost.org/doc/libs/1_41_0/doc/html/thread/synchronization.html']
bug:
phase: runtime
specificity: general issue
architectural-location: platform code
application: null
task: null
subsystem: generic task component
package: ['ros/geometry2/tf2_ros']
languages: ['C++']
detected-by: null
reported-by: null
issue: null
time-reported: null
reproducibility: rare
trace: >
There is a trace reported in the pull request, involving two threads.
fix:
pull-request: https://github.com/ros/geometry2/pull/144
fix-in: ['tf2/src/buffer_core.cpp', 'tf2_ros/include/tf2_ros/message_filter.h']
languages: ['C++']
time: 2017-07-13 (00:37)
commits:
- repo: https://github.com/ros/geometry2
hash: 74f0c667995b5baadf967349635a5396d7977518
stats:
total:
insertions: 20
deletions: 14
lines: 34
files: 2
files:
tf2/src/buffer_core.cpp:
insertions: 18
deletions: 3
lines: 21
tf2_ros/include/tf2_ros/message_filter.h:
insertions: 2
deletions: 11
lines: 13
fault-codes:
- CONCURRENCY:BAD-SYNC
failure-codes:
- SOFTWARE:LIVENESS
- SYSTEM:LOSS-OF-FUNCTIONALITY