model-writtenrun 8941 - may be wrong, links go to the source messages. Commit-by-commit LLM analysis is in the Commits dialog.
- Alexander Lakhin reported intermittent Windows regression-test failures when pg_ctl restart reused a logfile that remained open during shutdown #1.
- Alexander supplied a delay patch that reliably reproduced the race and a pg_ctl fix that opened and closed the logfile before invoking CMD.EXE, using PostgreSQL's existing Windows retry behavior and providing a clearer error on failure #2.
- Tom Lane identified that opening the logfile with "w+" would truncate it and requested Windows-only scope #3; Alexander clarified that the code already occupied the Windows branch and submitted a revision using append mode #4.
- Amit Kapila questioned why the logfile remained open #5, and Alexander attributed it to the launching shell #6; Tom explored avoiding that shell #7, but Alexander explained that direct CreateProcess use would require more redirection code #8.
- Tom accepted the workaround as expedient while noting that it did not make the logfile generally shareable or solve immediate post-shutdown inspection #9; Alexander emphasized that the patch addressed both restart failures and unclear diagnostics, favoring limited changes over rewriting process creation #10.
- Tom committed the revised patch as 0da33c762b, with light editorial changes and a backpatch to PostgreSQL 12; he explained that the postmaster itself could retain the logfile after removing its PID file and that replacing shell redirection was not yet worthwhile #11.
- The restart workaround had landed by the thread's end, and Alexander said he would continue investigating the remaining failures #12.