Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
Skip to content

Commit 4f15759

Browse files
committed
Don't ask for bug reports about pthread_is_threaded_np() != 0.
We thought that this condition was unreachable in ExitPostmaster, but actually it's possible if you have both a misconfigured locale setting and some other mistake that causes PostmasterMain to bail out before reaching its own check of pthread_is_threaded_np(). Given the lack of other reports, let's not ask for bug reports if this occurs; instead just give the same hint as in PostmasterMain. Bug: #18783 Reported-by: anani191181515@gmail.com Author: Tom Lane <tgl@sss.pgh.pa.us> Reviewed-by: Noah Misch <noah@leadboat.com> Discussion: https://postgr.es/m/18783-d1873b95a59b9103@postgresql.org Discussion: https://postgr.es/m/206317.1737656533@sss.pgh.pa.us Backpatch-through: 13
1 parent 01463e1 commit 4f15759

File tree

1 file changed

+7
-4
lines changed

1 file changed

+7
-4
lines changed

src/backend/postmaster/postmaster.c

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1338,6 +1338,8 @@ PostmasterMain(int argc, char *argv[])
13381338
* calls fork() without an immediate exec(), both of which have undefined
13391339
* behavior in a multithreaded program. A multithreaded postmaster is the
13401340
* normal case on Windows, which offers neither fork() nor sigprocmask().
1341+
* Currently, macOS is the only platform having pthread_is_threaded_np(),
1342+
* so we need not worry whether this HINT is appropriate elsewhere.
13411343
*/
13421344
if (pthread_is_threaded_np() != 0)
13431345
ereport(FATAL,
@@ -3535,15 +3537,16 @@ ExitPostmaster(int status)
35353537

35363538
/*
35373539
* There is no known cause for a postmaster to become multithreaded after
3538-
* startup. Recheck to account for the possibility of unknown causes.
3540+
* startup. However, we might reach here via an error exit before
3541+
* reaching the test in PostmasterMain, so provide the same hint as there.
35393542
* This message uses LOG level, because an unclean shutdown at this point
35403543
* would usually not look much different from a clean shutdown.
35413544
*/
35423545
if (pthread_is_threaded_np() != 0)
35433546
ereport(LOG,
3544-
(errcode(ERRCODE_INTERNAL_ERROR),
3545-
errmsg_internal("postmaster became multithreaded"),
3546-
errdetail("Please report this to <%s>.", PACKAGE_BUGREPORT)));
3547+
(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
3548+
errmsg("postmaster became multithreaded"),
3549+
errhint("Set the LC_ALL environment variable to a valid locale.")));
35473550
#endif
35483551

35493552
/* should cleanup shared memory and kill all backends */

0 commit comments

Comments
 (0)