The startup script uses pg_ctl which forwards stdout from postgresql daemon to parent process. Since py39-ansible-core-2.15, the "service" module waits until stdout of startup script is completely read. In our case, this will happen when the postgresql daemon terminates, i.e. never and so the Ansible playbook is stuck. According to pg_ctl, this is a feature. But in real life, the only messages you get are ``` LOG: ending log output to stderr HINT: Future log output will go to log destination "syslog". ``` So this feature is useless and makes trouble. Either, pg_ctl must be fixed (which imho is unlikely as under Linux, usually systemd is used which has no problem with that behaviour) or we must modify the rc.d script to redirect stdout to /dev/null on startup.
pg_ctl has a -l option
This option sends log to file, see man page: -l filename Append the server log output to filename. If the file does not exist, it is created. The umask is set to 077, so access to the log file from other users is disallowed by default. This doesn‘t make much sense, since there is no useful logging output, only LOG: ending log output to stderr HINT: Future log output will go to log destination "syslog". I don‘t want to create a new log file for these 2 (useless) messages only.
I think that the best way is to remove the syslog configuration and use normal logging instead. The PostgreSQL community actually advices not to use syslog since it requires a syscall, which is considered an unnecessary overhead. I haven't looked into how that would best be configured. Do you have any suggestions? Otherwise, would a quick fix be to add `-l /dev/null` or just redirect stdout and stderr to /dev/null?
It seems that PostgreSQL prefers to do its own log management including rotation. All that can be configured in postgresql.conf. I would need to dig deeper to find a "perfect" configuration. For the time being, just adding "-l /dev/null" seems to be sufficient.
A commit in branch main references this bug: URL: https://cgit.FreeBSD.org/ports/commit/?id=e30c0647036e097b38ed2e56536333f95957f189 commit e30c0647036e097b38ed2e56536333f95957f189 Author: Palle Girgensohn <girgen@FreeBSD.org> AuthorDate: 2025-02-20 13:30:32 +0000 Commit: Palle Girgensohn <girgen@FreeBSD.org> CommitDate: 2025-02-20 14:41:24 +0000 databases/postgresql??-*: Upgrade to latest versions The PostgreSQL Global Development Group has released an update to all supported versions of PostgreSQL, including 17.4, 16.8, 15.12, 14.17, and 13.20. The issues listed below affect PostgreSQL 17. Some of these issues may also affect other supported versions of PostgreSQL. Improve behavior of quoting functions in libpq. The fix for CVE-2025-1094 caused the quoting functions to not honor their string length parameters and, in some cases, cause crashes. This problem could be noticeable from a PostgreSQL client library, based on how it is integrated with libpq. Fix small memory leak in pg_createsubscriber. Also fix a problem in the FreeBSD port, where the rc script wouldn't return properly, messing up orchestration tools like ansible. [1] PR: 272502 [1] Release notes: https://www.postgresql.org/docs/release/ databases/postgresql13-server/Makefile | 2 +- databases/postgresql13-server/distinfo | 6 +++--- databases/postgresql13-server/files/postgresql.in | 4 +++- databases/postgresql14-server/Makefile | 2 +- databases/postgresql14-server/distinfo | 6 +++--- databases/postgresql14-server/files/postgresql.in | 4 +++- databases/postgresql15-server/Makefile | 2 +- databases/postgresql15-server/distinfo | 6 +++--- databases/postgresql15-server/files/postgresql.in | 4 +++- databases/postgresql16-server/Makefile | 2 +- databases/postgresql16-server/distinfo | 6 +++--- databases/postgresql16-server/files/postgresql.in | 4 +++- databases/postgresql17-server/Makefile | 2 +- databases/postgresql17-server/distinfo | 6 +++--- databases/postgresql17-server/files/postgresql.in | 4 +++- 15 files changed, 35 insertions(+), 25 deletions(-)
I comitted a change adding -l /dev/null. Thanks!
A commit in branch 2025Q1 references this bug: URL: https://cgit.FreeBSD.org/ports/commit/?id=5bd503deb3eacaaa912fa16aa036bbd027bcbd2b commit 5bd503deb3eacaaa912fa16aa036bbd027bcbd2b Author: Palle Girgensohn <girgen@FreeBSD.org> AuthorDate: 2025-02-20 13:30:32 +0000 Commit: Palle Girgensohn <girgen@FreeBSD.org> CommitDate: 2025-02-21 21:22:15 +0000 databases/postgresql??-*: Upgrade to latest versions The PostgreSQL Global Development Group has released an update to all supported versions of PostgreSQL, including 17.4, 16.8, 15.12, 14.17, and 13.20. The issues listed below affect PostgreSQL 17. Some of these issues may also affect other supported versions of PostgreSQL. Improve behavior of quoting functions in libpq. The fix for CVE-2025-1094 caused the quoting functions to not honor their string length parameters and, in some cases, cause crashes. This problem could be noticeable from a PostgreSQL client library, based on how it is integrated with libpq. Fix small memory leak in pg_createsubscriber. Also fix a problem in the FreeBSD port, where the rc script wouldn't return properly, messing up orchestration tools like ansible. [1] PR: 272502 [1] Release notes: https://www.postgresql.org/docs/release/ (cherry picked from commit e30c0647036e097b38ed2e56536333f95957f189) databases/postgresql13-server/Makefile | 4 ++-- databases/postgresql13-server/distinfo | 6 +++--- databases/postgresql13-server/files/postgresql.in | 4 +++- databases/postgresql14-server/Makefile | 4 ++-- databases/postgresql14-server/distinfo | 6 +++--- databases/postgresql14-server/files/postgresql.in | 4 +++- databases/postgresql15-server/Makefile | 4 ++-- databases/postgresql15-server/distinfo | 6 +++--- databases/postgresql15-server/files/postgresql.in | 4 +++- databases/postgresql16-server/Makefile | 4 ++-- databases/postgresql16-server/distinfo | 6 +++--- databases/postgresql16-server/files/postgresql.in | 4 +++- databases/postgresql17-server/Makefile | 4 ++-- databases/postgresql17-server/distinfo | 6 +++--- databases/postgresql17-server/files/postgresql.in | 4 +++- 15 files changed, 40 insertions(+), 30 deletions(-)