Skip to content

Commit e17b38d

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 19cf9e9 commit e17b38d

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
@@ -68,6 +68,14 @@ main(int argc, char *argv[])
6868
{
6969
bool do_check_root = true;
7070

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

7381
/*
@@ -88,14 +96,6 @@ main(int argc, char *argv[])
8896
*/
8997
argv = save_ps_display_args(argc, argv);
9098

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

0 commit comments

Comments
 (0)