Commit dc486e4
committed
Fixed blob stream deadlock
Fixed the issue in SAP#233 where streaming blobs out of the
database into another table can cause a deadlock
- Added a "blocked" mode to the Queue which prevents tasks from running
except for the blocking task and READ_LOB tasks
- Modified ExecuteTask's run to free the queue while it waits for the
Writer's getParameters
- The callback of getParameters will enqueue the task again to send
the packet
- Before the freeing of the queue to the next task, ExecuteTask will
block the queue to only allow itself and READ_LOB tasks to run
- This prevents issues where exec's can run at the same time
which will lead to HANA disconnecting and sending invalid LOB locator id
errors
Implementation Details
To implement the "blocked" mode, the Queue is modified to a data structure
which supports 3 operations
1. Push a task (preserving the order in which tasks were pushed)
2. Pop a task (remove the task in the order they were pushed)
3. Selective pop (remove a task in the order they were pushed given that
the type matches a given variety)
For optimization purposes, the tasks that can block are only READ_LOB requests.
As such, we only require another readLobQueue which stores READ_LOB tasks to
allow those to skip the queue.
- An invariant of the Queue is that the queue must store the same READ_LOB tasks
as the readLobQueue and possibly more READ_LOB tasks that are already run.
If in the future, it is found that other tasks can block, it is possible to
maintain a map<message type, list of queue tasks> and still have these 3
operations run in constant time, because the number of message types is finite
(and small).1 parent 67090ff commit dc486e4
File tree
5 files changed
+468
-87
lines changed- lib
- protocol
- util
- test
- acceptance
5 files changed
+468
-87
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
441 | 441 | | |
442 | 442 | | |
443 | 443 | | |
| 444 | + | |
444 | 445 | | |
445 | 446 | | |
446 | 447 | | |
| |||
732 | 733 | | |
733 | 734 | | |
734 | 735 | | |
| 736 | + | |
| 737 | + | |
| 738 | + | |
| 739 | + | |
735 | 740 | | |
736 | 741 | | |
737 | 742 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
39 | 39 | | |
40 | 40 | | |
41 | 41 | | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
42 | 45 | | |
43 | 46 | | |
44 | 47 | | |
| |||
59 | 62 | | |
60 | 63 | | |
61 | 64 | | |
62 | | - | |
| 65 | + | |
63 | 66 | | |
64 | 67 | | |
65 | 68 | | |
66 | 69 | | |
67 | 70 | | |
68 | 71 | | |
69 | | - | |
| 72 | + | |
70 | 73 | | |
71 | 74 | | |
72 | 75 | | |
73 | | - | |
74 | | - | |
75 | | - | |
76 | | - | |
77 | | - | |
78 | | - | |
79 | | - | |
80 | | - | |
81 | | - | |
82 | | - | |
83 | | - | |
84 | | - | |
| 76 | + | |
| 77 | + | |
| 78 | + | |
| 79 | + | |
| 80 | + | |
| 81 | + | |
| 82 | + | |
| 83 | + | |
| 84 | + | |
| 85 | + | |
| 86 | + | |
| 87 | + | |
| 88 | + | |
| 89 | + | |
85 | 90 | | |
| 91 | + | |
| 92 | + | |
| 93 | + | |
| 94 | + | |
86 | 95 | | |
87 | 96 | | |
88 | | - | |
| 97 | + | |
89 | 98 | | |
90 | | - | |
| 99 | + | |
91 | 100 | | |
92 | | - | |
93 | | - | |
94 | | - | |
95 | | - | |
96 | | - | |
97 | | - | |
98 | | - | |
| 101 | + | |
| 102 | + | |
| 103 | + | |
| 104 | + | |
| 105 | + | |
| 106 | + | |
| 107 | + | |
| 108 | + | |
99 | 109 | | |
| 110 | + | |
| 111 | + | |
100 | 112 | | |
101 | 113 | | |
102 | | - | |
103 | | - | |
104 | | - | |
105 | | - | |
106 | | - | |
107 | | - | |
108 | | - | |
109 | | - | |
110 | | - | |
111 | | - | |
| 114 | + | |
| 115 | + | |
| 116 | + | |
| 117 | + | |
| 118 | + | |
| 119 | + | |
| 120 | + | |
| 121 | + | |
| 122 | + | |
| 123 | + | |
| 124 | + | |
| 125 | + | |
| 126 | + | |
| 127 | + | |
| 128 | + | |
| 129 | + | |
| 130 | + | |
| 131 | + | |
| 132 | + | |
| 133 | + | |
112 | 134 | | |
113 | | - | |
114 | 135 | | |
115 | | - | |
| 136 | + | |
| 137 | + | |
116 | 138 | | |
117 | 139 | | |
118 | 140 | | |
| |||
195 | 217 | | |
196 | 218 | | |
197 | 219 | | |
198 | | - | |
| 220 | + | |
199 | 221 | | |
200 | | - | |
201 | | - | |
202 | | - | |
| 222 | + | |
| 223 | + | |
| 224 | + | |
| 225 | + | |
| 226 | + | |
| 227 | + | |
| 228 | + | |
| 229 | + | |
203 | 230 | | |
204 | | - | |
| 231 | + | |
205 | 232 | | |
206 | | - | |
207 | | - | |
208 | | - | |
209 | | - | |
210 | | - | |
211 | | - | |
212 | | - | |
213 | | - | |
| 233 | + | |
| 234 | + | |
| 235 | + | |
| 236 | + | |
| 237 | + | |
| 238 | + | |
| 239 | + | |
| 240 | + | |
214 | 241 | | |
215 | | - | |
| 242 | + | |
216 | 243 | | |
217 | | - | |
| 244 | + | |
218 | 245 | | |
219 | | - | |
220 | | - | |
| 246 | + | |
| 247 | + | |
| 248 | + | |
221 | 249 | | |
222 | | - | |
| 250 | + | |
223 | 251 | | |
224 | | - | |
225 | | - | |
226 | | - | |
| 252 | + | |
| 253 | + | |
227 | 254 | | |
228 | 255 | | |
229 | 256 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
15 | 15 | | |
16 | 16 | | |
17 | 17 | | |
| 18 | + | |
18 | 19 | | |
19 | 20 | | |
20 | 21 | | |
| |||
26 | 27 | | |
27 | 28 | | |
28 | 29 | | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
29 | 36 | | |
30 | 37 | | |
31 | 38 | | |
| |||
36 | 43 | | |
37 | 44 | | |
38 | 45 | | |
39 | | - | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
40 | 52 | | |
41 | 53 | | |
42 | 54 | | |
43 | 55 | | |
44 | 56 | | |
45 | 57 | | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
46 | 61 | | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
47 | 65 | | |
48 | 66 | | |
49 | 67 | | |
| |||
72 | 90 | | |
73 | 91 | | |
74 | 92 | | |
75 | | - | |
76 | | - | |
| 93 | + | |
| 94 | + | |
77 | 95 | | |
78 | 96 | | |
| 97 | + | |
| 98 | + | |
| 99 | + | |
| 100 | + | |
| 101 | + | |
| 102 | + | |
| 103 | + | |
| 104 | + | |
| 105 | + | |
| 106 | + | |
| 107 | + | |
| 108 | + | |
| 109 | + | |
| 110 | + | |
79 | 111 | | |
80 | 112 | | |
81 | 113 | | |
82 | | - | |
| 114 | + | |
83 | 115 | | |
84 | 116 | | |
85 | 117 | | |
| |||
89 | 121 | | |
90 | 122 | | |
91 | 123 | | |
| 124 | + | |
| 125 | + | |
| 126 | + | |
| 127 | + | |
| 128 | + | |
| 129 | + | |
| 130 | + | |
| 131 | + | |
| 132 | + | |
| 133 | + | |
| 134 | + | |
| 135 | + | |
| 136 | + | |
| 137 | + | |
| 138 | + | |
| 139 | + | |
| 140 | + | |
| 141 | + | |
| 142 | + | |
| 143 | + | |
| 144 | + | |
| 145 | + | |
| 146 | + | |
| 147 | + | |
| 148 | + | |
| 149 | + | |
| 150 | + | |
| 151 | + | |
| 152 | + | |
| 153 | + | |
| 154 | + | |
| 155 | + | |
| 156 | + | |
| 157 | + | |
| 158 | + | |
| 159 | + | |
| 160 | + | |
| 161 | + | |
| 162 | + | |
| 163 | + | |
| 164 | + | |
| 165 | + | |
| 166 | + | |
| 167 | + | |
| 168 | + | |
| 169 | + | |
| 170 | + | |
92 | 171 | | |
93 | 172 | | |
94 | 173 | | |
95 | 174 | | |
96 | 175 | | |
97 | | - | |
| 176 | + | |
| 177 | + | |
| 178 | + | |
| 179 | + | |
| 180 | + | |
| 181 | + | |
| 182 | + | |
| 183 | + | |
98 | 184 | | |
99 | 185 | | |
100 | 186 | | |
101 | 187 | | |
102 | 188 | | |
103 | | - | |
| 189 | + | |
104 | 190 | | |
105 | 191 | | |
106 | 192 | | |
| 193 | + | |
| 194 | + | |
107 | 195 | | |
108 | 196 | | |
109 | 197 | | |
| |||
0 commit comments