"postmaster became multithreaded" is reachable
Tom Lane <tgl@sss.pgh.pa.us>
From: Tom Lane <tgl@sss.pgh.pa.us>
To: pgsql-hackers@lists.postgresql.org
Cc: Noah Misch <noah@leadboat.com>
Date: 2025-01-23T18:22:13Z
Lists: pgsql-hackers
ExitPostmaster() says:
/*
* There is no known cause for a postmaster to become multithreaded after
* startup. Recheck to account for the possibility of unknown causes.
* This message uses LOG level, because an unclean shutdown at this point
* would usually not look much different from a clean shutdown.
*/
if (pthread_is_threaded_np() != 0)
ereport(LOG,
(errcode(ERRCODE_INTERNAL_ERROR),
errmsg_internal("postmaster became multithreaded"),
errdetail("Please report this to <%s>.", PACKAGE_BUGREPORT)));
We now have a report[1] of a way to trigger this error message.
It seems to boil down to "cause an error before PostmasterMain
has reached its test of pthread_is_threaded_np()", for example
$ # build with --enable-nls, using MacPorts' gettext package
$ unset LANG
$ postgres -D /foo
postgres: could not access directory "/foo": No such file or directory
Run initdb or pg_basebackup to initialize a PostgreSQL data directory.
2025-01-23 18:16:03.843 GMT [41524] LOG: postmaster became multithreaded
2025-01-23 18:16:03.843 GMT [41524] DETAIL: Please report this to <pgsql-bugs@lists.postgresql.org>.
I suggest therefore that we remove the "Please report a bug"
bit and instead use the much more helpful hint appearing in
PostmasterMain:
errhint("Set the LC_ALL environment variable to a valid locale.")));
An alternative idea (that maybe should also be done in PostmasterMain)
is to report the HINT only #ifdef __darwin__ and on other platforms
use the "Please report a bug" text.
regards, tom lane
[1] https://www.postgresql.org/message-id/18783-d1873b95a59b9103%40postgresql.org
Commits
-
Don't ask for bug reports about pthread_is_threaded_np() != 0.
- 63644c15d74e 13.19 landed
- 63a4b9f76786 14.16 landed
- 4d6e169c4341 15.11 landed
- 7ab181a29ba5 16.7 landed
- 6c9a83f216a0 17.3 landed
- 4f15759bdcdd 18.0 landed