forked frompostgres/postgres
- Notifications
You must be signed in to change notification settings - Fork6
Commit0da33c7
committed
In pg_ctl, work around ERROR_SHARING_VIOLATION on the postmaster log file.
On Windows, we use CMD.EXE to redirect the postmaster's stdout/stderrinto a log file. CMD.EXE will open that file with non-sharing-friendlyparameters, and the file will remain open for a short time after thepostmaster has removed postmaster.pid. This can result in anERROR_SHARING_VIOLATION failure if we attempt to start a new postmasterimmediately with the same log file (e.g. during "pg_ctl restart").This seems to explain intermittent buildfarm failures we've been seeingon Windows machines.To fix, just open and close the log file using our own pgwin32_open(),which will wait if necessary to avoid the failure. (Perhaps somedaywe should stop using CMD.EXE, but that would be a far more complexpatch, and it doesn't seem worth the trouble ... yet.)Back-patch to v12. This only solves the problem when frontend fopen()is redirected to pgwin32_fopen(), which has only been true since commit0ba06e0. Hence, no point in back-patching further, unless we careto back-patch that change too.Diagnosis and patch by Alexander Lakhin (bug #16154).Discussion:https://postgr.es/m/16154-1ccf0b537b24d5e0@postgresql.org1 parent5a20b02 commit0da33c7
1 file changed
+21
-0
lines changedLines changed: 21 additions & 0 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
519 | 519 |
| |
520 | 520 |
| |
521 | 521 |
| |
| 522 | + | |
| 523 | + | |
| 524 | + | |
| 525 | + | |
| 526 | + | |
| 527 | + | |
| 528 | + | |
| 529 | + | |
| 530 | + | |
| 531 | + | |
| 532 | + | |
| 533 | + | |
| 534 | + | |
| 535 | + | |
| 536 | + | |
| 537 | + | |
| 538 | + | |
| 539 | + | |
| 540 | + | |
| 541 | + | |
522 | 542 |
| |
523 | 543 |
| |
| 544 | + | |
524 | 545 |
| |
525 | 546 |
| |
526 | 547 |
| |
|
0 commit comments
Comments
(0)