- Notifications
You must be signed in to change notification settings - Fork5
Commitf34c68f
committed
Introduce timeout handling framework
Management of timeouts was getting a little cumbersome; what weoriginally had was more than enough back when we were only concernedabout deadlocks and query cancel; however, when we added timeouts forstandby processes, the code got considerably messier. Since there areplans to add more complex timeouts, this seems a good time to introducea central timeout handling module.External modules register their timeout handlers during processinitialization, and later enable and disable them as they see fit usinga simple API; timeout.c is in charge of keeping track of which timeoutsare in effect at any time, installing a common SIGALRM signal handler,and calling setitimer() as appropriate to ensure timely firing ofexternal handlers.timeout.c additionally supports pluggable modules to add their owntimeouts, though this capability isn't exercised anywhere yet.Additionally, as of this commit, walsender processes are aware oftimeouts; we had a preexisting bug there that made those ignore SIGALRM,thus being subject to unhandled deadlocks, particularly during theauthentication phase. This has already been fixed in back branches incommit 0bf8eb2a, which see for more details.Main author: Zoltán BöszörményiSome review and cleanup by Álvaro HerreraExtensive reworking by Tom Lane1 parentdd16f94 commitf34c68f
File tree
13 files changed
+688
-498
lines changed- src
- backend
- postmaster
- replication
- storage
- ipc
- lmgr
- tcop
- utils
- init
- misc
- include
- storage
- utils
13 files changed
+688
-498
lines changedLines changed: 5 additions & 4 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
97 | 97 |
| |
98 | 98 |
| |
99 | 99 |
| |
| 100 | + | |
100 | 101 |
| |
101 | 102 |
| |
102 | 103 |
| |
| |||
432 | 433 |
| |
433 | 434 |
| |
434 | 435 |
| |
435 |
| - | |
| 436 | + | |
436 | 437 |
| |
437 | 438 |
| |
438 | 439 |
| |
| |||
482 | 483 |
| |
483 | 484 |
| |
484 | 485 |
| |
485 |
| - | |
| 486 | + | |
486 | 487 |
| |
487 |
| - | |
| 488 | + | |
488 | 489 |
| |
489 | 490 |
| |
490 | 491 |
| |
| |||
1492 | 1493 |
| |
1493 | 1494 |
| |
1494 | 1495 |
| |
1495 |
| - | |
| 1496 | + | |
1496 | 1497 |
| |
1497 | 1498 |
| |
1498 | 1499 |
| |
|
Lines changed: 28 additions & 8 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
112 | 112 |
| |
113 | 113 |
| |
114 | 114 |
| |
115 |
| - | |
116 | 115 |
| |
117 | 116 |
| |
118 | 117 |
| |
119 | 118 |
| |
120 | 119 |
| |
| 120 | + | |
121 | 121 |
| |
122 | 122 |
| |
123 | 123 |
| |
| |||
337 | 337 |
| |
338 | 338 |
| |
339 | 339 |
| |
| 340 | + | |
340 | 341 |
| |
341 | 342 |
| |
342 | 343 |
| |
| |||
3415 | 3416 |
| |
3416 | 3417 |
| |
3417 | 3418 |
| |
3418 |
| - | |
| 3419 | + | |
3419 | 3420 |
| |
3420 | 3421 |
| |
3421 | 3422 |
| |
| |||
3469 | 3470 |
| |
3470 | 3471 |
| |
3471 | 3472 |
| |
| 3473 | + | |
| 3474 | + | |
| 3475 | + | |
| 3476 | + | |
| 3477 | + | |
| 3478 | + | |
| 3479 | + | |
| 3480 | + | |
| 3481 | + | |
3472 | 3482 |
| |
3473 |
| - | |
3474 |
| - | |
| 3483 | + | |
| 3484 | + | |
3475 | 3485 |
| |
3476 | 3486 |
| |
3477 | 3487 |
| |
| |||
3508 | 3518 |
| |
3509 | 3519 |
| |
3510 | 3520 |
| |
3511 |
| - | |
3512 |
| - | |
| 3521 | + | |
3513 | 3522 |
| |
3514 | 3523 |
| |
3515 | 3524 |
| |
| |||
4311 | 4320 |
| |
4312 | 4321 |
| |
4313 | 4322 |
| |
4314 |
| - | |
4315 |
| - | |
| 4323 | + | |
| 4324 | + | |
4316 | 4325 |
| |
4317 | 4326 |
| |
4318 | 4327 |
| |
| |||
4339 | 4348 |
| |
4340 | 4349 |
| |
4341 | 4350 |
| |
| 4351 | + | |
| 4352 | + | |
| 4353 | + | |
| 4354 | + | |
| 4355 | + | |
| 4356 | + | |
| 4357 | + | |
| 4358 | + | |
| 4359 | + | |
| 4360 | + | |
| 4361 | + | |
4342 | 4362 |
| |
4343 | 4363 |
| |
4344 | 4364 |
| |
|
Lines changed: 12 additions & 10 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
27 | 27 |
| |
28 | 28 |
| |
29 | 29 |
| |
30 |
| - | |
| 30 | + | |
31 | 31 |
| |
| 32 | + | |
32 | 33 |
| |
33 | 34 |
| |
34 | 35 |
| |
| |||
185 | 186 |
| |
186 | 187 |
| |
187 | 188 |
| |
188 |
| - | |
189 |
| - | |
190 |
| - | |
191 |
| - | |
192 | 189 |
| |
193 | 190 |
| |
194 | 191 |
| |
195 | 192 |
| |
196 | 193 |
| |
197 |
| - | |
198 |
| - | |
199 |
| - | |
200 |
| - | |
201 |
| - | |
| 194 | + | |
202 | 195 |
| |
203 | 196 |
| |
204 | 197 |
| |
| |||
212 | 205 |
| |
213 | 206 |
| |
214 | 207 |
| |
| 208 | + | |
| 209 | + | |
| 210 | + | |
| 211 | + | |
| 212 | + | |
| 213 | + | |
215 | 214 |
| |
216 | 215 |
| |
217 | 216 |
| |
218 | 217 |
| |
219 | 218 |
| |
| 219 | + | |
| 220 | + | |
| 221 | + | |
220 | 222 |
| |
221 | 223 |
| |
222 | 224 |
| |
|
Lines changed: 2 additions & 1 deletion
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
63 | 63 |
| |
64 | 64 |
| |
65 | 65 |
| |
| 66 | + | |
66 | 67 |
| |
67 | 68 |
| |
68 | 69 |
| |
| |||
1345 | 1346 |
| |
1346 | 1347 |
| |
1347 | 1348 |
| |
1348 |
| - | |
| 1349 | + | |
1349 | 1350 |
| |
1350 | 1351 |
| |
1351 | 1352 |
| |
|
Lines changed: 55 additions & 25 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
28 | 28 |
| |
29 | 29 |
| |
30 | 30 |
| |
| 31 | + | |
31 | 32 |
| |
32 | 33 |
| |
33 | 34 |
| |
| |||
40 | 41 |
| |
41 | 42 |
| |
42 | 43 |
| |
| 44 | + | |
43 | 45 |
| |
44 | 46 |
| |
45 | 47 |
| |
| |||
370 | 372 |
| |
371 | 373 |
| |
372 | 374 |
| |
373 |
| - | |
374 |
| - | |
375 |
| - | |
| 375 | + | |
| 376 | + | |
| 377 | + | |
| 378 | + | |
| 379 | + | |
376 | 380 |
| |
377 | 381 |
| |
378 | 382 |
| |
379 |
| - | |
| 383 | + | |
380 | 384 |
| |
381 | 385 |
| |
382 | 386 |
| |
| |||
389 | 393 |
| |
390 | 394 |
| |
391 | 395 |
| |
392 |
| - | |
| 396 | + | |
393 | 397 |
| |
394 | 398 |
| |
395 | 399 |
| |
396 | 400 |
| |
397 |
| - | |
398 | 401 |
| |
399 |
| - | |
400 | 402 |
| |
401 | 403 |
| |
402 | 404 |
| |
403 | 405 |
| |
404 |
| - | |
405 | 406 |
| |
406 |
| - | |
| 407 | + | |
407 | 408 |
| |
408 | 409 |
| |
409 | 410 |
| |
410 |
| - | |
| 411 | + | |
411 | 412 |
| |
412 |
| - | |
413 |
| - | |
414 |
| - | |
415 |
| - | |
| 413 | + | |
416 | 414 |
| |
417 |
| - | |
| 415 | + | |
418 | 416 |
| |
419 | 417 |
| |
420 | 418 |
| |
| |||
427 | 425 |
| |
428 | 426 |
| |
429 | 427 |
| |
430 |
| - | |
431 |
| - | |
432 |
| - | |
433 |
| - | |
| 428 | + | |
| 429 | + | |
434 | 430 |
| |
435 | 431 |
| |
436 | 432 |
| |
437 | 433 |
| |
438 | 434 |
| |
439 |
| - | |
440 |
| - | |
441 |
| - | |
442 |
| - | |
443 |
| - | |
| 435 | + | |
| 436 | + | |
| 437 | + | |
| 438 | + | |
| 439 | + | |
| 440 | + | |
| 441 | + | |
444 | 442 |
| |
445 | 443 |
| |
446 |
| - | |
| 444 | + | |
447 | 445 |
| |
448 | 446 |
| |
449 | 447 |
| |
| |||
492 | 490 |
| |
493 | 491 |
| |
494 | 492 |
| |
| 493 | + | |
| 494 | + | |
| 495 | + | |
| 496 | + | |
| 497 | + | |
| 498 | + | |
| 499 | + | |
| 500 | + | |
| 501 | + | |
| 502 | + | |
| 503 | + | |
| 504 | + | |
| 505 | + | |
| 506 | + | |
| 507 | + | |
| 508 | + | |
| 509 | + | |
| 510 | + | |
| 511 | + | |
| 512 | + | |
| 513 | + | |
| 514 | + | |
| 515 | + | |
| 516 | + | |
| 517 | + | |
| 518 | + | |
| 519 | + | |
| 520 | + | |
| 521 | + | |
| 522 | + | |
| 523 | + | |
| 524 | + | |
495 | 525 |
| |
496 | 526 |
| |
497 | 527 |
| |
|
0 commit comments
Comments
(0)