forked frompostgres/postgres
- Notifications
You must be signed in to change notification settings - Fork6
Commit28e6a2f
committed
Fix race condition in our Windows signal emulation.
pg_signal_dispatch_thread() responded to the client (signal sender)and disconnected the pipe before actually setting the shared variablesthat make the signal visible to the backend process's main thread.In the worst case, it seems, effective delivery of the signal could bepostponed for as long as the machine has any other work to do.To fix, just move the pg_queue_signal() call so that we do it beforeresponding to the client. This essentially makes pgkill() synchronous,which is a stronger guarantee than we have on Unix. That may beoverkill, but on the other hand we have not seen comparable timing bugson any Unix platform.While at it, add some comments to this sadly underdocumented code.Problem diagnosis and fix by Amit Kapila; I just added the comments.Back-patch to all supported versions, as it appears that this can causevisible NOTIFY timing oddities on all of them, and there might beother misbehavior due to slow delivery of other signals.Discussion:https://postgr.es/m/32745.1575303812@sss.pgh.pa.us1 parent99351a8 commit28e6a2f
1 file changed
+41
-4
lines changedLines changed: 41 additions & 4 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
38 | 38 |
| |
39 | 39 |
| |
40 | 40 |
| |
41 |
| - | |
| 41 | + | |
42 | 42 |
| |
43 | 43 |
| |
44 | 44 |
| |
| |||
208 | 208 |
| |
209 | 209 |
| |
210 | 210 |
| |
| 211 | + | |
| 212 | + | |
| 213 | + | |
211 | 214 |
| |
212 | 215 |
| |
213 | 216 |
| |
214 | 217 |
| |
215 | 218 |
| |
216 |
| - | |
| 219 | + | |
217 | 220 |
| |
218 | 221 |
| |
219 | 222 |
| |
| |||
222 | 225 |
| |
223 | 226 |
| |
224 | 227 |
| |
225 |
| - | |
| 228 | + | |
| 229 | + | |
| 230 | + | |
| 231 | + | |
| 232 | + | |
226 | 233 |
| |
227 | 234 |
| |
228 | 235 |
| |
| |||
242 | 249 |
| |
243 | 250 |
| |
244 | 251 |
| |
| 252 | + | |
| 253 | + | |
| 254 | + | |
| 255 | + | |
| 256 | + | |
| 257 | + | |
| 258 | + | |
| 259 | + | |
| 260 | + | |
| 261 | + | |
| 262 | + | |
| 263 | + | |
| 264 | + | |
| 265 | + | |
| 266 | + | |
245 | 267 |
| |
246 | 268 |
| |
| 269 | + | |
| 270 | + | |
| 271 | + | |
| 272 | + | |
| 273 | + | |
| 274 | + | |
247 | 275 |
| |
| 276 | + | |
| 277 | + | |
248 | 278 |
| |
| 279 | + | |
| 280 | + | |
249 | 281 |
| |
250 | 282 |
| |
251 |
| - | |
252 | 283 |
| |
253 | 284 |
| |
254 | 285 |
| |
| |||
266 | 297 |
| |
267 | 298 |
| |
268 | 299 |
| |
| 300 | + | |
269 | 301 |
| |
270 | 302 |
| |
271 | 303 |
| |
| |||
280 | 312 |
| |
281 | 313 |
| |
282 | 314 |
| |
| 315 | + | |
| 316 | + | |
| 317 | + | |
| 318 | + | |
| 319 | + | |
283 | 320 |
| |
284 | 321 |
| |
285 | 322 |
| |
|
0 commit comments
Comments
(0)