Re: [bug fix] Produce a crash dump before main() on Windows - Mailing list pgsql-hackers

From Craig Ringer
Subject Re: [bug fix] Produce a crash dump before main() on Windows
Date
Msg-id CAMsr+YGv0zjTB1-y8X59sEwFN5AJz2g9tedSMX0gSwY1y69YxQ@mail.gmail.com
Whole thread Raw
In response to Re: [bug fix] Produce a crash dump before main() on Windows  (Michael Paquier <michael@paquier.xyz>)
Responses Re: [bug fix] Produce a crash dump before main() on Windows  (Michael Paquier <michael@paquier.xyz>)
List pgsql-hackers
On Mon, 23 Jul 2018 at 16:45, Michael Paquier <michael@paquier.xyz> wrote:
On Mon, Jul 23, 2018 at 08:16:52AM +0000, Tsunakawa, Takayuki wrote:
> I guess that is due to some missing files related to the libraries
> listed in shared_preload_library.  If so, no, because this patch
> relates to failure before main().

No, I really mean a library dependency failure.  For example, imagine
that Postgres is compiled on Windows dynamically, and that it depends on
libxml2.dll, which is itself compiled dynamically.  Then imagine, in a
custom build echosystem, that a folk comes in and adds lz support to
libxml2 on Windows.  If Postgres still consumes libxml2 but does not add
in its PATH a version of lz, then a backend in need of libxml2 would
fail to load, causing Postgres to not start properly.  True, painful,
story.

What's super fun about this is the error message. Guess which error Windows will emit? (Some paraphrasing for exact wording):

* "There was a problem starting C:\Program Files\PostgreSQL\11\bin\postgres.exe: The specified module could not be found."

* "There was a problem starting C:\Program Files\PostgreSQL\11\bin\postgres.exe: module "libxml2.dll" could not be found."
 
* "The program can't start because "libxml2.dll" is missing from your computer."

* "The program "C:\Program Files\PostgreSQL\11\bin\postgres.exe" can't start because an error was encountered when loading required library "C:\Program Files\PostgreSQL\11\lib\libxml.dll": libxml.dll requires "liblz.dll" but it could not be found."

Hint: not the last one.

It'll at best complain about libxml.dll being missing, despite it being very obviously present.

I had to go hunt around with Dependency Walker to figure out the actual missing DLL the last time I had to deal with this.

--
 Craig Ringer                   http://www.2ndQuadrant.com/
 2ndQuadrant - PostgreSQL Solutions for the Enterprise

pgsql-hackers by date:

Previous
From: Craig Ringer
Date:
Subject: Re: [bug fix] Produce a crash dump before main() on Windows
Next
From: Michael Paquier
Date:
Subject: Re: [bug fix] Produce a crash dump before main() on Windows