Commit 263a148
YTSATS-4067: Fix deadlock with secret_map_mutex (#740)
1. getOrLoadSecret grabbed the secret_map_mutex and called loadSecret.
2. loadSecret dispatched to Continations that registered for the
TS_EVENT_SSL_SECRET event. This would try to grab the Continuation's
lock.
3. In the meantime, those Continuations could call setSecret which would
try to grab the secret_map_mutex. If this Continuation did this while
holding the lock that step 2 is waiting upon, then there will be a
deadlock between the Continuation lock and the secret_map_mutex
between the two threads.
This patch avoids the deadlock by releasing the secret_map_mutex lock
before calling loadSecret. It also updates the secret_map when loading
secrets from a file in loadSecret.1 parent 3222476 commit 263a148
1 file changed
+29
-14
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
23 | 23 | | |
24 | 24 | | |
25 | 25 | | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
26 | 33 | | |
27 | 34 | | |
28 | 35 | | |
| |||
44 | 51 | | |
45 | 52 | | |
46 | 53 | | |
| 54 | + | |
47 | 55 | | |
48 | 56 | | |
| 57 | + | |
49 | 58 | | |
50 | 59 | | |
51 | 60 | | |
| |||
100 | 109 | | |
101 | 110 | | |
102 | 111 | | |
103 | | - | |
104 | | - | |
105 | | - | |
106 | | - | |
107 | | - | |
108 | | - | |
109 | | - | |
110 | | - | |
111 | | - | |
112 | | - | |
| 112 | + | |
| 113 | + | |
| 114 | + | |
| 115 | + | |
| 116 | + | |
| 117 | + | |
| 118 | + | |
| 119 | + | |
| 120 | + | |
| 121 | + | |
| 122 | + | |
| 123 | + | |
| 124 | + | |
| 125 | + | |
113 | 126 | | |
114 | | - | |
115 | | - | |
| 127 | + | |
| 128 | + | |
| 129 | + | |
| 130 | + | |
| 131 | + | |
| 132 | + | |
116 | 133 | | |
117 | | - | |
118 | | - | |
119 | 134 | | |
0 commit comments