Skip to content

Commit 1c06590

Browse files
committed
Install Windows crash dump handler before all else.
Apart from calling write_stderr() on failure, the handler depends on no PostgreSQL facilities. We have experienced crashes before reaching the former call site. Given such an early crash, this change cannot hurt and may produce a helpful dump. Absent an early crash, this change has no effect. Back-patch to 9.3 (all supported versions). Takayuki Tsunakawa Discussion: https://postgr.es/m/0A3221C70F24FB45833433255569204D1F80CD13@G01JPEXMBYT05
1 parent 30e99ef commit 1c06590

File tree

1 file changed

+8
-8
lines changed

1 file changed

+8
-8
lines changed

src/backend/main/main.c

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,14 @@ main(int argc, char *argv[])
6969
{
7070
bool do_check_root = true;
7171

72+
/*
73+
* If supported on the current platform, set up a handler to be called if
74+
* the backend/postmaster crashes with a fatal signal or exception.
75+
*/
76+
#if defined(WIN32) && defined(HAVE_MINIDUMP_TYPE)
77+
pgwin32_install_crashdump_handler();
78+
#endif
79+
7280
progname = get_progname(argv[0]);
7381

7482
/*
@@ -89,14 +97,6 @@ main(int argc, char *argv[])
8997
*/
9098
argv = save_ps_display_args(argc, argv);
9199

92-
/*
93-
* If supported on the current platform, set up a handler to be called if
94-
* the backend/postmaster crashes with a fatal signal or exception.
95-
*/
96-
#if defined(WIN32) && defined(HAVE_MINIDUMP_TYPE)
97-
pgwin32_install_crashdump_handler();
98-
#endif
99-
100100
/*
101101
* Fire up essential subsystems: error and memory management
102102
*

0 commit comments

Comments
 (0)