This repository was archived by the owner on Dec 8, 2021. It is now read-only.
Commit e33b4f8
authored
fix: avoid deadlock waiting for Session allocation (#1170)
* fix: avoid deadlock waiting for Session allocation
Track the number of threads waiting for a `Session` to ensure we always
notify properly; the prior implementation had race conditions that
could lead to a thread waiting forever even when a `Session` was
available (see #1000 for details).
I also removed the workaround for this bug in the benchmark. With
the workaround removed, I ran the benchmark using the flags below,
both with and without the `SessionPool` fix. Without the fix it
hangs reliably, with the fix it never hangs.
```
.build/google/cloud/spanner/benchmarks/single_row_throughput_benchmark \
--project=${GOOGLE_CLOUD_PROJECT} \
--instance=${GOOGLE_CLOUD_CPP_SPANNER_INSTANCE} \
--table-size=1000 \
--minimum-clients=1 --maximum-clients=1 \
--minimum-threads=1000 --maximum-threads=1000 \
--iteration-duration=2 --samples=100 \
--experiment=read
```
fixes #1000
* Factor "Wait" logic out to a private member function.1 parent 48494ad commit e33b4f8
File tree
3 files changed
+19
-14
lines changed- google/cloud/spanner
- benchmarks
- internal
3 files changed
+19
-14
lines changedLines changed: 6 additions & 8 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
213 | 213 | | |
214 | 214 | | |
215 | 215 | | |
216 | | - | |
217 | | - | |
218 | | - | |
219 | | - | |
| 216 | + | |
| 217 | + | |
220 | 218 | | |
221 | 219 | | |
222 | 220 | | |
| |||
249 | 247 | | |
250 | 248 | | |
251 | 249 | | |
252 | | - | |
| 250 | + | |
253 | 251 | | |
254 | 252 | | |
255 | 253 | | |
| |||
354 | 352 | | |
355 | 353 | | |
356 | 354 | | |
357 | | - | |
| 355 | + | |
358 | 356 | | |
359 | 357 | | |
360 | 358 | | |
| |||
466 | 464 | | |
467 | 465 | | |
468 | 466 | | |
469 | | - | |
| 467 | + | |
470 | 468 | | |
471 | 469 | | |
472 | 470 | | |
| |||
581 | 579 | | |
582 | 580 | | |
583 | 581 | | |
584 | | - | |
| 582 | + | |
585 | 583 | | |
586 | 584 | | |
587 | 585 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
110 | 110 | | |
111 | 111 | | |
112 | 112 | | |
113 | | - | |
| 113 | + | |
114 | 114 | | |
115 | 115 | | |
116 | 116 | | |
| |||
123 | 123 | | |
124 | 124 | | |
125 | 125 | | |
126 | | - | |
127 | | - | |
| 126 | + | |
128 | 127 | | |
129 | 128 | | |
130 | 129 | | |
| |||
166 | 165 | | |
167 | 166 | | |
168 | 167 | | |
169 | | - | |
170 | 168 | | |
171 | | - | |
172 | | - | |
| 169 | + | |
173 | 170 | | |
174 | 171 | | |
175 | 172 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
100 | 100 | | |
101 | 101 | | |
102 | 102 | | |
| 103 | + | |
| 104 | + | |
| 105 | + | |
| 106 | + | |
| 107 | + | |
| 108 | + | |
| 109 | + | |
| 110 | + | |
| 111 | + | |
103 | 112 | | |
104 | 113 | | |
105 | 114 | | |
| |||
120 | 129 | | |
121 | 130 | | |
122 | 131 | | |
| 132 | + | |
123 | 133 | | |
124 | 134 | | |
125 | 135 | | |
| |||
0 commit comments